hsiang-c commented on code in PR #2447:
URL: https://github.com/apache/datafusion-comet/pull/2447#discussion_r2407800932
##########
spark/src/test/scala/org/apache/spark/sql/comet/ParquetEncryptionITCase.scala:
##########
@@ -191,6 +521,30 @@ class ParquetEncryptionITCase extends CometTestBase with
SQLTestUtils {
}
}
+ /**
+ * Verify that the directory contains an encrypted parquet in plaintext
footer mode by means of
+ * checking for all the parquet part files in the parquet directory that
their magic string is
+ * PAR1, as defined in the spec:
+ *
https://github.com/apache/parquet-format/blob/master/Encryption.md#55-plaintext-footer-mode
+ */
+ private def verifyParquetPlaintextFooter(parquetDir: String): Unit = {
+ val parquetPartitionFiles = getListOfParquetFiles(new File(parquetDir))
+ assert(parquetPartitionFiles.size >= 1)
+ parquetPartitionFiles.foreach { parquetFile =>
+ val magicString = "PAR1"
+ val magicStringLength = magicString.length()
+ val byteArray = new Array[Byte](magicStringLength)
+ val randomAccessFile = new RandomAccessFile(parquetFile, "r")
+ try {
+ randomAccessFile.read(byteArray, 0, magicStringLength)
Review Comment:
(nit) Do you think we should check the magic number at the tail?
--
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]