This is an automated email from the ASF dual-hosted git repository.

changchen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-gluten.git


The following commit(s) were added to refs/heads/main by this push:
     new f2ffda7517 [GLUTEN-7673][CH] Fix substrait infinite loop (#7674)
f2ffda7517 is described below

commit f2ffda7517098a6732868c68e22db28741358560
Author: Shuai li <[email protected]>
AuthorDate: Fri Oct 25 10:40:20 2024 +0800

    [GLUTEN-7673][CH] Fix substrait infinite loop (#7674)
---
 .../tpch/GlutenClickHouseTPCHParquetAQESuite.scala    | 19 +++++++++++++++++++
 .../local-engine/Parser/RelParsers/JoinRelParser.cpp  |  2 +-
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git 
a/backends-clickhouse/src/test/scala/org/apache/gluten/execution/tpch/GlutenClickHouseTPCHParquetAQESuite.scala
 
b/backends-clickhouse/src/test/scala/org/apache/gluten/execution/tpch/GlutenClickHouseTPCHParquetAQESuite.scala
index d06cd42a8d..eafc36963e 100644
--- 
a/backends-clickhouse/src/test/scala/org/apache/gluten/execution/tpch/GlutenClickHouseTPCHParquetAQESuite.scala
+++ 
b/backends-clickhouse/src/test/scala/org/apache/gluten/execution/tpch/GlutenClickHouseTPCHParquetAQESuite.scala
@@ -371,5 +371,24 @@ class GlutenClickHouseTPCHParquetAQESuite
            |""".stripMargin)(df => {})
     }
   }
+
+  test("GLUTEN-7673: fix substrait infinite loop") {
+    withSQLConf(("spark.sql.autoBroadcastJoinThreshold", "-1")) {
+      val result = sql(
+        s"""
+           |select l_orderkey
+           |from lineitem
+           |inner join orders
+           |on l_orderkey = o_orderkey
+           |  and ((l_shipdate = '2024-01-01' and l_partkey=1
+           |  and l_suppkey>2 and o_orderpriority=-987)
+           |  or l_shipmode>o_comment)
+           |order by l_orderkey limit 1
+           |""".stripMargin
+      ).collect()
+      // check no exception
+      assert(result.length == 1)
+    }
+  }
 }
 // scalastyle:off line.size.limit
diff --git a/cpp-ch/local-engine/Parser/RelParsers/JoinRelParser.cpp 
b/cpp-ch/local-engine/Parser/RelParsers/JoinRelParser.cpp
index c8b81b21a0..0781614bf0 100644
--- a/cpp-ch/local-engine/Parser/RelParsers/JoinRelParser.cpp
+++ b/cpp-ch/local-engine/Parser/RelParsers/JoinRelParser.cpp
@@ -679,7 +679,7 @@ bool JoinRelParser::couldRewriteToMultiJoinOnClauses(
             and_expression_stack.pop_back();
             if (check_function("and", current_expr))
             {
-                for (const auto & arg : e.scalar_function().arguments())
+                for (const auto & arg : 
current_expr.scalar_function().arguments())
                     and_expression_stack.push_back(&arg.value());
             }
             else if (check_function("equals", current_expr))


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to