viirya commented on code in PR #1922:
URL: https://github.com/apache/arrow-rs/pull/1922#discussion_r904163992


##########
arrow/src/compute/kernels/cast.rs:
##########
@@ -72,9 +72,9 @@ pub fn can_cast_types(from_type: &DataType, to_type: 
&DataType) -> bool {
         // cast one decimal type to another decimal type
         (Decimal(_, _), Decimal(_, _)) => true,
         // signed numeric to decimal
-        (Int8 | Int16 | Int32 | Int64 | Float32 | Float64, Decimal(_, _)) |
+        (Null|Int8 | Int16 | Int32 | Int64 | Float32 | Float64, Decimal(_, _)) 
|
         // decimal to signed numeric
-        (Decimal(_, _), Int8 | Int16 | Int32 | Int64 | Float32 | Float64)
+        (Decimal(_, _), Null| Int8 | Int16 | Int32 | Int64 | Float32 | Float64)

Review Comment:
   Hmm, is it allowable to cast Decimal type to Null type? It looks a bit weird 
to me. For example, I re-checked Spark and it doesn't allow this kind of 
casting (anytype to NullType).
   
   I also checked C++ Cast kernels. Mostly the datatypes cannot cast to 
NullType (e.g. 
https://github.com/apache/arrow/blob/53752adc6b81166cd4ee7db5a819494042f29197/cpp/src/arrow/compute/kernels/scalar_cast_test.cc#L187-L211).
 I said "mostly" because I don't see explicit tests for other cases like 
Decimal, but I suspect that it is not allowed but just lack of test coverage.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to