-
Notifications
You must be signed in to change notification settings - Fork 2.5k
[HUDI-4601] Read error from MOR table after compaction with timestamp partitioning #6365
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
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -68,6 +68,7 @@ | |
| import java.util.Set; | ||
| import java.util.stream.IntStream; | ||
|
|
||
| import static org.apache.flink.table.types.logical.LogicalTypeRoot.TIMESTAMP_WITHOUT_TIME_ZONE; | ||
| import static org.apache.hudi.hadoop.utils.HoodieInputFormatUtils.HOODIE_COMMIT_TIME_COL_POS; | ||
| import static org.apache.hudi.hadoop.utils.HoodieInputFormatUtils.HOODIE_RECORD_KEY_COL_POS; | ||
| import static org.apache.hudi.table.format.FormatUtils.buildAvroRecordBySchema; | ||
|
|
@@ -298,10 +299,21 @@ private ParquetColumnarRowSplitReader getReader(String path, int[] requiredPos) | |
| new org.apache.hadoop.fs.Path(path).getParent(), | ||
| this.conf.getBoolean(FlinkOptions.HIVE_STYLE_PARTITIONING), | ||
| FilePathUtils.extractPartitionKeys(this.conf)); | ||
|
|
||
| LinkedHashMap<String, Object> partObjects = new LinkedHashMap<>(); | ||
| partSpec.forEach((k, v) -> partObjects.put(k, DataTypeUtils.resolvePartition( | ||
| defaultPartName.equals(v) ? null : v, | ||
| fieldTypes.get(fieldNames.indexOf(k))))); | ||
|
|
||
| // can't convert data by partition value if timestamp is used to partition key. | ||
| partSpec.entrySet().stream() | ||
| .filter(entry -> fieldTypes | ||
| .get(fieldNames.indexOf(entry.getKey())) | ||
| .getLogicalType().getTypeRoot() != TIMESTAMP_WITHOUT_TIME_ZONE) | ||
|
||
| .forEach(entry -> { | ||
| String k = entry.getKey(); | ||
| String v = entry.getValue(); | ||
| partObjects.put(k, DataTypeUtils.resolvePartition( | ||
| defaultPartName.equals(v) ? null : v, | ||
| fieldTypes.get(fieldNames.indexOf(k)))); | ||
| }); | ||
|
|
||
| return ParquetSplitReaderUtil.genPartColumnarRowReader( | ||
| this.conf.getBoolean(FlinkOptions.UTC_TIMEZONE), | ||
|
|
||
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.
Thanks, why not fix the partObjects directly when generating it?
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.
Looks a good way! Modified.