comphead commented on code in PR #7720:
URL: https://github.com/apache/datafusion-comet/pull/7720#discussion_r4762661489


##########
spark/src/test/scala/org/apache/spark/sql/comet/ParquetEncryptionITCase.scala:
##########
@@ -167,6 +167,43 @@ class ParquetEncryptionITCase extends CometTestBase with 
SQLTestUtils {
     }
   }
 
+  test("encrypted legacy arrays preserve INT96 timestamps outside the 
nanosecond range") {
+    withTempDir { dir =>
+      withSQLConf(
+        DecryptionPropertiesFactory.CRYPTO_FACTORY_CLASS_PROPERTY_NAME -> 
cryptoFactoryClass,
+        KeyToolkit.KMS_CLIENT_CLASS_PROPERTY_NAME ->
+          "org.apache.parquet.crypto.keytools.mocks.InMemoryKMS",
+        InMemoryKMS.KEY_LIST_PROPERTY_NAME -> s"key1: ${key1}",
+        SQLConf.SESSION_LOCAL_TIMEZONE.key -> "UTC") {
+        val path = new File(dir, "parquet").getCanonicalPath
+        val input = spark.sql("""
+          |SELECT map('events', array(named_struct('ts', expires), NULL)) AS 
history,
+          |       expires, array(1, NULL) AS ids
+          |FROM (SELECT TIMESTAMP '9999-12-31 23:59:59' AS expires)

Review Comment:
   The guard and the user guide both cover `timestamp_ntz` under an array, but 
no test reaches that branch. It matters on Spark 4.x, where 
`ParquetVectorUpdaterFactory` at `v4.1.1` accepts INT96 for a 
`TimestampNTZType` read schema. At `v3.5.8` it raises instead. Adding a column 
such as `array(CAST(expires AS TIMESTAMP_NTZ)) AS ntz_ids` to `input` and one 
more `checkSparkAnswerAndFallbackReason(df.select("ntz_ids"), ...)` would pin 
it. The guard looks only at the Spark schema, so I expect the fallback to fire 
whatever physical type the writer used. I did not run this.



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