| 63 | } |
| 64 | |
| 65 | void FileMetadataUtils::PopulateIcebergDefaults(Tuple* template_tuple, MemPool* pool) { |
| 66 | DCHECK(scan_node_->hdfs_table()->IsIcebergTable()); |
| 67 | if (template_tuple == nullptr) return; |
| 68 | |
| 69 | TextConverter text_converter = CreateTextConverter(); |
| 70 | |
| 71 | for (int i = 0; i < scan_node_->tuple_desc()->slots().size(); ++i) { |
| 72 | const SlotDescriptor* slot_desc = scan_node_->tuple_desc()->slots()[i]; |
| 73 | |
| 74 | // Skip if not a top-level column (complex types not supported for defaults) |
| 75 | if (slot_desc->col_path().size() != 1) continue; |
| 76 | |
| 77 | int col_idx = slot_desc->col_path()[0]; |
| 78 | DCHECK_LT(col_idx, scan_node_->hdfs_table()->col_descs().size()); |
| 79 | const ColumnDescriptor& col_desc = scan_node_->hdfs_table()->col_descs()[col_idx]; |
| 80 | |
| 81 | if (col_desc.initial_default().empty()) continue; |
| 82 | |
| 83 | // Don't overwrite partition columns |
| 84 | if (IsValuePartitionCol(slot_desc)) continue; |
| 85 | |
| 86 | if (!text_converter.WriteSlot(slot_desc, template_tuple, |
| 87 | col_desc.initial_default().c_str(), |
| 88 | col_desc.initial_default().size(), |
| 89 | /* copy_string = */ true, /* need_escape = */ false, |
| 90 | pool)) { |
| 91 | ErrorMsg error_msg(TErrorCode::GENERAL, |
| 92 | Substitute("Could not parse Iceberg initial-default value for " |
| 93 | "column '$0' in file '$1'. Default string is '$2'", |
| 94 | col_desc.name(), file_desc_->filename, col_desc.initial_default())); |
| 95 | state_->LogError(error_msg); |
| 96 | continue; |
| 97 | } |
| 98 | template_tuple->SetNotNull(slot_desc->null_indicator_offset()); |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | void FileMetadataUtils::AddFileLevelVirtualColumns(MemPool* mem_pool, |
| 103 | Tuple* template_tuple) { |
nothing calls this directly
no test coverage detected