AngersZhuuuu opened a new pull request #33082:
URL: https://github.com/apache/spark/pull/33082
### What changes were proposed in this pull request?
For test case
```
spark.sql(
"""
|CREATE TABLE t1 (
| c1 DECIMAL(18,6),
| c2 DECIMAL(18,6),
| c3 DECIMAL(18,6))
|USING parquet;
|""".stripMargin)
spark.sql("SELECT sum(c1 * c3) + sum(c2 * c3) FROM t1").show
```
failed when codegen
```
20:23:36.272 ERROR
org.apache.spark.sql.catalyst.expressions.codegen.CodeGenerator: failed to
compile: org.codehaus.commons.compiler.CompileException: File 'generated.java',
Line 56, Column 6: Expression "agg_exprIsNull_2_0" is not an rvalue
org.codehaus.commons.compiler.CompileException: File 'generated.java', Line
56, Column 6: Expression "agg_exprIsNull_2_0" is not an rvalue
at
org.codehaus.janino.UnitCompiler.compileError(UnitCompiler.java:12675)
at
org.codehaus.janino.UnitCompiler.toRvalueOrCompileException(UnitCompiler.java:7676)
```
It's caused by when call CodeGenerator.getLocalInputVariableValues, some
expression match subquery but is not VariableValue, then skip this
expression, but when call `splitAggregateExpressions`, since we need to find
all input variables by this method, this will cause we skip some inputs.
Here in this case , we put expression's children to stack too.
### Why are the changes needed?
Fix Bug
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
Added UT
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]