You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@parquet.apache.org by GitBox <gi...@apache.org> on 2022/04/14 14:49:08 UTC

[GitHub] [parquet-mr] shangxinli commented on a diff in pull request #954: PARQUET-2136: File writer construction with encryptor

shangxinli commented on code in PR #954:
URL: https://github.com/apache/parquet-mr/pull/954#discussion_r850523822


##########
parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetFileWriter.java:
##########
@@ -336,20 +354,30 @@ public ParquetFileWriter(OutputFile file, MessageType schema, Mode mode,
 
     this.metadataConverter = new ParquetMetadataConverter(statisticsTruncateLength);
 
-    if (null == encryptionProperties) {
+    if (null == encryptionProperties && null == encryptor) {
       this.fileEncryptor = null;
-    } else {
-      // Verify that every encrypted column is in file schema
-      Map<ColumnPath, ColumnEncryptionProperties> columnEncryptionProperties = encryptionProperties.getEncryptedColumns();
-      if (null != columnEncryptionProperties) { // if null, every column in file schema will be encrypted with footer key
-        for (Map.Entry<ColumnPath, ColumnEncryptionProperties> entry : columnEncryptionProperties.entrySet()) {
-          String[] path = entry.getKey().toArray();
-          if(!schema.containsPath(path)) {
-            throw new ParquetCryptoRuntimeException("Encrypted column " + Arrays.toString(path) + " not in file schema");
-          }
+      return;
+    }
+
+    if (null == encryptionProperties) {
+      encryptionProperties = encryptor.getEncryptionProperties();

Review Comment:
   In the line 377, you checked the encryptor. What if it is null?



-- 
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: dev-unsubscribe@parquet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org