rdblue commented on a change in pull request #4273:
URL: https://github.com/apache/iceberg/pull/4273#discussion_r821150365
##########
File path: orc/src/main/java/org/apache/iceberg/orc/ORC.java
##########
@@ -186,35 +204,63 @@ public long blockSize() {
return blockSize;
}
- private Context(long stripeSize, long blockSize) {
+ public String codecAsString() {
+ return codecAsString;
+ }
+
+ public String compressionStrategy() {
+ return compressionStrategy;
+ }
+
+ private Context(long stripeSize, long blockSize, String codecAsString,
String compressionStrategy) {
this.stripeSize = stripeSize;
this.blockSize = blockSize;
+ this.codecAsString = codecAsString;
+ this.compressionStrategy = compressionStrategy;
}
static Context dataContext(Configuration conf) {
- long stripeSize = TableProperties.ORC_STRIPE_SIZE_BYTES_DEFAULT;
- stripeSize = conf.getLong(OrcConf.STRIPE_SIZE.getAttribute(),
stripeSize);
- stripeSize = conf.getLong(OrcConf.STRIPE_SIZE.getHiveConfName(),
stripeSize);
- stripeSize = conf.getLong(TableProperties.ORC_STRIPE_SIZE_BYTES,
stripeSize);
+ String stripeSizeStr = lookupValue(conf, OrcConf.STRIPE_SIZE,
ORC_STRIPE_SIZE_BYTES);
+ long stripeSize = stripeSizeStr != null ?
Long.parseLong(stripeSizeStr) : ORC_STRIPE_SIZE_BYTES_DEFAULT;
+
+ String blockSizeStr = lookupValue(conf, OrcConf.BLOCK_SIZE,
ORC_BLOCK_SIZE_BYTES);
+ long blockSize = blockSizeStr != null ? Long.parseLong(blockSizeStr) :
ORC_BLOCK_SIZE_BYTES_DEFAULT;
- long blockSize = TableProperties.ORC_BLOCK_SIZE_BYTES_DEFAULT;
- blockSize = conf.getLong(OrcConf.BLOCK_SIZE.getAttribute(), blockSize);
- blockSize = conf.getLong(OrcConf.BLOCK_SIZE.getHiveConfName(),
blockSize);
- blockSize = conf.getLong(TableProperties.ORC_BLOCK_SIZE_BYTES,
blockSize);
+ String codecAsString = lookupValue(conf, OrcConf.COMPRESS,
ORC_COMPRESSION);
+ if (codecAsString == null) {
+ codecAsString = ORC_COMPRESSION_DEFAULT;
+ }
- return new Context(stripeSize, blockSize);
+ String compressionStrategy = lookupValue(conf,
OrcConf.COMPRESSION_STRATEGY, ORC_COMPRESSION_STRATEGY);
+ if (compressionStrategy == null) {
+ compressionStrategy = ORC_COMPRESSION_STRATEGY_DEFAULT;
+ }
+
+ return new Context(stripeSize, blockSize, codecAsString,
compressionStrategy);
}
static Context deleteContext(Configuration conf) {
Context dataContext = dataContext(conf);
- long stripeSize =
- conf.getLong(TableProperties.DELETE_ORC_STRIPE_SIZE_BYTES,
dataContext.stripeSize());
+ long stripeSize = conf.getLong(DELETE_ORC_STRIPE_SIZE_BYTES,
dataContext.stripeSize());
+ long blockSize = conf.getLong(DELETE_ORC_BLOCK_SIZE_BYTES,
dataContext.stripeSize());
+ String codecAsString = conf.get(DELETE_ORC_COMPRESSION,
dataContext.codecAsString());
+ String compressionStrategy = conf.get(DELETE_ORC_COMPRESSION_STRATEGY,
dataContext.compressionStrategy());
- long blockSize =
- conf.getLong(TableProperties.DELETE_ORC_BLOCK_SIZE_BYTES,
dataContext.stripeSize());
+ return new Context(stripeSize, blockSize, codecAsString,
compressionStrategy);
+ }
- return new Context(stripeSize, blockSize);
+ static String lookupValue(Configuration conf, OrcConf orcConf, String
icebergPropertyKey) {
Review comment:
Something is wrong if this is looking up an Iceberg table property like
`ORC_STRIPE_SIZE_BYTES` in a Hadoop Configuration. Iceberg settings should be
pulled from table properties, not from Hadoop.
--
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]