openinx commented on a change in pull request #4273:
URL: https://github.com/apache/iceberg/pull/4273#discussion_r836996457



##########
File path: orc/src/main/java/org/apache/iceberg/orc/ORC.java
##########
@@ -206,43 +227,64 @@ public int vectorizedRowBatchSize() {
         return vectorizedRowBatchSize;
       }
 
-      private Context(long stripeSize, long blockSize, int 
vectorizedRowBatchSize) {
+      public String codecAsString() {
+        return codecAsString;
+      }
+
+      public String compressionStrategy() {
+        return compressionStrategy;
+      }
+
+      private Context(long stripeSize, long blockSize, int 
vectorizedRowBatchSize,
+          String codecAsString, String compressionStrategy) {
         this.stripeSize = stripeSize;
         this.blockSize = blockSize;
         this.vectorizedRowBatchSize = vectorizedRowBatchSize;
+        this.codecAsString = codecAsString;
+        this.compressionStrategy = compressionStrategy;
       }
 
       static Context dataContext(Map<String, String> config) {
         long stripeSize = PropertyUtil.propertyAsLong(config, 
OrcConf.STRIPE_SIZE.getAttribute(),
-            TableProperties.ORC_STRIPE_SIZE_BYTES_DEFAULT);
-        stripeSize = PropertyUtil.propertyAsLong(config, 
TableProperties.ORC_STRIPE_SIZE_BYTES, stripeSize);
+            ORC_STRIPE_SIZE_BYTES_DEFAULT);
+        stripeSize = PropertyUtil.propertyAsLong(config, 
ORC_STRIPE_SIZE_BYTES, stripeSize);
         Preconditions.checkArgument(stripeSize > 0, "Stripe size must be > 0");
 
         long blockSize = PropertyUtil.propertyAsLong(config, 
OrcConf.BLOCK_SIZE.getAttribute(),
-            TableProperties.ORC_BLOCK_SIZE_BYTES_DEFAULT);
-        blockSize = PropertyUtil.propertyAsLong(config, 
TableProperties.ORC_BLOCK_SIZE_BYTES, blockSize);
+            ORC_BLOCK_SIZE_BYTES_DEFAULT);
+        blockSize = PropertyUtil.propertyAsLong(config, ORC_BLOCK_SIZE_BYTES, 
blockSize);
         Preconditions.checkArgument(blockSize > 0, "Block size must be > 0");
 
         int vectorizedRowBatchSize = PropertyUtil.propertyAsInt(config,
-            TableProperties.ORC_WRITE_BATCH_SIZE, 
TableProperties.ORC_WRITE_BATCH_SIZE_DEFAULT);
+            ORC_WRITE_BATCH_SIZE, ORC_WRITE_BATCH_SIZE_DEFAULT);
         Preconditions.checkArgument(vectorizedRowBatchSize > 0, "VectorizedRow 
batch size must be > 0");
 
-        return new Context(stripeSize, blockSize, vectorizedRowBatchSize);
+        String codecAsString = 
config.getOrDefault(OrcConf.COMPRESS.getAttribute(), ORC_COMPRESSION_DEFAULT);
+        codecAsString = config.getOrDefault(ORC_COMPRESSION, codecAsString);
+
+        String compressionStrategy = 
config.getOrDefault(OrcConf.COMPRESSION_STRATEGY.getAttribute(),
+            ORC_COMPRESSION_STRATEGY_DEFAULT);
+        compressionStrategy = config.getOrDefault(ORC_COMPRESSION_STRATEGY, 
compressionStrategy);
+
+        return new Context(stripeSize, blockSize, vectorizedRowBatchSize, 
codecAsString, compressionStrategy);
       }
 
       static Context deleteContext(Map<String, String> config) {
         Context dataContext = dataContext(config);
 
-        long stripeSize = PropertyUtil.propertyAsLong(config,
-            TableProperties.DELETE_ORC_STRIPE_SIZE_BYTES, 
dataContext.stripeSize());
+        long stripeSize = PropertyUtil.propertyAsLong(config, 
DELETE_ORC_STRIPE_SIZE_BYTES, dataContext.stripeSize());
 
-        long blockSize = PropertyUtil.propertyAsLong(config,
-            TableProperties.DELETE_ORC_BLOCK_SIZE_BYTES, 
dataContext.blockSize());
+        long blockSize = PropertyUtil.propertyAsLong(config, 
DELETE_ORC_BLOCK_SIZE_BYTES, dataContext.blockSize());
 
         int vectorizedRowBatchSize = PropertyUtil.propertyAsInt(config,
-            TableProperties.DELETE_ORC_WRITE_BATCH_SIZE, 
dataContext.vectorizedRowBatchSize());
+            DELETE_ORC_WRITE_BATCH_SIZE, dataContext.vectorizedRowBatchSize());
+
+        String codecAsString = config.getOrDefault(DELETE_ORC_COMPRESSION, 
dataContext.codecAsString());
+
+        String compressionStrategy = 
config.getOrDefault(DELETE_ORC_COMPRESSION_STRATEGY,
+            dataContext.compressionStrategy());

Review comment:
       Nit: Please use the same approach to parse the `codec` & 
`compression-strategy` .




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