This is an automated email from the ASF dual-hosted git repository.
jackietien pushed a commit to branch object_type
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/object_type by this push:
new 875cc1be653 Print file name while encountering error
875cc1be653 is described below
commit 875cc1be65318a9d7b3a5d2e12363082a3e3aeb2
Author: JackieTien97 <[email protected]>
AuthorDate: Fri Aug 15 15:20:30 2025 +0800
Print file name while encountering error
---
.../unary/scalar/ReadObjectColumnTransformer.java | 29 ++++++++++++++--------
1 file changed, 19 insertions(+), 10 deletions(-)
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/transformation/dag/column/unary/scalar/ReadObjectColumnTransformer.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/transformation/dag/column/unary/scalar/ReadObjectColumnTransformer.java
index 9bde98b351a..9504c6c2282 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/transformation/dag/column/unary/scalar/ReadObjectColumnTransformer.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/transformation/dag/column/unary/scalar/ReadObjectColumnTransformer.java
@@ -108,16 +108,7 @@ public class ReadObjectColumnTransformer extends
UnaryColumnTransformer {
private Binary readObject(Binary binary) {
File file = ObjectTypeUtils.getObjectPathFromBinary(binary);
- long fileSize = file.length();
- if (offset >= fileSize) {
- throw new SemanticException(
- "offset is greater than object size, file path is " +
file.getAbsolutePath());
- }
- long actualReadSize = Math.min(length < 0 ? fileSize : length, fileSize -
offset);
- if (actualReadSize > Integer.MAX_VALUE) {
- throw new SemanticException(
- "Read object size is too large (size > 2G), file path is " +
file.getAbsolutePath());
- }
+ long actualReadSize = getActualReadSize(file);
fragmentInstanceContext.ifPresent(
context ->
context.getMemoryReservationContext().reserveMemoryCumulatively(actualReadSize));
byte[] bytes = new byte[(int) actualReadSize];
@@ -129,4 +120,22 @@ public class ReadObjectColumnTransformer extends
UnaryColumnTransformer {
}
return new Binary(bytes);
}
+
+ private long getActualReadSize(File file) {
+ long fileSize = file.length();
+ if (offset >= fileSize) {
+ throw new SemanticException(
+ String.format(
+ "offset %d is greater than object size %d, file path is %s",
+ offset, fileSize, file.getAbsolutePath()));
+ }
+ long actualReadSize = Math.min(length < 0 ? fileSize : length, fileSize -
offset);
+ if (actualReadSize > Integer.MAX_VALUE) {
+ throw new SemanticException(
+ String.format(
+ "Read object size %s is too large (size > 2G), file path is %s",
+ actualReadSize, file.getAbsolutePath()));
+ }
+ return actualReadSize;
+ }
}