parthchandra commented on code in PR #2897:
URL: https://github.com/apache/datafusion-comet/pull/2897#discussion_r2963207830


##########
native/spark-expr/src/conversion_funcs/cast.rs:
##########
@@ -294,6 +293,7 @@ pub(crate) fn cast_array(
     };
 
     let cast_result = match (&from_type, to_type) {
+        (Null, _) => Ok(cast_with_options(&array, to_type, 
&native_cast_options)?),

Review Comment:
   Do we have this case covered in a unit test? Something like ` 
cast(array(null), 'array<int>')`



##########
spark/src/test/scala/org/apache/comet/CometCastSuite.scala:
##########
@@ -1182,10 +1206,10 @@ class CometCastSuite extends CometTestBase with 
AdaptiveSparkPlanHelper {
     withNulls(gen.generateLongs(dataSize)).toDF("a")
   }
 
-  private def generateArrays(rowSize: Int, elementType: DataType): DataFrame = 
{
+  private def generateArrays(rowNum: Int, elementType: DataType): DataFrame = {

Review Comment:
   `numRows` would be even clearer :) 



##########
spark/src/test/scala/org/apache/comet/CometCastSuite.scala:
##########
@@ -1266,6 +1266,30 @@ class CometCastSuite extends CometTestBase with 
AdaptiveSparkPlanHelper {
     }
   }
 
+  test("cast ArrayType to ArrayType") {

Review Comment:
   Could we add this (or similar tests) in [SQL file 
tests](https://datafusion.apache.org/comet/contributor-guide/sql-file-tests.html#sql-file-tests).
 See the tests in spark/src/test/resources/sql-tests/expressions/array/*.sql



##########
native/spark-expr/src/conversion_funcs/cast.rs:
##########
@@ -294,6 +293,7 @@ pub(crate) fn cast_array(
     };
 
     let cast_result = match (&from_type, to_type) {
+        (Null, _) => Ok(cast_with_options(&array, to_type, 
&native_cast_options)?),

Review Comment:
   Also, maybe add a short comment for why we needed this.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to