Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct the retained size calculation for BinaryColumn and BinaryColumnBuilder #384

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

JackieTien97
Copy link
Contributor

  1. Correct the retained size calculation for BinaryColumn and BinaryColumnBuilder
  2. remove some useless todo
  3. throw new UnsupportedOperationException for isNull method in TimeColumn

Do the performance test, build 1 billion binary using TsBlockBuilder, we only see 1-second performance impact(macOS M2 pro, OpenJDK-21).
Before:
6779
6420
6394
6387
6527

After:
7589
7524
8063
7592
7696

You can replay that test, using the following codes

public static void main(String[] args) {
  TsBlockBuilder builder = new TsBlockBuilder(Collections.singletonList(TSDataType.BLOB));
  TimeColumnBuilder timeColumnBuilder = builder.getTimeColumnBuilder();
  ColumnBuilder columnBuilder = builder.getColumnBuilder(0);
  long startTime = System.nanoTime();
  for (int i = 0; i < 1_000_000_000; i++) {
    timeColumnBuilder.writeLong(i);
    Binary binary = new Binary(BytesUtils.intToBytes(i));
    columnBuilder.writeBinary(binary);
    builder.declarePosition();
    if (builder.isFull()) {
      builder.build();
      builder.reset();
      timeColumnBuilder = builder.getTimeColumnBuilder();
      columnBuilder = builder.getColumnBuilder(0);
    }
  }
  if (!builder.isEmpty()) {
    builder.build();
    builder.reset();
  }
  System.out.println("cost: " + (System.nanoTime() - startTime) / 1_000_000);
}

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 15.00000% with 17 lines in your changes missing coverage. Please review.

Project coverage is 64.62%. Comparing base (02727c5) to head (beace6c).

Files with missing lines Patch % Lines
.../tsfile/read/common/block/column/BinaryColumn.java 11.11% 16 Missing ⚠️
...he/tsfile/read/common/block/column/TimeColumn.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #384      +/-   ##
===========================================
- Coverage    64.66%   64.62%   -0.04%     
===========================================
  Files          541      541              
  Lines        32371    32386      +15     
  Branches      4318     4322       +4     
===========================================
- Hits         20932    20931       -1     
- Misses       10942    10958      +16     
  Partials       497      497              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants