rich7420 commented on code in PR #7227:
URL: https://github.com/apache/datafusion-comet/pull/7227#discussion_r4707751356


##########
native/core/src/parquet/schema_adapter.rs:
##########
@@ -2701,6 +2857,207 @@ pub(crate) mod test {
         Ok(())
     }
 
+    /// A `TIMESTAMP(MICROS)` column read as a string, a narrower integer, a 
float or a decimal:
+    /// Spark has no updater for these, so it rejects them instead of 
returning the timestamp as
+    /// text, the raw value or NULL. Reading it as `bigint` stays allowed. See 
#7214.
+    #[tokio::test]
+    async fn parquet_timestamp_read_as_non_timestamp_errors() -> Result<(), 
DataFusionError> {

Review Comment:
   Could we add JVM coverage with `checkSparkAnswerMaybeThrows` for INT96 and 
`TIMESTAMP_MICROS` as `string` or `decimal(20,0)`, plus one successful read?



##########
native/core/src/parquet/schema_adapter.rs:
##########
@@ -652,6 +675,8 @@ fn spark_has_updater(
         // Long -> date / timestamp (raw INT64; annotated columns surface as 
Date32/Timestamp).
         | (DataType::Int64, DataType::Date32)
         | (DataType::Int64, DataType::Timestamp(_, _))
+        // Unannotated INT64 that an `ARROW:schema` hint restored as a second 
timestamp.
+        | (DataType::Timestamp(TimeUnit::Second, _), DataType::Timestamp(_, _))

Review Comment:
   Spark reads pyarrow's `flavor="spark"` INT96 with a `timestamp[s]` hint, but 
with this arm `spark.read.parquet` fails for me. Could the check use the 
Parquet type?
   
   ```python
   t = pa.array([1577840523, 0], type=pa.int64()).cast(pa.timestamp("s", 
tz="UTC"))
   table = pa.table({"id": pa.array([1, 2], pa.int32()), "t": t})
   pq.write_table(table, path, flavor="spark")
   ```



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