Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ public class TsBlockBuilder {
// This could be any other small number.
private static final int DEFAULT_INITIAL_EXPECTED_ENTRIES = 8;

public static final int MAX_LINE_NUMBER =
TSFileDescriptor.getInstance().getConfig().getMaxTsBlockLineNumber();

private static final int DEFAULT_MAX_TSBLOCK_SIZE_IN_BYTES =
TSFileDescriptor.getInstance().getConfig().getMaxTsBlockSizeInBytes();

Expand All @@ -60,6 +57,8 @@ public class TsBlockBuilder {
private List<TSDataType> types;
private TsBlockBuilderStatus tsBlockBuilderStatus;
private int declaredPositions;
private int maxTsBlockLineNumber =
TSFileDescriptor.getInstance().getConfig().getMaxTsBlockLineNumber();

private TsBlockBuilder() {}

Expand Down Expand Up @@ -266,7 +265,7 @@ public void declarePositions(int deltaPositions) {
}

public boolean isFull() {
return declaredPositions >= MAX_LINE_NUMBER || tsBlockBuilderStatus.isFull();
return declaredPositions >= maxTsBlockLineNumber || tsBlockBuilderStatus.isFull();
}

public boolean isEmpty() {
Expand All @@ -277,6 +276,16 @@ public int getPositionCount() {
return declaredPositions;
}

public int getMaxTsBlockLineNumber() {
return this.maxTsBlockLineNumber;
}

public void setMaxTsBlockLineNumber(int maxTsBlockLineNumber) {
if (maxTsBlockLineNumber > 0) {
this.maxTsBlockLineNumber = maxTsBlockLineNumber;
}
}

public long getSizeInBytes() {
return tsBlockBuilderStatus.getSizeInBytes();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public void testIntTsBlock() {
long[] timeArray = {1L, 2L, 3L, 4L, 5L};
int[] valueArray = {10, 20, 30, 40, 50};
TsBlockBuilder builder = new TsBlockBuilder(Collections.singletonList(TSDataType.INT32));
builder.setMaxTsBlockLineNumber(2);
for (int i = 0; i < timeArray.length; i++) {
builder.getTimeColumnBuilder().writeLong(timeArray[i]);
builder.getColumnBuilder(0).writeInt(valueArray[i]);
Expand Down