cloud-fan commented on code in PR #56622:
URL: https://github.com/apache/spark/pull/56622#discussion_r3449059739


##########
sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/ParquetVectorUpdaterFactory.java:
##########
@@ -165,8 +165,17 @@ public ParquetVectorUpdater getUpdater(ColumnDescriptor 
descriptor, DataType spa
           return new LongUpdater();
         } else if (canReadAsDecimal(descriptor, sparkType)) {
           return new LongToDecimalUpdater(descriptor, (DecimalType) sparkType);
-        } else if (sparkType instanceof TimeType) {
-          return new LongAsNanosUpdater();
+        } else if (sparkType instanceof TimeType &&
+          isTimeTypeMatched(LogicalTypeAnnotation.TimeUnit.NANOS)) {

Review Comment:
   This now requires a `TIME(MICROS)`/`TIME(NANOS)` annotation, where the old 
`else if (sparkType instanceof TimeType)` matched any INT64 column and decoded 
it as micros. The tightening itself is good — it matches the row-based reader's 
`requireCompatibleParquetType` and turns a silent mis-decode into a loud 
failure — but it's a user-facing behavior change: a job that read such a file 
via the vectorized reader will now throw.
   
   Per Spark convention, could we add a legacy escape hatch + migration note?
   - a `spark.sql.legacy.parquet.lenientTimeInt64Read` (`.internal()`, 
`booleanConf`, `.createWithDefault(false)`, `.version("4.3.0")`, modeled on 
`LEGACY_PARQUET_RETURN_NULL_STRUCT_IF_ALL_FIELDS_MISSING`) that, when true, 
falls back here to the pre-PR lenient `LongAsNanosUpdater` (raw INT64 -> 
micros) regardless of annotation;
   - a `docs/sql-migration-guide.md` entry noting the change and the restore 
flag.
   
   (Version 4.3.0 assuming this backports to branch-4.x.)



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