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