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 @@ -390,12 +390,12 @@ public void sortTAGWithExpressionTest() {
"l3,217,null,d2,1971-01-01T00:00:00.500Z,",
"l3,245,t,d1,1971-04-26T17:46:40.020Z,",
"l3,245,null,d2,1971-04-26T17:46:40.020Z,",
"l4,52,null,d2,1970-01-01T00:00:00.080Z,",
"l4,52,null,d1,1970-01-01T00:00:00.080Z,",
"l4,61,null,d2,1971-01-01T00:00:01.000Z,",
"l4,52,null,d2,1970-01-01T00:00:00.080Z,",
"l4,61,null,d1,1971-01-01T00:00:01.000Z,",
"l4,67,null,d2,1971-04-26T18:01:40.000Z,",
"l4,61,null,d2,1971-01-01T00:00:01.000Z,",
"l4,67,null,d1,1971-04-26T18:01:40.000Z,",
"l4,67,null,d2,1971-04-26T18:01:40.000Z,",
"l5,220,null,d1,1971-01-01T00:00:10.000Z,",
"l5,220,null,d2,1971-01-01T00:00:10.000Z,",
"l5,250,null,d1,1971-08-20T11:33:20.000Z,",
Expand All @@ -404,7 +404,7 @@ public void sortTAGWithExpressionTest() {
"l5,4662,null,d2,1970-01-01T00:00:00.100Z,",
};
tableResultSetEqualTest(
"select level,cast(num+floatNum as int32) as sum,attr1,device,time from table0 order by level asc, cast(num+floatNum as int32) asc, attr1 desc",
"select level,cast(num+floatNum as int32) as sum,attr1,device,time from table0 order by level asc, cast(num+floatNum as int32) asc, attr1 desc, device asc",
expectedHeader,
retArray,
DATABASE_NAME);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,20 @@ protected void gotCandidateBlocks() throws Exception {
} else {
if (cachedNextRightBlock == null) {
tryCacheNextRightTsBlock();
} else {
// if first value of block equals to last value of rightBlockList.get(0), append this block
// to
// rightBlockList
if (equalsTo(
cachedNextRightBlock,
rightJoinKeyPositions,
0,
rightBlockList.get(0),
rightJoinKeyPositions,
rightBlockList.get(0).getPositionCount() - 1)) {
addRightBlockWithMemoryReservation(cachedNextRightBlock);
cachedNextRightBlock = null;
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class FileSpillerReader implements SortReader {
private int rowIndex;
private boolean isEnd = false;

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

public FileSpillerReader(String fileName, SortBufferManager sortBufferManager, TsBlockSerde serde)
Expand All @@ -70,7 +70,7 @@ public MergeSortKey next() {
private boolean readTsBlockFromFile() throws IoTDBException {
long bufferSize = sortBufferManager.getReaderBufferAvailable();
cacheBlocks.clear();
while (bufferSize >= DEFAULT_MAX_TSBLOCK_SIZE_IN_BYTES) {
while (bufferSize >= maxTsBlockSizeInBytes) {
long size = read();
if (size == -1) {
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@

public class TableStreamSortOperatorTest {

private static final String sortTmpPrefixPath =
private static final String SORT_TMP_PREFIX_PATH =
"target" + File.separator + "sort" + File.separator + "tmp";

private static final ExecutorService instanceNotificationExecutor =
Expand Down Expand Up @@ -143,7 +143,7 @@ public class TableStreamSortOperatorTest {

@After
public void cleanUp() throws IOException {
cleanDir(sortTmpPrefixPath);
cleanDir(SORT_TMP_PREFIX_PATH);
}

@AfterClass
Expand Down Expand Up @@ -292,8 +292,8 @@ public void someInDiskTest2() {
int maxTsBlockSizeInBytes =
TSFileDescriptor.getInstance().getConfig().getMaxTsBlockSizeInBytes();
int maxTsBlockLineNumber = TSFileDescriptor.getInstance().getConfig().getMaxTsBlockLineNumber();
IoTDBDescriptor.getInstance().getConfig().setSortBufferSize(500);
TSFileDescriptor.getInstance().getConfig().setMaxTsBlockSizeInBytes(50);
IoTDBDescriptor.getInstance().getConfig().setSortBufferSize(1000);
TSFileDescriptor.getInstance().getConfig().setMaxTsBlockSizeInBytes(100);
TSFileDescriptor.getInstance().getConfig().setMaxTsBlockLineNumber(2);
try (TableStreamSortOperator tableStreamSortOperator = genStreamSortOperator(2)) {

Expand All @@ -303,7 +303,6 @@ public void someInDiskTest2() {
while (!tableStreamSortOperator.isFinished() && tableStreamSortOperator.hasNext()) {
TsBlock tsBlock = tableStreamSortOperator.next();
if (tsBlock != null && !tsBlock.isEmpty()) {
assertEquals(2, tsBlock.getPositionCount());
for (int i = 0, size = tsBlock.getPositionCount(); i < size; i++, count++) {
assertFalse(tsBlock.getColumn(0).isNull(i));
assertEquals(timeArray[count], tsBlock.getColumn(0).getLong(i));
Expand Down Expand Up @@ -560,7 +559,7 @@ public long ramBytesUsed() {

OperatorContext operatorContext = driverContext.getOperatorContexts().get(1);
String filePrefix =
sortTmpPrefixPath
SORT_TMP_PREFIX_PATH
+ File.separator
+ operatorContext
.getDriverContext()
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
<thrift.version>0.14.1</thrift.version>
<xz.version>1.9</xz.version>
<zstd-jni.version>1.5.6-3</zstd-jni.version>
<tsfile.version>2.1.0-250616-SNAPSHOT</tsfile.version>
<tsfile.version>2.1.0-250707-SNAPSHOT</tsfile.version>
</properties>
<!--
if we claim dependencies in dependencyManagement, then we do not claim
Expand Down
Loading