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


##########
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:
   One detail on the suggested column: Spark always writes `TIMESTAMP_NTZ` as 
INT64, so `array(CAST(expires AS TIMESTAMP_NTZ))` would pin the schema match 
but not an INT96 leaf read as NTZ. Reaching that would need reading the 
existing INT96 array with `spark.read.schema(...)` declaring 
`array<timestamp_ntz>`, gated to Spark 4.x since 3.5 rejects that read. Either 
seems fine as a follow-up; not blocking.



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