loudongfeng commented on code in PR #5311:
URL: https://github.com/apache/incubator-gluten/pull/5311#discussion_r1557868604


##########
backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHHashAggregateExecTransformer.scala:
##########
@@ -349,13 +349,18 @@ case class CHHashAggregateExecTransformer(
               (makeStructTypeSingleOne(child.dataType, child.nullable), 
child.nullable)
             case covar: Covariance =>
               var fields = Seq[(DataType, Boolean)]()
-              fields = fields :+ (covar.left.dataType, covar.left.nullable)
-              fields = fields :+ (covar.right.dataType, covar.right.nullable)
+              // when COVAR_SAMP's input is non-nullable , due to its output 
maybe null in spark,
+              // backend parser will cast input type to nullable for 
intermediate agg,
+              // While final stage still use input type no changed.
+              // It causes type miss match between partial and final 
AggregationFunction
+              // so directly assign attr.nullable here, which should always be 
nullable
+              fields = fields :+ (covar.left.dataType, attr.nullable)
+              fields = fields :+ (covar.right.dataType, attr.nullable)

Review Comment:
   Please refer to the newly added test case "covar_samp non-nullable input", 
which use a temp inline table  and all columns are non-nullable.Before this 
fix, it will fail.



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