ViktorBystrov72 opened a new pull request, #60607:
URL: https://github.com/apache/spark/pull/60607

   ### What changes were proposed in this pull request?
   
   Match timestamp fields by name, using the reader's case-sensitivity setting, 
in `OrcUtils.requestedColumnIds` compatibility validation. Keep positional 
matching for forced positional evolution and old Hive schemas with anonymous 
root fields.
   
   Add coverage for pruned structs, array elements, and map values, both 
timestamp families, row/vectorized readers, V1/V2, genuine family mismatches, 
case-sensitive missing fields, and positional/anonymous schemas.
   
   ### Why are the changes needed?
   
   [SPARK-60792](https://issues.apache.org/jira/browse/SPARK-60792): selecting 
a TIMESTAMP_NTZ field after a TIMESTAMP sibling in an array can fail with 
`UNSUPPORTED_FEATURE.ORC_TYPE_CAST` in the V1 reader when nested schema pruning 
removes the sibling.
   
   The compatibility check zips physical and requested struct fields by 
position even when ORC reads them by name. It validates the selected field 
against the removed sibling. Conversely, it can miss a genuine timestamp-family 
mismatch when that sibling happens to match the requested type. Matching the 
corresponding fields fixes both validation errors.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. On current master, valid reads of pruned nested timestamp fields can 
fail with an ORC type-cast error. They now return the selected value. 
Timestamp-family compatibility is checked against the source field that ORC 
reads.
   
   ### How was this patch tested?
   
   Before the fix, 24 of the initial 36 regression cases failed; the 12 V2 read 
controls passed. After the fix, all 38 focused cases passed, including the 
additional field-resolution checks.
   
   All 696 tests in the scoped ORC source/pruning suites passed (2 ignored), 
followed by 20 timestamp-focused query tests. SQL production/test ScalaStyle 
passed.
   
   Scoped validation commands:
   
   ```text
   sql/testOnly *OrcSourceV1Suite *OrcSourceV2Suite -- -z SPARK-60792
   sql/testOnly *OrcSourceV1Suite *OrcSourceV2Suite *OrcV1SchemaPruningSuite 
*OrcV2SchemaPruningSuite
   sql/testOnly *OrcV1QuerySuite *OrcV2QuerySuite -- -z timestamp
   sql/Compile/scalastyle
   sql/Test/scalastyle
   ```
   
   Apache RAT also passed with the repository exclusion file plus `.git` (the 
local worktree metadata file). No source files were additionally excluded.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: OpenAI Codex (gpt-6.1-sol; exact tool build unavailable).
   


-- 
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]

Reply via email to