-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[HUDI-764] [HUDI-765] ORC reader and writer implementation #2793
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,10 +39,21 @@ public class HoodieStorageConfig extends DefaultHoodieConfig { | |
public static final String DEFAULT_PARQUET_BLOCK_SIZE_BYTES = DEFAULT_PARQUET_FILE_MAX_BYTES; | ||
public static final String PARQUET_PAGE_SIZE_BYTES = "hoodie.parquet.page.size"; | ||
public static final String DEFAULT_PARQUET_PAGE_SIZE_BYTES = String.valueOf(1 * 1024 * 1024); | ||
|
||
public static final String HFILE_FILE_MAX_BYTES = "hoodie.hfile.max.file.size"; | ||
public static final String HFILE_BLOCK_SIZE_BYTES = "hoodie.hfile.block.size"; | ||
public static final String DEFAULT_HFILE_BLOCK_SIZE_BYTES = String.valueOf(1 * 1024 * 1024); | ||
public static final String DEFAULT_HFILE_FILE_MAX_BYTES = String.valueOf(120 * 1024 * 1024); | ||
|
||
public static final String ORC_FILE_MAX_BYTES = "hoodie.orc.max.file.size"; | ||
public static final String DEFAULT_ORC_FILE_MAX_BYTES = String.valueOf(120 * 1024 * 1024); | ||
// size of the memory buffer in bytes for writing | ||
public static final String ORC_STRIPE_SIZE = "hoodie.orc.stripe.size"; | ||
public static final String DEFAULT_ORC_STRIPE_SIZE = String.valueOf(64 * 1024 * 1024); | ||
// file system block size | ||
public static final String ORC_BLOCK_SIZE = "hoodie.orc.block.size"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same for block size |
||
public static final String DEFAULT_ORC_BLOCK_SIZE = DEFAULT_ORC_FILE_MAX_BYTES; | ||
|
||
// used to size log files | ||
public static final String LOGFILE_SIZE_MAX_BYTES = "hoodie.logfile.max.size"; | ||
public static final String DEFAULT_LOGFILE_SIZE_MAX_BYTES = String.valueOf(1024 * 1024 * 1024); // 1 GB | ||
|
@@ -54,9 +65,11 @@ public class HoodieStorageConfig extends DefaultHoodieConfig { | |
public static final String DEFAULT_STREAM_COMPRESSION_RATIO = String.valueOf(0.1); | ||
public static final String PARQUET_COMPRESSION_CODEC = "hoodie.parquet.compression.codec"; | ||
public static final String HFILE_COMPRESSION_ALGORITHM = "hoodie.hfile.compression.algorithm"; | ||
public static final String ORC_COMPRESSION_CODEC = "hoodie.orc.compression.codec"; | ||
// Default compression codec for parquet | ||
public static final String DEFAULT_PARQUET_COMPRESSION_CODEC = "gzip"; | ||
public static final String DEFAULT_HFILE_COMPRESSION_ALGORITHM = "GZ"; | ||
public static final String DEFAULT_ORC_COMPRESSION_CODEC = "ZLIB"; | ||
public static final String LOGFILE_TO_PARQUET_COMPRESSION_RATIO = "hoodie.logfile.to.parquet.compression.ratio"; | ||
// Default compression ratio for log file to parquet, general 3x | ||
public static final String DEFAULT_LOGFILE_TO_PARQUET_COMPRESSION_RATIO = String.valueOf(0.35); | ||
|
@@ -140,6 +153,26 @@ public Builder logFileToParquetCompressionRatio(double logFileToParquetCompressi | |
return this; | ||
} | ||
|
||
public Builder orcMaxFileSize(long maxFileSize) { | ||
props.setProperty(ORC_FILE_MAX_BYTES, String.valueOf(maxFileSize)); | ||
return this; | ||
} | ||
|
||
public Builder orcStripeSize(int orcStripeSize) { | ||
props.setProperty(ORC_STRIPE_SIZE, String.valueOf(orcStripeSize)); | ||
return this; | ||
} | ||
|
||
public Builder orcBlockSize(int orcBlockSize) { | ||
props.setProperty(ORC_BLOCK_SIZE, String.valueOf(orcBlockSize)); | ||
return this; | ||
} | ||
|
||
public Builder orcCompressionCodec(String orcCompressionCodec) { | ||
props.setProperty(ORC_COMPRESSION_CODEC, orcCompressionCodec); | ||
return this; | ||
} | ||
|
||
public HoodieStorageConfig build() { | ||
HoodieStorageConfig config = new HoodieStorageConfig(props); | ||
setDefaultOnCondition(props, !props.containsKey(PARQUET_FILE_MAX_BYTES), PARQUET_FILE_MAX_BYTES, | ||
|
@@ -166,6 +199,15 @@ public HoodieStorageConfig build() { | |
setDefaultOnCondition(props, !props.containsKey(HFILE_FILE_MAX_BYTES), HFILE_FILE_MAX_BYTES, | ||
DEFAULT_HFILE_FILE_MAX_BYTES); | ||
|
||
setDefaultOnCondition(props, !props.containsKey(ORC_FILE_MAX_BYTES), ORC_FILE_MAX_BYTES, | ||
DEFAULT_ORC_FILE_MAX_BYTES); | ||
setDefaultOnCondition(props, !props.containsKey(ORC_STRIPE_SIZE), ORC_STRIPE_SIZE, | ||
DEFAULT_ORC_STRIPE_SIZE); | ||
setDefaultOnCondition(props, !props.containsKey(ORC_BLOCK_SIZE), ORC_BLOCK_SIZE, | ||
DEFAULT_ORC_BLOCK_SIZE); | ||
setDefaultOnCondition(props, !props.containsKey(ORC_COMPRESSION_CODEC), ORC_COMPRESSION_CODEC, | ||
DEFAULT_ORC_COMPRESSION_CODEC); | ||
|
||
return config; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/io/storage/HoodieOrcConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.hudi.io.storage; | ||
|
||
import org.apache.hadoop.conf.Configuration; | ||
import org.apache.hudi.common.bloom.BloomFilter; | ||
import org.apache.orc.CompressionKind; | ||
|
||
public class HoodieOrcConfig { | ||
static final String AVRO_SCHEMA_METADATA_KEY = "orc.avro.schema"; | ||
|
||
private final CompressionKind compressionKind; | ||
private final int stripeSize; | ||
private final int blockSize; | ||
private final long maxFileSize; | ||
private final Configuration hadoopConf; | ||
private final BloomFilter bloomFilter; | ||
|
||
public HoodieOrcConfig(Configuration hadoopConf, CompressionKind compressionKind, int stripeSize, | ||
int blockSize, long maxFileSize, BloomFilter bloomFilter) { | ||
this.hadoopConf = hadoopConf; | ||
this.compressionKind = compressionKind; | ||
this.stripeSize = stripeSize; | ||
this.blockSize = blockSize; | ||
this.maxFileSize = maxFileSize; | ||
this.bloomFilter = bloomFilter; | ||
} | ||
|
||
public Configuration getHadoopConf() { | ||
return hadoopConf; | ||
} | ||
|
||
public CompressionKind getCompressionKind() { | ||
return compressionKind; | ||
} | ||
|
||
public int getStripeSize() { | ||
return stripeSize; | ||
} | ||
|
||
public int getBlockSize() { | ||
return blockSize; | ||
} | ||
|
||
public long getMaxFileSize() { | ||
return maxFileSize; | ||
} | ||
|
||
public boolean useBloomFilter() { | ||
return bloomFilter != null; | ||
} | ||
|
||
public BloomFilter getBloomFilter() { | ||
return bloomFilter; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add comments on what is the stripe size used for ?