From 6b849a593e5a4d8bd84813c74730ef528b500c69 Mon Sep 17 00:00:00 2001 From: Yang Zhang Date: Tue, 23 Jan 2024 08:58:13 +0800 Subject: [PATCH] [VL] Add a test to verify hex function is offloaded (#4469) --- .../execution/VeloxFunctionsValidateSuite.scala | 6 ++++++ cpp/velox/benchmarks/PlanValidatorUtil.cc | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/backends-velox/src/test/scala/io/glutenproject/execution/VeloxFunctionsValidateSuite.scala b/backends-velox/src/test/scala/io/glutenproject/execution/VeloxFunctionsValidateSuite.scala index 8b37f49bbe3a..be349f4ef8e2 100644 --- a/backends-velox/src/test/scala/io/glutenproject/execution/VeloxFunctionsValidateSuite.scala +++ b/backends-velox/src/test/scala/io/glutenproject/execution/VeloxFunctionsValidateSuite.scala @@ -383,4 +383,10 @@ class VeloxFunctionsValidateSuite extends VeloxWholeStageTransformerSuite { checkOperatorMatch[ProjectExecTransformer] } } + + test("Test hex function") { + runQueryAndCompare("SELECT hex(l_partkey), hex(l_shipmode) FROM lineitem limit 1") { + checkOperatorMatch[ProjectExecTransformer] + } + } } diff --git a/cpp/velox/benchmarks/PlanValidatorUtil.cc b/cpp/velox/benchmarks/PlanValidatorUtil.cc index 3afb2ee00265..229804368913 100644 --- a/cpp/velox/benchmarks/PlanValidatorUtil.cc +++ b/cpp/velox/benchmarks/PlanValidatorUtil.cc @@ -18,13 +18,14 @@ #include "benchmarks/common/BenchmarkUtils.h" #include "compute/VeloxBackend.h" #include "compute/VeloxRuntime.h" +#include "config/GlutenConfig.h" #include "memory/VeloxMemoryManager.h" #include "substrait/SubstraitToVeloxPlanValidator.h" using namespace gluten; /// Set spark.gluten.sql.debug=true to get validation plan and dump it into a json file, -/// then use this util debug validate process easilly in native side. +/// then use this util debug validate process easily in native side. int main(int argc, char** argv) { if (argc != 2) { LOG(WARNING) << "PlanValidatorUtil usage: \n" @@ -39,6 +40,9 @@ int main(int argc, char** argv) { std::string msgData = buffer.str(); auto plan = substraitFromJsonToPb("Plan", msgData); + std::unordered_map conf; + conf.insert({kDebugModeEnabled, "true"}); + initVeloxBackend(conf); core::QueryCtx queryCtx; auto pool = defaultLeafVeloxMemoryPool().get(); core::ExecCtx execCtx(pool, &queryCtx);