Native Parquet write falls back on int96RebaseModeInWrite=LEGACY even when timestamps are not written as INT96

Aperta Adatta ai principianti
#7,463 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
62/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
rust, scala, spark

Direzione di ricerca

Il fallback si trova in NativeWriteUtils.legacyDatetimeRebaseWriteReason; inizia da lì e leggi come controlla int96RebaseModeInWrite prima di verificare il tipo di timestamp di output. Aggiungi una condizione in modo che il controllo INT96 si applichi solo quando spark.sql.parquet.outputTimestampType è INT96, poi aggiungi un test di regressione con TIMESTAMP_MICROS e int96RebaseModeInWrite=LEGACY che verifichi che la scrittura resti nativa. È completato quando quel test passa e il paragrafo in docs/source/user-guide/latest/parquet.md è aggiornato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area:writer enhancement requires-triage
What is the problem the feature request solves?

Found in review of #7053. The native Parquet writer fallback added there, NativeWriteUtils.legacyDatetimeRebaseWriteReason, treats spark.sql.parquet.int96RebaseModeInWrite=LEGACY as a reason to fall back whenever the output has a timestamp column. That setting only governs the INT96 encoding. When spark.sql.parquet.outputTimestampType is TIMESTAMP_MICROS or TIMESTAMP_MILLIS, Spark writes INT64 and uses datetimeRebaseModeInWrite instead, so the INT96 setting has no effect on the output.

Reproduction: a timestamp column, outputTimestampType=TIMESTAMP_MICROS, datetimeRebaseModeInWrite=CORRECTED. Changing only int96RebaseModeInWrite from CORRECTED to LEGACY makes the helper return a fallback reason instead of None. Spark writes the same INT64 TIMESTAMP(MICROS) either way (for 1500-01-01 12:34:56.123456 both files contain -14831724303876544).

The fallback is safe, but an unrelated legacy INT96 setting disables native write acceleration for a write the native writer handles correctly.

Describe the potential solution

Only apply the INT96 condition when spark.sql.parquet.outputTimestampType is INT96. The native writer always writes INT64 microseconds and ignores outputTimestampType when writing, so the check has to read the session conf.

Add a regression test with a non-INT96 timestamp output and int96RebaseModeInWrite=LEGACY that asserts the write stays native and matches Spark's value. Update the paragraph in docs/source/user-guide/latest/parquet.md that names int96RebaseModeInWrite=LEGACY as a fallback trigger.

Additional context

Reviewer comment: https://github.com/apache/datafusion-comet/pull/7053#discussion_r4458640616

Follow-on to #7053, which should merge first.

Lingua principale
Scala
Stelle
1.3k
Fork
405
Merge medio
3g 3h
PR unite (30g)
269

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apache/datafusion-comet

Tutte le issue di apache/datafusion-comet

Issue simili

Altre issue su Scala

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.