HappenLee commented on code in PR #17594: URL: https://github.com/apache/doris/pull/17594#discussion_r1133428175
########## be/src/vec/exec/format/parquet/vparquet_group_reader.cpp: ########## @@ -71,11 +97,136 @@ Status RowGroupReader::init(const FieldDescriptor& schema, std::vector<RowRange> } _column_readers[read_col._file_slot_name] = std::move(reader); } + // Check if single slot can be filtered by dict. + if (!_slot_id_to_filter_conjuncts) { + return Status::OK(); + } + for (auto& predicate_col_name : _lazy_read_ctx.predicate_columns) { + auto field = const_cast<FieldSchema*>(schema.get_column(predicate_col_name)); + if (_can_filter_by_dict(predicate_col_name, + _row_group_meta.columns[field->physical_column_index].meta_data)) { + _dict_filter_col_names.emplace_back(predicate_col_name); + } else { + int slot_id = _col_name_to_slot_id->at(predicate_col_name); + if (_slot_id_to_filter_conjuncts->find(slot_id) != + _slot_id_to_filter_conjuncts->end()) { + for (VExprContext* ctx : _slot_id_to_filter_conjuncts->at(slot_id)) { + _filter_conjuncts.push_back(ctx); + } + } + } + } + RETURN_IF_ERROR(_rewrite_dict_predicates()); return Status::OK(); } +bool RowGroupReader::_can_filter_by_dict(const string& predicate_col_name, + const tparquet::ColumnMetaData& column_metadata) { + SlotDescriptor* slot = nullptr; + const std::vector<SlotDescriptor*>& slots = _tuple_descriptor->slots(); + int slot_id = _col_name_to_slot_id->at(predicate_col_name); + for (auto each : slots) { + if (each->id() == slot_id) { + slot = each; + break; + } + } + if (!slot->type().is_string_type()) { + return false; + } + + if (_slot_id_to_filter_conjuncts->find(slot_id) == _slot_id_to_filter_conjuncts->end()) { + return false; + } + + if (!is_dictionary_encoded(column_metadata)) { + return false; + } + + for (VExprContext* ctx : _slot_id_to_filter_conjuncts->at(slot_id)) { + const VExpr* root_expr = ctx->root(); + if (root_expr->node_type() == TExprNodeType::FUNCTION_CALL) { Review Comment: if the conjunt is `a > 10 is null ` ? the logic seems do the consider the case -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org