From 89b7835e991a87a825062ea891c525d26af87932 Mon Sep 17 00:00:00 2001 From: taiyang-li <654010905@qq.com> Date: Mon, 2 Sep 2024 23:17:30 +0800 Subject: [PATCH] fix cse alias issues --- .../extension/CommonSubexpressionEliminateRule.scala | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backends-clickhouse/src/main/scala/org/apache/gluten/extension/CommonSubexpressionEliminateRule.scala b/backends-clickhouse/src/main/scala/org/apache/gluten/extension/CommonSubexpressionEliminateRule.scala index a3b74366fc7b7..2dbe3ed29176b 100644 --- a/backends-clickhouse/src/main/scala/org/apache/gluten/extension/CommonSubexpressionEliminateRule.scala +++ b/backends-clickhouse/src/main/scala/org/apache/gluten/extension/CommonSubexpressionEliminateRule.scala @@ -121,7 +121,12 @@ class CommonSubexpressionEliminateRule(session: SparkSession, conf: SQLConf) if (expr.find(_.isInstanceOf[AggregateExpression]).isDefined) { addToEquivalentExpressions(expr, equivalentExpressions) } else { - equivalentExpressions.addExprTree(expr) + expr match { + case alias: Alias => + equivalentExpressions.addExprTree(alias.child) + case _ => + equivalentExpressions.addExprTree(expr) + } } })