From e842468b8d6789333e2793656b1c7eaa1d3f9093 Mon Sep 17 00:00:00 2001 From: "wangguangxin.cn" Date: Fri, 3 Jan 2025 15:21:47 +0800 Subject: [PATCH] support null type in hashagg --- .../gluten/execution/MiscOperatorSuite.scala | 20 +++++++++++-------- .../substrait/VeloxSubstraitSignature.cc | 4 ++++ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/backends-velox/src/test/scala/org/apache/gluten/execution/MiscOperatorSuite.scala b/backends-velox/src/test/scala/org/apache/gluten/execution/MiscOperatorSuite.scala index 42e3e0bcc77a..760d2eec7d61 100644 --- a/backends-velox/src/test/scala/org/apache/gluten/execution/MiscOperatorSuite.scala +++ b/backends-velox/src/test/scala/org/apache/gluten/execution/MiscOperatorSuite.scala @@ -1275,14 +1275,12 @@ class MiscOperatorSuite extends VeloxWholeStageTransformerSuite with AdaptiveSpa |select cast(id as int) as c1, cast(id as string) c2 from range(100) order by c1 desc; |""".stripMargin) - withSQLConf("spark.gluten.sql.columnar.forceShuffledHashJoin" -> "true") { - runQueryAndCompare( - """ - |select * from t1 cross join t2 on t1.c1 = t2.c1; - |""".stripMargin - ) { - checkGlutenOperatorMatch[ShuffledHashJoinExecTransformer] - } + runQueryAndCompare( + """ + |select * from t1 cross join t2 on t1.c1 = t2.c1; + |""".stripMargin + ) { + checkGlutenOperatorMatch[ShuffledHashJoinExecTransformer] } withSQLConf("spark.sql.autoBroadcastJoinThreshold" -> "1MB") { @@ -1985,4 +1983,10 @@ class MiscOperatorSuite extends VeloxWholeStageTransformerSuite with AdaptiveSpa } } } + + test("support null type in aggregate") { + runQueryAndCompare("SELECT max(null), min(null) from range(10)".stripMargin) { + checkGlutenOperatorMatch[HashAggregateExecTransformer] + } + } } diff --git a/cpp/velox/substrait/VeloxSubstraitSignature.cc b/cpp/velox/substrait/VeloxSubstraitSignature.cc index e1f716ae2088..a68870f653ab 100644 --- a/cpp/velox/substrait/VeloxSubstraitSignature.cc +++ b/cpp/velox/substrait/VeloxSubstraitSignature.cc @@ -159,6 +159,10 @@ TypePtr VeloxSubstraitSignature::fromSubstraitSignature(const std::string& signa return DATE(); } + if (signature == "nothing") { + return UNKNOWN(); + } + auto startWith = [](const std::string& str, const std::string& prefix) { return str.size() >= prefix.size() && str.substr(0, prefix.size()) == prefix; };