github-actions[bot] commented on code in PR #62306:
URL: https://github.com/apache/doris/pull/62306#discussion_r3090683722
##########
be/src/exec/scan/file_scanner.cpp:
##########
@@ -1760,20 +1643,66 @@ Status FileScanner::_init_expr_ctxes() {
_partition_slot_index_map.emplace(slot_id, kit->second);
}
}
+
+ if (is_file_slot) {
+ _is_file_slot.emplace(slot_id);
+ _file_slot_descs.emplace_back(it->second);
+ _file_col_names.push_back(it->second->col_name());
+ }
+
+ _column_descs.push_back(col_desc);
}
// set column name to default value expr map
- for (auto* slot_desc : _real_tuple_desc->slots()) {
+ // new inline TFileScanSlotInfo.default_value_expr (preferred)
+ for (const auto& slot_info : _params->required_slots) {
+ auto slot_id = slot_info.slot_id;
+ auto it = full_src_slot_map.find(slot_id);
+ if (it == std::end(full_src_slot_map)) {
+ continue;
+ }
+ const std::string& col_name = it->second->col_name();
+
Review Comment:
The old `default_value_of_src_slot` fallback cannot be removed yet.
`default_value_expr` is a new optional thrift field, so BE still needs the
legacy map for mixed version FE and BE, and there are also callers that still
rebuild `required_slots` without the inline field.
With this block commented out, those paths silently lose missing column
defaults after the refactor. Please keep the inline field as the preferred
source, but preserve the legacy fallback until every caller is updated and
rolling upgrade compatibility is no longer required.
##########
be/src/format/table/hudi_reader.cpp:
##########
@@ -20,38 +20,60 @@
#include <vector>
#include "common/status.h"
-#include "runtime/runtime_state.h"
namespace doris {
-Status HudiReader::get_next_block_inner(Block* block, size_t* read_rows, bool*
eof) {
- RETURN_IF_ERROR(_file_format_reader->get_next_block(block, read_rows,
eof));
- return Status::OK();
-};
-
-Status HudiParquetReader::init_reader(
- const std::vector<std::string>& read_table_col_names,
- std::unordered_map<std::string, uint32_t>* col_name_to_block_idx,
- const VExprContextSPtrs& conjuncts,
- phmap::flat_hash_map<int,
std::vector<std::shared_ptr<ColumnPredicate>>>&
- slot_id_to_predicates,
- const TupleDescriptor* tuple_descriptor, const RowDescriptor*
row_descriptor,
- const std::unordered_map<std::string, int>* colname_to_slot_id,
- const VExprContextSPtrs* not_single_slot_filter_conjuncts,
- const std::unordered_map<int, VExprContextSPtrs>*
slot_id_to_filter_conjuncts) {
- auto* parquet_reader =
static_cast<ParquetReader*>(_file_format_reader.get());
+// ============================================================================
+// HudiParquetReader: on_before_init_reader
+// ============================================================================
+Status HudiParquetReader::on_before_init_reader(ReaderInitContext* ctx) {
Review Comment:
These Hudi overrides replaced the shared `on_before_init_reader()` setup
instead of extending it, but they never call
`_extract_partition_values(*ctx->range, ctx->tuple_descriptor,
_fill_partition_values)`.
That matters for native COW scans because partition columns are still
classified as `PARTITION_KEY` on the FE side through `HudiScanNode ->
HiveScanNode`. They are therefore excluded from `ctx->column_names`, and
Parquet or ORC later rely on `_fill_partition_values` inside
`on_fill_partition_columns()` to materialize them. After this change, a query
like `select ds, ...` on a partitioned Hudi COW table leaves `ds` unfilled. The
ORC variant below has the same issue.
##########
fe/fe-core/src/main/java/org/apache/doris/datasource/FileQueryScanNode.java:
##########
@@ -189,19 +188,24 @@ private void updateRequiredSlots() throws UserException {
for (SlotDescriptor slot : desc.getSlots()) {
TFileScanSlotInfo slotInfo = new TFileScanSlotInfo();
slotInfo.setSlotId(slot.getId().asInt());
- boolean isFileSlot =
!getPathPartitionKeys().contains(slot.getColumn().getName());
- if (isIcebergRowIdColumn(slot)) {
- isFileSlot = false;
- }
- slotInfo.setIsFileSlot(isFileSlot);
Review Comment:
`initSchemaParams()` calls `setDefaultValueExprs(...)`, but this rebuild
throws away the inline `default_value_expr` that was already attached to each
`TFileScanSlotInfo`. `doFinalize()` then ships the mutated `params` via
`ThriftPlansBuilder.computeFileScanRangeParams()`, so BE no longer sees
defaults for external query scans.
That breaks schema evolution reads immediately: if an older external file is
missing a projected column with a catalog default,
`FileScanner::_init_expr_ctxes()` now sees no `default_value_expr` here and
fills NULL instead of the declared default. Please repopulate
`default_value_expr` after rebuilding `required_slots`, or rebuild the list in
a way that preserves the existing slot info objects.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]