Skip to content

Commit

Permalink
fix(fuzzer): Fix SQL translation of between() in PrestoQueryRunner (#…
Browse files Browse the repository at this point in the history
…11819)

Summary:

The between() function requires a special syntax in SQL. This diff fixes PrestoQueryRunner to take care 
of between() when translating an expression to SQL.

Reviewed By: yuandagits

Differential Revision: D67058882
  • Loading branch information
kagamiori authored and facebook-github-bot committed Dec 12, 2024
1 parent b44ffc9 commit b2769ad
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions velox/exec/fuzzer/ToSQLUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,14 @@ std::string toCallSql(const core::CallTypedExprPtr& call) {
sql << "ARRAY[";
toCallInputsSql(call->inputs(), sql);
sql << "]";
} else if (call->name() == "between") {
const auto& inputs = call->inputs();
VELOX_CHECK_EQ(inputs.size(), 3);
toCallInputsSql({inputs[0]}, sql);
sql << " between ";
toCallInputsSql({inputs[1]}, sql);
sql << " and ";
toCallInputsSql({inputs[2]}, sql);
} else {
// Regular function call syntax.
sql << call->name() << "(";
Expand Down

0 comments on commit b2769ad

Please sign in to comment.