Skip to content

Commit

Permalink
[GLUTEN-7673][CH] Fix substrait infinite loop (apache#7674)
Browse files Browse the repository at this point in the history
  • Loading branch information
loneylee authored Oct 25, 2024
1 parent 0d3af2a commit f2ffda7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion cpp-ch/local-engine/Parser/RelParsers/JoinRelParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit f2ffda7

Please sign in to comment.