Skip to content

Commit f808f27

Browse files
committed
addressing comments
1 parent 5e2e2ec commit f808f27

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

hudi-hadoop-mr/src/main/java/org/apache/hudi/hadoop/realtime/RealtimeSplit.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,10 @@ default void writeToOutput(DataOutput out) throws IOException {
107107
} else {
108108
InputSplitUtils.writeBoolean(true, out);
109109
InputSplitUtils.writeString(virtualKeyInfoOpt.get().getRecordKeyField(), out);
110+
InputSplitUtils.writeString(String.valueOf(virtualKeyInfoOpt.get().getRecordKeyFieldIndex()), out);
110111
InputSplitUtils.writeBoolean(virtualKeyInfoOpt.get().getPartitionPathField().isPresent(), out);
111112
if (virtualKeyInfoOpt.get().getPartitionPathField().isPresent()) {
112113
InputSplitUtils.writeString(virtualKeyInfoOpt.get().getPartitionPathField().get(), out);
113-
}
114-
InputSplitUtils.writeString(String.valueOf(virtualKeyInfoOpt.get().getRecordKeyFieldIndex()), out);
115-
// if partition path field exists, partition path field index should also exists. So, don't need another boolean
116-
if (virtualKeyInfoOpt.get().getPartitionPathFieldIndex().isPresent()) {
117114
InputSplitUtils.writeString(String.valueOf(virtualKeyInfoOpt.get().getPartitionPathFieldIndex()), out);
118115
}
119116
}
@@ -136,9 +133,9 @@ default void readFromInput(DataInput in) throws IOException {
136133
boolean hoodieVirtualKeyPresent = InputSplitUtils.readBoolean(in);
137134
if (hoodieVirtualKeyPresent) {
138135
String recordKeyField = InputSplitUtils.readString(in);
136+
int recordFieldIndex = Integer.parseInt(InputSplitUtils.readString(in));
139137
boolean isPartitionPathFieldPresent = InputSplitUtils.readBoolean(in);
140138
Option<String> partitionPathField = isPartitionPathFieldPresent ? Option.of(InputSplitUtils.readString(in)) : Option.empty();
141-
int recordFieldIndex = Integer.parseInt(InputSplitUtils.readString(in));
142139
Option<Integer> partitionPathIndex = isPartitionPathFieldPresent ? Option.of(Integer.parseInt(InputSplitUtils.readString(in))) : Option.empty();
143140
setVirtualKeyInfo(Option.of(new HoodieVirtualKeyInfo(recordKeyField, partitionPathField, recordFieldIndex, partitionPathIndex)));
144141
}

0 commit comments

Comments
 (0)