viirya opened a new issue, #1923:
URL: https://github.com/apache/arrow-rs/issues/1923

   **Describe the bug**
   
   We allow casting from other datatypes to NullType (see `can_cast_types`). I 
suspect that this is a mistake.
   
   For example, Spark doesn't allow casting from any datatypes 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.
   
   I don't see there is cast kernel in C++ for casting to NullType except for a 
special case (`dict<null> -> null`): 
https://github.com/apache/arrow/blob/53752adc6b81166cd4ee7db5a819494042f29197/cpp/src/arrow/compute/kernels/scalar_cast_numeric.cc#L748-L751.
 Even for that, there is a comment questioning about it.
   
   
   
   **To Reproduce**
   Steps to reproduce the behavior:
   
   **Expected behavior**
   
   Cast kernel should not allow casting from any datatypes to NullType.
   
   
   **Additional context**
   Add any other context about the problem here.
   


-- 
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