From 281a4c33fc59ae9528d4343afc6e30f9128d41ba Mon Sep 17 00:00:00 2001 From: Socrates Date: Thu, 8 May 2025 00:24:08 +0800 Subject: [PATCH] fix --- be/src/vec/exec/format/orc/vorc_reader.cpp | 23 ++++-------- .../format/parquet/vparquet_group_reader.cpp | 37 ++++++------------- 2 files changed, 20 insertions(+), 40 deletions(-) diff --git a/be/src/vec/exec/format/orc/vorc_reader.cpp b/be/src/vec/exec/format/orc/vorc_reader.cpp index 0ee013ef281bf4..58c4ef8fbade29 100644 --- a/be/src/vec/exec/format/orc/vorc_reader.cpp +++ b/be/src/vec/exec/format/orc/vorc_reader.cpp @@ -2357,22 +2357,15 @@ bool OrcReader::_can_filter_by_dict(int slot_id) { return false; } - std::function visit_function_call = [&](const VExpr* expr) { - // TODO: The current implementation of dictionary filtering does not take into account - // the implementation of NULL values because the dictionary itself does not contain - // NULL value encoding. As a result, many NULL-related functions or expressions - // cannot work properly, such as is null, is not null, coalesce, etc. - // Here we first disable dictionary filtering when predicate expr is not slot. - // Implementation of NULL value dictionary filtering will be carried out later. - if (expr->node_type() != TExprNodeType::SLOT_REF) { - return false; - } - return std::ranges::all_of(expr->children(), [&](const auto& child) { - return visit_function_call(child.get()); - }); - }; + // TODO: The current implementation of dictionary filtering does not take into account + // the implementation of NULL values because the dictionary itself does not contain + // NULL value encoding. As a result, many NULL-related functions or expressions + // cannot work properly, such as is null, is not null, coalesce, etc. + // Here we check if the predicate expr is IN or BINARY_PRED. + // Implementation of NULL value dictionary filtering will be carried out later. return std::ranges::all_of(_slot_id_to_filter_conjuncts->at(slot_id), [&](const auto& ctx) { - return visit_function_call(ctx->root().get()); + return ctx->root()->node_type() == TExprNodeType::IN_PRED || + ctx->root()->node_type() == TExprNodeType::BINARY_PRED; }); } diff --git a/be/src/vec/exec/format/parquet/vparquet_group_reader.cpp b/be/src/vec/exec/format/parquet/vparquet_group_reader.cpp index 17697eaddab1aa..3aa9fcebe96cb9 100644 --- a/be/src/vec/exec/format/parquet/vparquet_group_reader.cpp +++ b/be/src/vec/exec/format/parquet/vparquet_group_reader.cpp @@ -200,37 +200,24 @@ bool RowGroupReader::_can_filter_by_dict(int slot_id, return false; } - if (_slot_id_to_filter_conjuncts->find(slot_id) == _slot_id_to_filter_conjuncts->end()) { + if (!is_dictionary_encoded(column_metadata)) { return false; } - if (!is_dictionary_encoded(column_metadata)) { + if (_slot_id_to_filter_conjuncts->find(slot_id) == _slot_id_to_filter_conjuncts->end()) { return false; } - std::function visit_function_call = [&](const VExpr* expr) { - // TODO: The current implementation of dictionary filtering does not take into account - // the implementation of NULL values because the dictionary itself does not contain - // NULL value encoding. As a result, many NULL-related functions or expressions - // cannot work properly, such as is null, is not null, coalesce, etc. - // Here we first disable dictionary filtering when predicate is not slot. - // Implementation of NULL value dictionary filtering will be carried out later. - if (expr->node_type() != TExprNodeType::SLOT_REF) { - return false; - } - for (auto& child : expr->children()) { - if (!visit_function_call(child.get())) { - return false; - } - } - return true; - }; - for (auto& ctx : _slot_id_to_filter_conjuncts->at(slot_id)) { - if (!visit_function_call(ctx->root().get())) { - return false; - } - } - return true; + // TODO: The current implementation of dictionary filtering does not take into account + // the implementation of NULL values because the dictionary itself does not contain + // NULL value encoding. As a result, many NULL-related functions or expressions + // cannot work properly, such as is null, is not null, coalesce, etc. + // Here we check if the predicate expr is IN or BINARY_PRED. + // Implementation of NULL value dictionary filtering will be carried out later. + return std::ranges::all_of(_slot_id_to_filter_conjuncts->at(slot_id), [&](const auto& ctx) { + return ctx->root()->node_type() == TExprNodeType::IN_PRED || + ctx->root()->node_type() == TExprNodeType::BINARY_PRED; + }); } // This function is copied from