@@ -321,7 +321,7 @@ impl Value {
321
321
let value_type_id = self . logical_type_id ( ) ;
322
322
let output_type_id = output_type. logical_type_id ( ) ;
323
323
ensure ! (
324
- output_type_id == value_type_id || self . is_null( ) ,
324
+ output_type_id == value_type_id || self . is_null( ) || ( output_type_id == LogicalTypeId :: Json && value_type_id == LogicalTypeId :: Binary ) ,
325
325
error:: ToScalarValueSnafu {
326
326
reason: format!(
327
327
"expect value to return output_type {output_type_id:?}, actual: {value_type_id:?}" ,
@@ -1824,14 +1824,6 @@ mod tests {
1824
1824
& ConcreteDataType :: decimal128_datatype ( 38 , 10 ) ,
1825
1825
& Value :: Decimal128 ( Decimal128 :: new ( 1 , 38 , 10 ) ) ,
1826
1826
) ;
1827
-
1828
- let jsonb_value = jsonb:: parse_value ( r#"{"key": "value"}"# . as_bytes ( ) )
1829
- . unwrap ( )
1830
- . to_vec ( ) ;
1831
- check_type_and_value (
1832
- & ConcreteDataType :: json_datatype ( ) ,
1833
- & Value :: Binary ( jsonb_value. into ( ) ) ,
1834
- ) ;
1835
1827
}
1836
1828
1837
1829
#[ test]
@@ -1945,15 +1937,6 @@ mod tests {
1945
1937
datatype: ConcreteDataType :: int32_datatype( ) ,
1946
1938
} ) )
1947
1939
) ;
1948
-
1949
- let jsonb_value =
1950
- jsonb:: parse_value ( r#"{"items":[{"Int32":123}],"datatype":{"Int32":{}}}"# . as_bytes ( ) )
1951
- . unwrap ( ) ;
1952
- let json_value: serde_json:: Value = jsonb_value. clone ( ) . into ( ) ;
1953
- assert_eq ! (
1954
- json_value,
1955
- to_json( Value :: Binary ( jsonb_value. to_vec( ) . into( ) ) )
1956
- ) ;
1957
1940
}
1958
1941
1959
1942
#[ test]
0 commit comments