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 #374

Merged
merged 2 commits into from
Jan 9, 2025

Conversation

JackieTien97
Copy link
Contributor

@JackieTien97 JackieTien97 commented Jan 9, 2025

  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 66.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 64.71%. Comparing base (fe2200c) to head (999bad4).
Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
...he/tsfile/read/common/block/column/TimeColumn.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #374      +/-   ##
===========================================
- Coverage    64.71%   64.71%   -0.01%     
===========================================
  Files          541      541              
  Lines        32310    32309       -1     
  Branches      4312     4311       -1     
===========================================
- Hits         20911    20910       -1     
  Misses       10902    10902              
  Partials       497      497              

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

@Beyyes Beyyes merged commit 3929106 into develop Jan 9, 2025
11 checks passed
@Beyyes Beyyes deleted the ty/BinaryColumnBugFix branch January 9, 2025 09:36
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