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

   
   
   ### What changes were proposed in this pull request?
   
    Let a nanosecond timestamp type read a Parquet INT64 TIMESTAMP(MICROS) 
column, promoting each micros value to the internal (epochMicros, 
nanosWithinMicro = 0) representation. Three touch points:
    - Row-based: the extended newConverter now accepts a TIMESTAMP(MICROS) 
column (LTZ applies the Julian→Gregorian rebase; NTZ needs none).
    - Vectorized: new MicrosAsTimestampNanos(Rebase)Updater updaters, 
dispatched for a nanos type over a MICROS file.
    - Filter pushdown: only push down a micros/millis timestamp bound that lies 
exactly on the microsecond grid, so a sub-µs bound never over-prunes row groups.
   
   Scope: INT64 TIMESTAMP(MICROS) only; INT96 and TIMESTAMP_MILLIS sources 
remain unsupported.
   
   ### Why are the changes needed?
   It's the read side of widening a microsecond timestamp column (TIMESTAMP(6)) 
to nanosecond precision without rewriting existing files. Today the nanos 
reader fails loudly on any non-TIMESTAMP(NANOS) column, so old micros files 
would be unreadable after such a widening. The promotion is exact and 
range-complete - micros to (micros, 0) involves no ×1000 encode, so it avoids 
the INT64 epoch-nanos overflow range (~1677–2262).
   
   
   ### Does this PR introduce _any_ user-facing change?
   Yes, behind the preview flag spark.sql.timestampNanosTypes.enabled. 
Previously, reading a TIMESTAMP(MICROS) Parquet column under a nanosecond 
timestamp type threw (SchemaColumnConvertNotSupportedException / 
PARQUET_CONVERSION_FAILURE); now it reads the values correctly.
   
   
   ### How was this patch tested?
   Added TimestampNanosParquetOpsSuite and updated ParquetTypeWideningSuite 
ParquetFilterSuite.
   
   
   ### Was this patch authored or co-authored using generative AI tooling?
   Co-authored-by: Claude Opus 4.8
   


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