HTHou commented on code in PR #16858:
URL: https://github.com/apache/iotdb/pull/16858#discussion_r2618127803
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/write/RelationalInsertTabletNode.java:
##########
@@ -465,24 +463,26 @@ private void handleObjectValue(
Map.Entry<TRegionReplicaSet, List<Integer>> entry,
List<WritePlanNode> result) {
for (int j = startRow; j < endRow; j++) {
+ if (((Binary[]) columns[column])[j] == null) {
+ continue;
+ }
byte[] binary = ((Binary[]) columns[column])[j].getValues();
ByteBuffer buffer = ByteBuffer.wrap(binary);
boolean isEoF = buffer.get() == 1;
long offset = buffer.getLong();
byte[] content = ReadWriteIOUtils.readBytes(buffer, buffer.remaining());
- String relativePath =
- TsFileNameGenerator.generateObjectFilePath(
+ IObjectPath relativePath =
+ IObjectPath.Factory.FACTORY.create(
entry.getKey().getRegionId().getId(), times[j], getDeviceID(j),
measurements[column]);
ObjectNode objectNode = new ObjectNode(isEoF, offset, content,
relativePath);
objectNode.setDataRegionReplicaSet(entry.getKey());
result.add(objectNode);
if (isEoF) {
- byte[] filePathBytes = relativePath.getBytes(StandardCharsets.UTF_8);
- byte[] valueBytes = new byte[filePathBytes.length + Long.BYTES];
- System.arraycopy(
- BytesUtils.longToBytes(offset + content.length), 0, valueBytes, 0,
Long.BYTES);
- System.arraycopy(filePathBytes, 0, valueBytes, Long.BYTES,
filePathBytes.length);
- ((Binary[]) columns[column])[j] = new Binary(valueBytes);
+ ByteBuffer valueBytes =
+ ByteBuffer.allocate(relativePath.getSerializeSizeToObjectValue() +
Long.BYTES);
+ valueBytes.putLong(offset + content.length);
+ relativePath.serializeToObjectValue(valueBytes);
+ ((Binary[]) columns[column])[j] = new Binary(valueBytes.array());
Review Comment:
fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]