NoeB commented on code in PR #1072:
URL: https://github.com/apache/datafusion-comet/pull/1072#discussion_r1835759807


##########
spark/src/test/scala/org/apache/comet/CometExpressionSuite.scala:
##########
@@ -2313,4 +2313,22 @@ class CometExpressionSuite extends CometTestBase with 
AdaptiveSparkPlanHelper {
       }
     }
   }
+
+  test("array_append") {

Review Comment:
   Good catch, I think I managed to create a test which creates this scenario:
    `checkSparkAnswerAndOperator(
             df.select(array_append(expr("CASE WHEN _2=_3 THEN array(_19) 
END"), col("_19"))))`
   Which fails with the following error message: 
   ```
     !== Correct Answer - 10 ==                                                 
            == Spark Answer - 10 ==
      struct<array_append(CASE WHEN (_2 = _3) THEN array(_19) END, 
_19):array<timestamp>>   struct<array_append(CASE WHEN (_2 = _3) THEN 
array(_19) END, _19):array<timestamp>>
      [ArrayBuffer(1969-12-31 16:00:00.0, 1969-12-31 16:00:00.0)]               
            [ArrayBuffer(1969-12-31 16:00:00.0, 1969-12-31 16:00:00.0)]
      [ArrayBuffer(1969-12-31 16:00:00.0, 1969-12-31 16:00:00.0)]               
            [ArrayBuffer(1969-12-31 16:00:00.0, 1969-12-31 16:00:00.0)]
      [ArrayBuffer(1969-12-31 16:00:00.000001, 1969-12-31 16:00:00.000001)]     
            [ArrayBuffer(1969-12-31 16:00:00.000001, 1969-12-31 
16:00:00.000001)]
      [ArrayBuffer(1969-12-31 16:00:00.000002, 1969-12-31 16:00:00.000002)]     
            [ArrayBuffer(1969-12-31 16:00:00.000002, 1969-12-31 
16:00:00.000002)]
      [ArrayBuffer(1969-12-31 16:00:00.000003, 1969-12-31 16:00:00.000003)]     
            [ArrayBuffer(1969-12-31 16:00:00.000003, 1969-12-31 
16:00:00.000003)]
      [ArrayBuffer(1969-12-31 16:00:00.000003, 1969-12-31 16:00:00.000003)]     
            [ArrayBuffer(1969-12-31 16:00:00.000003, 1969-12-31 
16:00:00.000003)]
     ![null]                                                                    
            [ArrayBuffer(null)]
     ![null]                                                                    
            [ArrayBuffer(null)]
   ```
   Should I create an issue on the DataFusion repo? Or is it unlikely that they 
will support it because their implementation seems to match the one of Postgres?
   
   
   **Datafusion / Postgres**
   ``` 
   SELECT array_append( CASE WHEN 1=2 THEN Array[1,2,3] END,  4);
   returns: [4]
   ```
   
   **Spark**
   ```
   spark.sql("SELECT array_prepend(     CASE WHEN 1=2 THEN ARRAY(1,2,3) END,  
4);").show
   returns:  NULL
   ```



-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to