This is an automated email from the ASF dual-hosted git repository. rui pushed a commit to branch data_col in repository https://gitbox.apache.org/repos/asf/incubator-gluten.git
commit be222bd199a90bdf2a27262e37bed1ba90afa664 Author: Rui Mo <[email protected]> AuthorDate: Thu May 29 21:52:17 2025 +0800 try --- cpp/velox/substrait/SubstraitToVeloxPlan.cc | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/cpp/velox/substrait/SubstraitToVeloxPlan.cc b/cpp/velox/substrait/SubstraitToVeloxPlan.cc index c6951fd8a9..c8bf978e62 100644 --- a/cpp/velox/substrait/SubstraitToVeloxPlan.cc +++ b/cpp/velox/substrait/SubstraitToVeloxPlan.cc @@ -1301,17 +1301,12 @@ core::PlanNodePtr SubstraitToVeloxPlanConverter::toVeloxPlan(const ::substrait:: } // Data columns are used as requested type in Velox. To support reading binary as string, requested type needs to be - // provided. However, to workaround the type check between element type and array type for unannotated array, for - // array type the requested type is set to nullptr. + // provided. To avoid the type check between element type and array type for unannotated array, we add this + // temporary workaround to only use requested type when the type includes VARCHAR. auto names = colNameList; - std::vector<TypePtr> types; - for (const auto& type : veloxTypeList) { - if (type->kind() == TypeKind::ARRAY) { - types.push_back(nullptr); - } else { - types.emplace_back(type); - } - } + auto types = veloxTypeList; + bool needsRequestedType = std::any_of( + veloxTypeList.begin(), veloxTypeList.end(), [](const auto& type) { return type->kind() == TypeKind::VARCHAR; }); auto dataColumns = ROW(std::move(names), std::move(types)); // Velox requires Filter Pushdown must being enabled. @@ -1319,7 +1314,12 @@ core::PlanNodePtr SubstraitToVeloxPlanConverter::toVeloxPlan(const ::substrait:: std::shared_ptr<connector::hive::HiveTableHandle> tableHandle; if (!readRel.has_filter()) { tableHandle = std::make_shared<connector::hive::HiveTableHandle>( - kHiveConnectorId, "hive_table", filterPushdownEnabled, common::SubfieldFilters{}, nullptr, dataColumns); + kHiveConnectorId, + "hive_table", + filterPushdownEnabled, + common::SubfieldFilters{}, + nullptr, + needsRequestedType ? dataColumns : nullptr); } else { common::SubfieldFilters subfieldFilters; auto remainingFilter = exprConverter_->toVeloxExpr(readRel.filter(), dataColumns); @@ -1330,7 +1330,7 @@ core::PlanNodePtr SubstraitToVeloxPlanConverter::toVeloxPlan(const ::substrait:: filterPushdownEnabled, std::move(subfieldFilters), remainingFilter, - dataColumns); + needsRequestedType ? dataColumns : nullptr); } // Get assignments and out names. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
