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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]