diff --git a/cpp/velox/compute/VeloxBackend.cc b/cpp/velox/compute/VeloxBackend.cc index fedb5aa1712..8e54762fc01 100644 --- a/cpp/velox/compute/VeloxBackend.cc +++ b/cpp/velox/compute/VeloxBackend.cc @@ -187,8 +187,7 @@ void VeloxBackend::init( velox::parquet::registerParquetReaderFactory(); velox::parquet::registerParquetWriterFactory(); velox::orc::registerOrcReaderFactory(); - velox::exec::ExprToSubfieldFilterParser::registerParserFactory( - []() { return std::make_shared(); }); + velox::exec::ExprToSubfieldFilterParser::registerParser(std::make_unique()); // Register Velox functions registerAllFunctions(); diff --git a/cpp/velox/operators/functions/SparkExprToSubfieldFilterParser.cc b/cpp/velox/operators/functions/SparkExprToSubfieldFilterParser.cc index e17796632e3..c1bc452bd83 100644 --- a/cpp/velox/operators/functions/SparkExprToSubfieldFilterParser.cc +++ b/cpp/velox/operators/functions/SparkExprToSubfieldFilterParser.cc @@ -20,6 +20,32 @@ namespace gluten { using namespace facebook::velox; +std::pair> SparkExprToSubfieldFilterParser::toSubfieldFilter( + const core::TypedExprPtr& expr, + core::ExpressionEvaluator* evaluator) { + if (expr->isCallKind(); auto* call = expr->asUnchecked()) { + if (call->name() == "or") { + auto left = toSubfieldFilter(call->inputs()[0], evaluator); + auto right = toSubfieldFilter(call->inputs()[1], evaluator); + VELOX_CHECK(left.first == right.first); + return {std::move(left.first), makeOrFilter(std::move(left.second), std::move(right.second))}; + } + common::Subfield subfield; + std::unique_ptr filter; + if (call->name() == "not") { + if (auto* inner = call->inputs()[0]->asUnchecked()) { + filter = leafCallToSubfieldFilter(*inner, subfield, evaluator, true); + } + } else { + filter = leafCallToSubfieldFilter(*call, subfield, evaluator, false); + } + if (filter) { + return std::make_pair(std::move(subfield), std::move(filter)); + } + } + VELOX_UNSUPPORTED("Unsupported expression for range filter: {}", expr->toString()); +} + std::unique_ptr SparkExprToSubfieldFilterParser::leafCallToSubfieldFilter( const core::CallTypedExpr& call, common::Subfield& subfield, diff --git a/cpp/velox/operators/functions/SparkExprToSubfieldFilterParser.h b/cpp/velox/operators/functions/SparkExprToSubfieldFilterParser.h index 84f28325f7b..4b699fb172c 100644 --- a/cpp/velox/operators/functions/SparkExprToSubfieldFilterParser.h +++ b/cpp/velox/operators/functions/SparkExprToSubfieldFilterParser.h @@ -23,6 +23,10 @@ namespace gluten { /// 2) The supported functions vary. class SparkExprToSubfieldFilterParser : public facebook::velox::exec::ExprToSubfieldFilterParser { public: + std::pair> toSubfieldFilter( + const facebook::velox::core::TypedExprPtr& expr, + facebook::velox::core::ExpressionEvaluator* evaluator) override; + std::unique_ptr leafCallToSubfieldFilter( const facebook::velox::core::CallTypedExpr& call, facebook::velox::common::Subfield& subfield, diff --git a/ep/build-velox/src/get-velox.sh b/ep/build-velox/src/get-velox.sh index 961b2d99ee2..8ae534be1af 100755 --- a/ep/build-velox/src/get-velox.sh +++ b/ep/build-velox/src/get-velox.sh @@ -18,11 +18,11 @@ set -exu CURRENT_DIR=$(cd "$(dirname "$BASH_SOURCE")"; pwd) VELOX_REPO=https://github.com/oap-project/velox.git -VELOX_BRANCH=2025_11_04 +VELOX_BRANCH=2025_11_05 VELOX_HOME="" RUN_SETUP_SCRIPT=ON VELOX_ENHANCED_REPO=https://github.com/IBM/velox.git -VELOX_ENHANCED_BRANCH=ibm-2025_11_04 +VELOX_ENHANCED_BRANCH=ibm-2025_11_05 ENABLE_ENHANCED_FEATURES=OFF # Developer use only for testing Velox PR.