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

   ### What changes were proposed in this pull request?
   
   Check timestamp filter bounds against the precision stored in the Parquet 
column. A `TIMESTAMP_MILLIS` column requires millisecond precision; a 
`TIMESTAMP_MICROS` column requires microsecond precision. Comparisons with 
finer bounds remain Spark residual filters. Add filter-construction and reader 
regressions, plus a migration note.
   
   ### Why are the changes needed?
   
   [SPARK-61738](https://issues.apache.org/jira/browse/SPARK-61738) reports 
missing rows when a microsecond literal is pushed into a millisecond Parquet 
column. The conversion truncates the bound, allowing Parquet to discard a row 
group that contains matching rows. The existing representability check treats 
both column types as microsecond columns.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. For a millisecond Parquet file containing `1900-01-01 00:00:00`, the 
predicate `ts < TIMESTAMP '1900-01-01 00:00:00.000001'` now returns that row. 
Filters such as `<>` and `NOT IN` also retain matching rows when their literals 
have finer precision than the file.
   
   ### How was this patch tested?
   
   All 10 new regressions fail on the original production code and pass with 
the fix.
   
   - `sql/testOnly *ParquetV1FilterSuite *ParquetV2FilterSuite -- -z 
SPARK-61738`: 10 tests passed. Covers both Java datetime representations, dates 
before and after the epoch, both IN pushdown paths, representable-bound 
controls, V1/V2, vectorized/row readers, and pushdown enabled/disabled.
   - `sql/testOnly *ParquetV1FilterSuite *ParquetV2FilterSuite -- -z 
timestamp`: 12 tests passed, including existing millisecond, microsecond, 
nanosecond, and rebasing coverage.
   - `sql/Compile/scalastyle` and `sql/Test/scalastyle`: passed.
   - Apache RAT: passed using the repository exclusions plus the `.git` 
worktree metadata file.
   
   The suites emitted possible-daemon-thread-leak warnings in both baseline and 
patched runs; the patched checks exited successfully.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: OpenAI Codex (GPT-6; exact tool build unavailable). Codex 
assisted with the implementation, regression tests, migration note, and this 
description.
   


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