You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@tsfile.apache.org by "jt2594838 (via GitHub)" <gi...@apache.org> on 2026/06/01 03:38:51 UTC
Re: [PR] Add Tablet.serializedSize() and comprehensive size validation tests. [tsfile]
jt2594838 commented on code in PR #824:
URL: https://github.com/apache/tsfile/pull/824#discussion_r3331515241
##########
java/tsfile/src/main/java/org/apache/tsfile/write/record/Tablet.java:
##########
@@ -764,6 +777,107 @@ public void serialize(DataOutputStream stream) throws IOException {
writeValues(stream);
}
+ private int serializedSizeOfMeasurementSchemas() {
+ int size = Byte.BYTES;
+ if (schemas != null) {
+ size = Math.addExact(size, Integer.BYTES);
+ for (int i = 0; i < schemas.size(); i++) {
+ size = Math.addExact(size, Byte.BYTES);
+ final IMeasurementSchema schema = schemas.get(i);
+ if (schema != null) {
+ size = Math.addExact(size, schema.serializedSize());
+ size = Math.addExact(size, Byte.BYTES);
+ }
+ }
+ }
+ return size;
+ }
+
+ private int serializedSizeOfTimes() {
+ int size = Byte.BYTES;
+ if (timestamps != null) {
+ size = Math.addExact(size, Math.multiplyExact(Long.BYTES, rowSize));
+ }
+ return size;
+ }
+
+ private int serializedSizeOfBitMaps() {
+ int size = Byte.BYTES;
+ if (bitMaps != null) {
+ final int columnCount = schemas == null ? 0 : schemas.size();
+ for (int i = 0; i < columnCount; i++) {
+ if (bitMaps[i] == null || bitMaps[i].isAllUnmarked(rowSize)) {
+ size = Math.addExact(size, Byte.BYTES);
+ } else {
+ size = Math.addExact(size, Byte.BYTES);
+ size = Math.addExact(size, Integer.BYTES);
+ size =
+ Math.addExact(
+ size,
+ ReadWriteIOUtils.sizeToWrite(
+ new Binary(bitMaps[i].getTruncatedByteArray(rowSize))));
Review Comment:
This is too costly. May simply calculate from rowSize?
--
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: notifications-unsubscribe@tsfile.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org