From b2769ad42a480d7ea4a7d52ffdd576c111d635e1 Mon Sep 17 00:00:00 2001 From: Wei He Date: Wed, 11 Dec 2024 19:06:24 -0800 Subject: [PATCH] fix(fuzzer): Fix SQL translation of between() in PrestoQueryRunner (#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 --- velox/exec/fuzzer/ToSQLUtil.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/velox/exec/fuzzer/ToSQLUtil.cpp b/velox/exec/fuzzer/ToSQLUtil.cpp index e85d98a9631c..e2f601475836 100644 --- a/velox/exec/fuzzer/ToSQLUtil.cpp +++ b/velox/exec/fuzzer/ToSQLUtil.cpp @@ -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() << "(";