Skip to content

Commit 62b38d7

Browse files
authored
[fix](spark load) fix getHashValue of string type is always zero in spark load. (apache#9136)
Buffer flip is used incorrectly. When the hash key is string type, the hash value is always zero. The reason is that the buffer of string type is obtained by wrap, which is not needed to flip. If we do so, the buffer limit for read will be zero.
1 parent 88115ff commit 62b38d7

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

  • fe/spark-dpp/src/main/java/org/apache/doris/load/loadv2/dpp

‎fe/spark-dpp/src/main/java/org/apache/doris/load/loadv2/dpp/DppUtils.java‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,10 @@ public static ByteBuffer getHashValue(Object o, DataType type) {
182182
byte value = (byte) (b ? 1 : 0);
183183
buffer.put(value);
184184
}
185-
buffer.flip();
185+
// do not flip buffer when the buffer was created by wrap()
186+
if (!type.equals(DataTypes.StringType)) {
187+
buffer.flip();
188+
}
186189
return buffer;
187190
}
188191

0 commit comments

Comments
 (0)