Repository navigation
Conversation
…re not in the file Parquet stores the sizes of arrays (repetition/definition levels) only in leaf columns, and SchemaConverter requested a leaf only for requested elements that exist in the file. When none did, nothing under the array was read: a whole column like `l Array(Tuple(d ...))` got zero offsets in formOutputColumn, and a flattened subcolumn like `l.d` matched no schema element and was filled as a top-level missing column. Both read as `[]` for every row, so ARRAY JOIN and filters on the size lost rows, and inserting the subcolumns into a Nested column failed with SIZES_OF_ARRAYS_DONT_MATCH. Iceberg reaches this when a data file is read under a schema whose list element struct gained or replaced fields. SchemaConverter::addLevelsOnlyPrimitive now adds one leaf under such an array, read only for its levels: before the REPEATED node's make_array and before the `arr.elem` wrap arrays when the output has no leaf, and, for `arr.missing` columns that match no schema element, after the traversal from the recorded tuples inside arrays (not a Map's key_value tuple: `keys` and `values` name the subcolumns of a Map). It picks the cheapest leaf: one not read for another column, without arrays of its own, of fixed width. If the subtree has leaves but none can be decoded, the error is raised as for a requested leaf, unless input_format_parquet_skip_columns_with_unsupported_types_in_schema_inference. The leaf has no output. Its values and the offsets of arrays below it are dropped right after decoding, because a row subgroup keeps its columns until the end of the read. PrimitiveColumnInfo::levels_only_arrays is part of the columns cache identity, so such a column is never served the entry of a column that reads the same leaf as values. 03548_parquet_missing_tuple_elements pinned the empty arrays: its two such expectations change, and it is extended with ARRAY JOIN, WHERE, PREWHERE, nested arrays and tuples inside the element. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…as missing A requested column like `x.z` that matches no schema element used to be an is_missing_column output, and formOutputColumn set its bits in the block missing values, so AddingDefaultsTransform applied an explicit DEFAULT of it. addMissingElementsOfTuplesInArrays now builds it as an array output sized by a leaf of the file, so it lost those bits and its DEFAULT was replaced by type defaults. OutputColumnInfo::report_as_missing restores the report for that output. Such a column is not served from the columns cache either: a cached column gets no missing values, so it would lose the DEFAULT on a cache hit. 03548_parquet_missing_tuple_elements checks a DEFAULT of such a column. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Drop two comments that narrate the new code in addLevelsOnlyPrimitive and shorten the report_as_missing doc to one line. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review (2 rounds): 1 issue fixed, 1 out of scope, 2 notes
|
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-self-slot-57:20261109-042300 |
|
Workflow [PR], commit [332bd9e] Summary: ❌
AI ReviewSummaryThis PR shares requested-type conversion across the columnar readers, defaults Missing context / blind spots
Findings❌ Blockers — previously reported; accepted as a tracked follow-up
Final VerdictStatus: ✅ Approve No additional changes required for this PR under the accepted follow-up policy. Existing threads were left unchanged because the tracked issues still hold in the current code; no duplicate inline findings were posted. |
|
cc @al13n321 @scanhex12, could you review this and add the |
Build profile diff (arm_release)Commit See the job log for details. |
A tuple inside an array was recorded for addMissingElementsOfTuplesInArrays under its physical name even when it, or an ancestor, has a field id that the column mapper does not know (a column dropped from the Iceberg schema). After `x` is dropped and added again with new field ids, an old data file still has the old `x`, so a request for `x.new` took the sizes of the old list and read `[NULL]` instead of `[]`, and `ARRAY JOIN x.new` produced rows. The traversal now carries TraversalNode::not_in_datalake_schema down from such an element, and those tuples are not recorded. A leaf read only for the array sizes can have NULL values while its type cannot be Nullable (`Geometry`, which addLevelsOnlyPrimitive infers for a `GEOMETRY` leaf, is a Variant). With input_format_null_as_default = 0, decodePrimitiveColumn rejected them before the values were dropped, so a valid array of requested missing elements failed with CANNOT_INSERT_NULL_IN_ORDINARY_COLUMN. The check is skipped for such a leaf, as nothing reads its values. With input_format_parquet_case_insensitive_column_matching, a column like `x.z` can match two recorded tuples (`X` and `x`), and the sizes were taken from the first one. The same file read as `x.a` or `x` fails with DUPLICATE_COLUMN, and now `x.z` fails with it too, whichever of them is checked first. addLevelsOnlyPrimitive preferred a leaf not read for another column over a fixed-width one, so with `x.id` requested beside a missing `x.z` it decoded a long string `x.payload` only to drop it (1,000,164 decompressed bytes instead of 204 in the test). Variable width now costs the most and being read for another column the least, so the already read `x.id` is used. 03548_parquet_missing_tuple_elements covers each case: a `GEOMETRY` leaf with a NULL, an Iceberg list replaced with a new list of the same name (read as a whole, as `x.new` and with ARRAY JOIN), arrays named `X` and `x`, and the decompressed bytes of the string case. It also reads one Iceberg file under two schemas with the columns cache, where the same leaf is a requested element in one and only gives the sizes in the other: without levels_only_arrays in the cache identity, the second read returns the values of the first. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…sizes-of-missing-elements Resolve the include conflict in SchemaConverter.cpp and use the -WithMemoryTracking containers that master now requires in src/Processors/Formats for the containers this PR adds. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🕵 A note on how the readers should be unified later, from fixing the same shape for ORC in #130279 (kept ORC-local there because it needs a backport). The Arrow reader (the by-name block in the struct read of Suggested unification:
|
|
Two things I measured on master (
This PR keeps the existing Parquet fill for the elements it adds. If you want, I can do the unification as a follow-up PR once #130279 and this one are merged. |
…none of the requested fields) The unification of the by-name rule for named tuples across the format readers deletes matchORCTupleElementsByName, which exists only in ClickHouse#130279, so this PR builds on it until it merges. Requested in ClickHouse#130279 (comment) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…readers The Arrow, ORC and Parquet readers each realigned a requested named tuple to the read one by name, because CAST converts named tuples without common element names positionally and insertNullAsDefaultIfNeeded pairs tuple elements by position. The copies chose different defaults for a missing element: the first value of an Enum in Arrow, the invalid value 0 in the others and in CAST. CAST gets an internal flag (not a user setting, part of updateHash) that matches named tuples by name also when they have no element name in common, used by castColumnToRequestedType and the reader casts through castColumnMatchingTupleElementsByName. insertNullAsDefaultIfNeeded gets the same flag to pair named tuple elements by name. A missing element or column is filled with the default of its type (insertManyDefaultsInto) in CAST and in every reader. The legacy Arrow by-name block and the ORC matchORCTupleElementsByName are deleted; ArrowIPC keeps only the recursion into requested elements. Requested in ClickHouse#130279 (comment) Design note: ClickHouse#130259 (comment) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…bulk ORC lost case-insensitive matching on the extracted-subcolumn path once its own by-name realignment was removed: `c0.up Tuple(b UInt32)` over a file `UP Tuple(B UInt32)` read `(0)` instead of `(70)` (04401), because the subcolumn hint never reaches `UP` and the exact by-name cast then filled `b`. ArrowIPC's alignStructFieldNamesCaseInsensitive moves to src/Formats/castColumnToRequestedType and ORC calls it at the same point as ArrowIPC: after the read, before null-as-default and the cast. Its named tuple branch now uses the exact-first rule of the ORC struct read: an element spelled exactly keeps its name, and a requested element is taken by at most one case-folded element. The previous first-occurrence lookup renamed both fields of `c0 Tuple(A ..., a ...)` to the same name, so ArrowIPC failed with "Names of tuple elements must be unique", where ORC reads the struct. createColumnWithDefaults (DataTypes/Utils) replaces the per-row insertManyDefaultsInto at the five default-fill sites (CAST, Parquet, legacy Arrow, ArrowIPC, ORC): a bulk cloneResized when the type's default insert is trivial, as before, else one default row replicated with insertManyFrom. Requested in ClickHouse#130279 (comment) Co-Authored-By: Claude Opus 5.5 <[email protected]>
One template over Parquet, ORC, Arrow and Vortex with the same expected blocks: requested named tuples with none, some or all elements in the file (top level, arrays, map values and keys, Nested), a missing Enum element and column read as the first Enum value, NULL-as-default paired by name, case-insensitive column and element names, and, for ORC and Arrow, fields whose names differ only by case. Then CAST and ALTER MODIFY COLUMN of a tuple that gains an Enum element. Parquet is left out of the `input_format_null_as_default = 0` map key query: it does not read the null map of a nullable struct none of whose requested fields is in the file. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Shorten the positional-descent comment in alignStructFieldNamesCaseInsensitive; createColumnWithDefaults: an Enum's default is its smallest value. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review of the repurposed PR (1 round): 2 out of scope, 1 note
|
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-7:20261110-200400 |
addLevelsOnlyPrimitive set up the leaf with processPrimitiveColumn, so its values went through the conversion of the leaf's logical type before they were dropped. That conversion rejects valid values: an INT96 timestamp after 2262-04-11 does not fit DateTime64(9) (Int96Converter throws VALUE_IS_OUT_OF_RANGE_OF_DATA_TYPE), and a DATE outside the Date32 range is rejected by the date range check. A list whose struct has only such a leaf, read as `x Array(Tuple(q Int32))` or as `x.q Array(Int32)`, failed with code 321 although none of those values is requested. The leaf now decodes its physical values only: FixedString of the physical width for INT32, INT64, INT96, FLOAT, DOUBLE and FIXED_LEN_BYTE_ARRAY, String for BYTE_ARRAY and UInt8 for BOOLEAN, the same trivial converters as the FixedString escape hatch of processPrimitiveColumn. Such a type is always Nullable outside an array, so the NULL check exemption for this leaf in decodePrimitiveColumn is not needed any more and is removed. A NULL GEOMETRY leaf is now read as a String. Checked locally for every physical type with PLAIN, dictionary, RLE, DELTA_BINARY_PACKED, DELTA_LENGTH_BYTE_ARRAY, DELTA_BYTE_ARRAY, BYTE_STREAM_SPLIT and ALP pages, three row groups and 512-byte pages: the sizes of all 3000 lists match the file in each case. 03548 gets the INT96 and DATE cases. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A field of the Iceberg schema that no field of the file has by field id is absent, even if fields of the file have its name. With case-insensitive matching, a field `Ab` added next to the file's fields `AB` and `ab` was still matched by name, so its reads failed with AMBIGUOUS_COLUMN_NAME (and read `AB`'s values on master): - prepareFileReader checks the namesakes of an absent column without throwing, an ambiguous name counts as one: the column is not selected and the filter push-down is disabled; - orcColumnsToCHChunk does not look up an absent column by its own name, only as an element of its parent; - the struct reader gives an absent element its type's default when it has no `initial-default`, instead of leaving it to the cast to the requested type, which pairs elements by name. This also keeps the sizes of a list for an added element of its struct: `l.Ab` read `[]` instead of `[NULL]`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
computeOrcUnionBranchHints tests every union branch against every alternative of the requested Variant. Since a name that matches several struct fields only case-insensitively throws AMBIGUOUS_COLUMN_NAME, such a test against an unrelated alternative made a valid file unreadable: union<struct<AB int, ab int>, struct<Ab string>> read as Variant(Tuple(AB Int32, ab Int32), Tuple(Ab String)) with input_format_orc_case_insensitive_column_matching = 1 failed, also with schema inference, although every field it reads has an exact match. The test now treats such a name as no match (matchElementsByName and matchORCStructFieldsByName report it through `ambiguous`, as traverseDownORCTypeByName does). A branch that no alternative fits and that met an ambiguous name still fails with AMBIGUOUS_COLUMN_NAME, as a struct read does, instead of the later Variant conversion error. Reported by the AI review: ClickHouse#130259 (comment) Co-Authored-By: Claude Opus 5.5 <[email protected]>
The branch is in conflict with master. Conflicts in the ArrowIPC reader only: master (ClickHouse#132416) keys the dictionary uses and the registry by position and requested hint (`DictionaryUse::operator==`, `DictionaryRegistry::useKey`, `dictionaryUse`), as this branch did with `DictionaryUse::key`; master's code is kept and the branch's copy dropped. Master's `below_union` position (ClickHouse#132550) is kept with this branch's exact-name hint lookup (`resolveHint` with case-insensitive matching), the per-struct `structFieldHints` and the top-level field name as the starting path. Co-Authored-By: Claude Opus 5.5 <[email protected]>
| bool ambiguous = false; | ||
| for (size_t a = 0; a < alternatives.size(); ++a) | ||
| if (orcUnionBranchMatchesType(orc_type->getSubtype(i), alternatives[a], case_insensitive_matching)) | ||
| if (orcUnionBranchMatchesType(orc_type->getSubtype(i), alternatives[a], case_insensitive_matching, &ambiguous)) |
There was a problem hiding this comment.
[Major] Keep the original ORC union binding across field pruning
The candidates computed here depend on which struct fields are present. updateIncludeTypeIds computes them against the complete file schema, then readColumnFromORCColumn recomputes them against getSelectedType. Removing an unrequested field can change ambiguity and invalidate the previously selected branch hint.
Reproduced with the PR-head binary:
SET allow_suspicious_variant_types = 1;
INSERT INTO FUNCTION file('union_projection.orc', ORC)
SELECT CAST(CAST((11, 'x'), 'Tuple(AB Int32, ab String)'),
'Variant(Tuple(AB Int32, ab String), Tuple(Ab Int64))') AS v;
SELECT v FROM file('union_projection.orc', ORC,
'v Variant(Tuple(AB Int64), Tuple(Ab Int64))')
SETTINGS input_format_orc_case_insensitive_column_matching = 1;Expected: (11), as with case-insensitive matching disabled. Actual: CANNOT_CONVERT_TYPE from Variant(Tuple(AB Int32), Tuple(Ab Int64)). Initially the first branch matches only Tuple(AB Int64): Ab is ambiguous against AB/ab. Pruning removes ab, after which both alternatives match both branches; their hints disappear and the required Int32 widening never runs. Keeping the original tuple's two fields in the request also succeeds.
Retain the binding derived from the original schema through decoding, keyed by the original ORC column identity, and cover projection plus widening. This also fails on base bc6d347; a linked follow-up issue is an alternative under the maintainer's stated policy for pre-existing bugs. I found no existing tracking issue.
…ype conversion With `input_format_orc_dictionary_as_low_cardinality = 1` (the default), the dictionary decoding picked the column's nullability from the requested type, so for a non-Nullable request a NULL row became the empty string before the shared conversion ran. Reading the same file with dictionary encoding then behaved differently from reading it without: - `e Int32` failed with ATTEMPT_TO_READ_AFTER_EOF parsing '' (expected 0), - `e String DEFAULT 'fallback'` returned '' for NULL (expected 'fallback'), - `e String` with `input_format_null_as_default = 0` accepted NULL as '' (expected CANNOT_INSERT_NULL_IN_ORDINARY_COLUMN), - an `Enum8` request failed with UNKNOWN_ELEMENT_OF_ENUM. The same happened on master. Now a batch with NULLs is decoded as `LowCardinality(Nullable(...))`, and `castColumnToRequestedType` gives the NULL rows the requested type's default, sets their missing-value bits, or rejects them, as it does for every other column. This applies to STRING, VARCHAR and CHAR, at the top level and inside tuples, arrays and maps; a batch without NULLs is decoded as before. Cost: a batch with NULLs requested as non-Nullable `String` or `LowCardinality(String)` now pays the per-row default fill of `ColumnLowCardinality::cloneWithDefaultOnNull`, the cost Arrow dictionaries with NULLs already pay on master. Debug build, 10M rows, 10% NULLs, 1000 distinct values, max_threads = 1: ORC 0.10-0.30 s -> 0.8-1.5 s, Arrow 0.7-1.7 s on master and with this change. Reported by clickhouse-gh in ClickHouse#130259 (comment) Co-Authored-By: Claude Opus 5.5 <[email protected]>
With case-insensitive matching, the push-down looked the predicate column up in the header with `Block::findByName(name, true)`, which returns the first column whose name matches case-folded, and since this PR it resolves the file field through that header column's name. With both `AB` and `ab` requested, a predicate on `ab` read the statistics of `AB` and dropped a matching stripe: - `SELECT AB, ab ... WHERE ab = 22` and `SELECT ab, AB ... WHERE AB = 11` returned no rows instead of `11, 22` with input_format_orc_filter_push_down = 1, - the same for tuple roots `T` and `t` (`WHERE t.a = 22` read `T.a`). Master was not affected: it resolved the file field from the predicate name. Now the header column is found as the fields of a struct are: the one with the same name, else the only one whose name differs only by case (no push-down when several do). `05618` covers both requested orders and the tuple roots, and asserts that the push-down still prunes the stripe for them (read_rows 0). Reported by clickhouse-gh in ClickHouse#130259 (comment) Co-Authored-By: Claude Opus 5.5 <[email protected]>
CI finish ledger - 3761c4bEvery failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
Session id: cron:our-pr-ci-monitor:20261119-130022 |
With input_format_arrow_case_insensitive_column_matching, a decoded field whose path no requested name spells took the type of the only requested name that differed from the whole path only by case. That ignored which field the reader actually extracts for the name, so: - with roots `S` and `s` and the requests `S.a`, `s.A`, the field `s.a` matched both names and got no hint (a date32 of 3000000 read as Int32 became 2932896, and a value outside the DateTime range no longer threw, unlike the whole tuple); - an unrequested case variant of a requested field took its hint (`c1.A` alone from `Tuple(A Date32, a Date32)`, or `A` next to a top-level `a`), so its own value could fail the hint's range check. bindRequestedTypes now keys the requested types by the field each column reads, resolved like buildChunk extracts it (the whole name as a top-level field, else the first component as a top-level field and the rest below it, each spelled exactly, else the only case-insensitive match). The decoder looks hints up exactly again, as on master. A field read by several case variants still gets no hint. Found by the AI review of ClickHouse#130259 (r4630484011). Co-Authored-By: Claude Opus 5.5 <[email protected]>
| if (const auto [table, rest] = Nested::splitName(std::string_view(column.name)); !path && !rest.empty()) | ||
| if (const auto root = find(top_level_fields, "", table)) | ||
| path = find(nested_fields, *root + ".", rest); | ||
| if (path && !types.contains(*path)) |
There was a problem hiding this comment.
[Major] A field that serves two case-insensitive requests still gets only one decode hint
bindRequestedTypes drops the folded binding when the resolved physical path already exists in types. With a file that contains only A Date32, the header a Int32, A DateTime resolves both requests to physical A. The exact A request keeps the DateTime hint, while a contributes nothing here, so the field is decoded once through DateTime's range checks and both result columns reuse that decoded data. The later cast cannot recover a's own Int32 semantics after clamping or raw-byte reinterpretation has already happened.
Please either carry per-request uses through decoding (for example by distinguishing (physical field, requested type) the way the shared-dictionary fix distinguishes dictionary uses), or link the follow-up issue if you want to defer this pre-existing wrong-result case.
| ColumnWithTypeAndName column; | ||
| auto orc_column_it = find_orc_column(header_column.name); | ||
| /// A column absent by field id is not read from a field that has its name, only as an element of its parent. | ||
| auto orc_column_it = absent_columns.contains(header_column.name) ? name_to_column_ptr.end() : find_orc_column(header_column.name); |
There was a problem hiding this comment.
[Major] Top-level Iceberg renames still materialize as missing columns
The new Iceberg-aware selection path resolves a renamed top-level field by field id in prepareFileReader, but orcColumnsToCHChunk still materializes top-level columns only by header_column.name here. If the current schema renames top-level old (field id 1) to new, an ORC file that still stores old with field id 1 is selected earlier via resolveORCFieldByIcebergId, then dropped here because name_to_column_ptr only has old; new falls through to the missing-column path and gets defaults.
Please carry the resolved top-level file field (or its field id) into materialization instead of re-resolving by name only, or link the follow-up issue if this pre-existing Iceberg rename bug is being deferred.
| { | ||
| return {target_copy.size() == field_name.size() ? "" : target_.substr(field_name.size() + 1), type_->getSubtype(i)}; | ||
| if (!fold) | ||
| return {target_copy.size() == field_name.size() ? "" : target_.substr(field_name.size() + 1), type_->getSubtype(i)}; |
There was a problem hiding this comment.
[Blocker] Resolve a complete dotted field name before accepting a path prefix
The exact pass returns the first matching prefix, so a physical field named a.x loses to an earlier struct named a. prepareFileReader then selects the struct's child and prunes the actual top-level a.x; materialization takes the nested value instead. This silently reads another field even with case-insensitive matching disabled.
Reproduced with the PR-head binary:
INSERT INTO FUNCTION file('dotted.orc', ORC)
SELECT tuple(11)::Tuple(x Int32) AS a, toInt32(22) AS `a.x`;
SELECT * FROM file('dotted.orc', ORC, '`a.x` Int32');
-- Actual: 11. Expected: 22.Requesting both a Tuple(x Int32) and the literal a.x Int32 also returns (11), 11. Please give a complete field-name match precedence over descent through a shorter prefix, consistently for selection and predicate binding, and cover both file orders. The same prefix selection is present in base 0e212e6ce6fd; under the maintainer's follow-up policy, linking a tracking issue is an alternative to extending this PR. I found no existing issue for this case.
There was a problem hiding this comment.
Same on master ec475edd5e3d (a.x reads 11, and 0 when a has no field x), so following the follow-up policy I opened #133146 for it instead of extending this PR.
|
Fixing PR for the |
|
@groeneai Please fix conflicts |
|
Working on it: I'm merging master and resolving the conflicts now, and will push once it builds and the affected tests pass. |
…sizes-of-missing-elements Conflicts: - `ArrowIPCBlockInputFormat.cpp`: master made `buildChunk` the free function `ArrowIPC::buildChunk` (also used by `Vortex`) with an `allow_missing_columns` argument; kept this branch's body (`createMissingColumn` with that argument, `castColumnToRequestedType`, `reinterpretRawByteColumnsImpl`). - `RecordBatchDecoder.h`: master's per-batch node state (`setBatchNodes`) with this branch's comment. - `FunctionsConversion.cpp`: includes of both sides. Also: master's nested-conversion copy constructor of `FunctionConvertSettings` copies `tuple_elements_matching` from its base, as it copies the other settings it does not override. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This branch made the Arrow IPC decoder look requested types up by the exact field path, keyed by `RecordBatchDecoder::bindRequestedTypes`. `Vortex`, which master moved onto the same decoder, still keyed them by the lower-cased header name, and master's `decodeExternalBatch` seeded the lower-cased field name, so with `input_format_arrow_case_insensitive_column_matching = 1` a subcolumn of a struct lost its hint: `S.A DateTime` from a `Date32` of 2200-01-01 returned 2106-02-06 instead of the `VALUE_IS_OUT_OF_RANGE_OF_DATA_TYPE` that master and the whole-tuple read give. Both now follow the Arrow reader; a line in 05618 covers it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Done: merged master in 6a8f934 (conflicts in One semantic conflict needed a separate commit, 332bd9e: |
Related: #130279
Related: #131125
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
With
input_format_null_as_default, aNULLread from Parquet, ORC, Arrow, Native or Vortex as a non-Nullablecolumn of another type gets the default of the requested type:Nullable(String)read asInt32failed withCannot parse Int32 from String, andNullable(Int8)read as anEnumwithout 0 stored the invalid value 0. ATupleelement or column the file lacks gets the default of its type, and ORC, Arrow and Vortex match namedTupleelements by name with one rule. With case-insensitive matching, a name that matches several fields only by case fails withAMBIGUOUS_COLUMN_NAMEin ORC and Arrow instead of reading one of them.Description
On 26.10.2.103, a
NULLofNullable(Int8)read from Parquet or ORC asEnum8('a' = 1, 'b' = 2)returns the invalid value 0, and aNULLofNullable(String)read asInt32fails withCannot parse Int32 from String.Every columnar reader cast the zero of the file's type stored in a
NULLrow.castColumnToRequestedTypenow has one rule: the value of aNULLrow is never converted, the row gets the default of the requested type. NativeReader and Parquet's leaf cast call it; every columnar reader shares it, ORC dictionary strings included; Parquet pruning assumes the same value. NativeReader keepsCAST's positional pairing of named tuples with no common name (#70830). ORC pairs struct fields, union branches, hints and pushed-down predicates withDataTypeTuple::matchElementsByName, as the cast does. The tuple-onlyNULLshortcut andinsertNullAsDefaultIfNeededare deleted.src: 28 files +982/-1068 vs master.
Case-insensitive matching (#130259 (comment)): a name binds to the field spelled the same, else to the only one differing by case, else fails with
AMBIGUOUS_COLUMN_NAME, for tuples, subcolumns and columns. ArrowIPC and Vortex bind each hint to the field the name reads, so`s.a` Int32, `s.A` DateTimefromTuple(A Date32, a Date32)no longer returns49709fors.a. ORC pairs Iceberg struct fields by field id first; a field absent by id reads as its default next to namesakes.Native without conversion rejects a tuple of another size (
TYPE_MISMATCH, wasLOGICAL_ERROR).Not changed:
CASTof aNullable(Tuple)still converts the elements underNULLrows.Validation:
05618reads the same files in all five formats; its new lines fail on master, except the Native positional guard. Debug, 10M rows: ORCNullable(Int64)asInt320.13 s to 0.21 s; ORC dictionary strings withNULLs asString0.1-0.5 s to 0.8-1.5 s, as Arrow on master; others the same or faster.Workflow [PR]
Sync PR [sync-upstream/pr/130259]