Repository navigation
Conversation
which adds position-based subset column reading for formats such as `CSV`, `TSV`, `TabSeparatedRaw`, `Raw`, and `CustomSeparated`. File-like storages now pass a column mapping with the full input field order so unrequested fields can be skipped by the row parser instead of deserialized.
Use `SubsetOfColumnsByPositionSupportChecker` for the position-based subset column capability so the type name matches `subset_of_columns_by_position_support_checker`.
Add `checkIfFormatSupportsReadingSubsetOfColumns` to centralize the combination of normal subset column support and position-based subset column support. Keep direct `checkIfFormatSupportsSubsetOfColumnsByPosition` checks at call sites that need to build a positional `ColumnMapping`.
Register positional subset column support for `JSONCompactEachRow` and `JSONCompactStringsEachRow` so file-like reads can skip unrequested array positions.
Add a dynamic checker for by-position subset column support and use it so `CustomSeparated` enables the optimization only with `CSV` escaping, where skipped fields respect custom delimiters. Extend the selective-read stateless test to cover `TabSeparated`, `TabSeparatedRaw`, `TSVRaw`, `Raw`, `CustomSeparated`, and `CustomSeparatedIgnoreSpaces`, including the `Raw` escaping non-support path.
|
Workflow [PR], commit [b1a90a3] Summary: ❌
AI ReviewSummaryThis PR adds positional subset reads for file-like text formats by passing the full input field order into Missing context / blind spots
Tests
Final VerdictStatus: Minimum required action: add targeted before/after performance evidence for positional text-format subset reads. |
Rebuild pre-populated `ColumnMapping` from detected input headers so auto header detection works with projected format headers. Exclude hive path columns from file-like by-position mappings because they are not present in `File` and `URL` data files.
Create a fresh `ColumnMapping` when detected input headers need to rebuild positional mappings, so parallel parsers do not mutate shared mapping state. Reset row input parsers by replacing their `ColumnMapping` while preserving the `is_set` state.
# Conflicts: # src/Processors/Formats/Impl/CSVRowInputFormat.cpp
|
📊 Cloud Performance Report ✅ AI verdict: This PR adds positional subset-of-columns reading for text formats (CSV, TSV, JSONCompactEachRow, CustomSeparated) when reading from file, URL, and object-storage sources, plus the column-mapping plumbing to skip unrequested input fields. ClickBench Q4 (-12.1%) and Q15 (-17.5%) are MergeTree table scans that never exercise that parsing path, so both flagged improvements are downgraded to not-sure: the deltas are run-to-run variance, not a real effect of this change. No query that this PR could plausibly affect was measured, so there is no performance signal to act on here. clickbenchFlagged queries (2 of 43)
q-value = BH-FDR adjusted p; smaller is stronger evidence. MIRAI flags a query when q < fdr_q (default 0.10) — the value the verdict is based on. tpch_adapted_1_official🟢 No significant changes Debug info
|
Keep `ReadFromFormatInfo` serialization byte-compatible by not serializing derived `ColumnMapping` state. Rebuild header mappings through the same case-aware logic as `ColumnMapping::addColumns`, while still skipping known but unrequested input fields for position-based reads. Add coverage for case-insensitive `CSVWithNames` header matching and unknown `CSV` header rejection.
Register the by-position subset checker for `WithNames` and `WithNamesAndTypes` variants created by `registerWithNamesAndTypes`. Keep `CustomSeparated` variants gated by `format_custom_escaping_rule = 'CSV'`. Extend coverage for explicit header formats under `input_format_skip_unknown_fields = 0`.
Mirror the `StorageObjectStorageQueue::streamToViews` path when preparing direct `SELECT` reads. This keeps hive partition columns out of the on-file positional mapping while still materializing them from the file path.
Do not use by-position-only subset support for `file` table function structure hints. The full inferred file structure is still needed to build positional `ColumnMapping` for formats such as `CSV`. Add coverage for `use_structure_from_insertion_table_in_table_functions = 2` with `CSV`.
Do not use by-position-only subset support for object-storage table function structure hints. The full inferred object structure is still needed to build positional `ColumnMapping` for formats such as `CSV`.
…ueue A direct SELECT from an S3Queue/AzureQueue table with use_hive_partitioning = 1 called prepareReadingFromFormat without PrepareReadingFromFormatHiveParams, so the Hive columns were treated as file columns: the format returned the file's value or the column default, and ObjectStorageQueueSource never appended the value from the path. streamToViews already passes these parameters, which is why a materialized view over the same table was correct. Pass the same parameters in StorageObjectStorageQueue::read. A table without Hive columns has empty file_columns and an empty map, which prepareReadingFromFormat treats like the previous default call. The same call change is part of the open ClickHouse#105774, where positional reads need it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Enable file-like storages to read only requested columns for positional row formats such as
CSV,TSV,Raw,CustomSeparated,JSONCompactEachRow, and related aliases.The change passes a
ColumnMappingwith the full input field order into input formats, so parsers can skip unrequested fields by position instead of deserializing them. This avoids parsing unused columns and allows queries likeSELECT c2to succeed even when an unrequestedc1contains data that would not parse as the declared type.CustomSeparatedenables this optimization only forCSVescaping, where skipped fields respect custom field and row delimiters.This PR closes #62356
Changelog category (leave one):
Changelog entry:
CSV,TSV,Raw,CustomSeparated, andJSONCompactEachRowby skipping unrequested fields instead of deserializing them.