From 6100b60a8b08fac348739b2ac0b252f9c274eba4 Mon Sep 17 00:00:00 2001 From: Zhen Li <10524738+zhli1142015@users.noreply.github.com> Date: Tue, 23 Apr 2024 07:38:57 +0800 Subject: [PATCH] [VL] Fix negative function mapping (#5481) [VL] Fix negative function mapping. --- .../gluten/execution/ScalarFunctionsValidateSuite.scala | 6 ++++++ cpp/velox/substrait/SubstraitParser.cc | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/backends-velox/src/test/scala/org/apache/gluten/execution/ScalarFunctionsValidateSuite.scala b/backends-velox/src/test/scala/org/apache/gluten/execution/ScalarFunctionsValidateSuite.scala index b885a59c0e0e..93f82f752481 100644 --- a/backends-velox/src/test/scala/org/apache/gluten/execution/ScalarFunctionsValidateSuite.scala +++ b/backends-velox/src/test/scala/org/apache/gluten/execution/ScalarFunctionsValidateSuite.scala @@ -805,4 +805,10 @@ class ScalarFunctionsValidateSuite extends FunctionsValidateTest { } } + test("negative") { + runQueryAndCompare("select negative(l_orderkey) from lineitem") { + checkGlutenOperatorMatch[ProjectExecTransformer] + } + } + } diff --git a/cpp/velox/substrait/SubstraitParser.cc b/cpp/velox/substrait/SubstraitParser.cc index 4bef97a60008..9050c2ec8cd8 100644 --- a/cpp/velox/substrait/SubstraitParser.cc +++ b/cpp/velox/substrait/SubstraitParser.cc @@ -405,7 +405,8 @@ std::unordered_map SubstraitParser::substraitVeloxFunc {"collect_set", "set_agg"}, {"try_add", "plus"}, {"forall", "all_match"}, - {"exists", "any_match"}}; + {"exists", "any_match"}, + {"negative", "unaryminus"}}; const std::unordered_map SubstraitParser::typeMap_ = { {"bool", "BOOLEAN"},