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


##########
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:
   Thanks, both. I added this in 82c7ff4ceb4c using the explicit read schema 
@viirya suggested. On Spark 4+, the test reads just `history` with its nested 
`ts` declared as `TIMESTAMP_NTZ`, so it exercises the NTZ guard on the same 
encrypted INT96 leaf. It checks the year-9999 result against Spark and asserts 
the fallback reason. Spark 3.5 rejects that conversion, so it skips just this 
extra read. [CI 
run](https://github.com/sunchao/arrow-datafusion-comet/actions/runs/47236570666)



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