Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/base/master' into deletion
Browse files Browse the repository at this point in the history
# Conflicts:
#	iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/connector/protocol/airgap/IoTDBDataRegionAirGapConnector.java
  • Loading branch information
Pengzna committed Oct 18, 2024
2 parents 97b699d + a613422 commit 6d51a19
Show file tree
Hide file tree
Showing 210 changed files with 12,032 additions and 1,145 deletions.
8 changes: 8 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,11 @@ which is under Apache License 2.0:
./iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/LocalExecutionPlanner.java
./iotdb-core/tsfile/src/main/java/org/apache/iotdb/tsfile/read/common/block/*

--------------------------------------------------------------------------------

The following files include code modified from Apache Kafka project.

./iotdb-client/session/src/main/java/org/apache/iotdb/session/subscription/util/PollTimer.java

Project page: https://github.com/apache/kafka
License: http://www.apache.org/licenses/LICENSE-2.0
Original file line number Diff line number Diff line change
Expand Up @@ -887,4 +887,24 @@ public void testKind2CaseInCase() {
};
resultSetEqualTest(sql, expectedHeader, retArray);
}

@Test
public void testMultipleSatisfyCase() {
// Test the result when two when clause are satisfied
String sql =
"select case when s3 < 20 or s4 > 60 then \"just so so~~~\" when s3 > 20 or s4 < 60 then \"very well~~~\" end from root.sg.d2";
String[] expectedHeader =
new String[] {
TIMESTAMP_STR,
"CASE WHEN root.sg.d2.s3 < 20 | root.sg.d2.s4 > 60 THEN \"just so so~~~\" WHEN root.sg.d2.s3 > 20 | root.sg.d2.s4 < 60 THEN \"very well~~~\" END"
};
String[] retArray =
new String[] {
"0,just so so~~~,",
"1000000,just so so~~~,",
"20000000,just so so~~~,",
"210000000,just so so~~~,",
};
resultSetEqualTest(sql, expectedHeader, retArray);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -611,28 +611,28 @@ public void upsertTest() {

@Test
public void alterDuplicateAliasTest() {
try (Connection connection = EnvFactory.getEnv().getConnection();
Statement statement = connection.createStatement()) {
try (final Connection connection = EnvFactory.getEnv().getConnection();
final Statement statement = connection.createStatement()) {
statement.execute(
"create timeseries root.turbine.d1.s1(a1) with datatype=FLOAT, encoding=RLE, compression=SNAPPY;");
statement.execute("create timeseries root.turbine.d1.s2 with datatype=INT32, encoding=RLE;");
try {
statement.execute("alter timeseries root.turbine.d1.s2 upsert alias=s1;");
fail();
} catch (Exception e) {
} catch (final Exception e) {
assertTrue(
e.getMessage()
.contains("The alias is duplicated with the name or alias of other measurement."));
.contains("The alias is duplicated with the name or alias of other measurement"));
}
try {
statement.execute("alter timeseries root.turbine.d1.s2 upsert alias=a1;");
fail();
} catch (Exception e) {
} catch (final Exception e) {
assertTrue(
e.getMessage()
.contains("The alias is duplicated with the name or alias of other measurement."));
.contains("The alias is duplicated with the name or alias of other measurement"));
}
} catch (Exception e) {
} catch (final Exception e) {
e.printStackTrace();
fail();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,17 @@ public class IoTDBMultiIDsWithAttributesTableIT {
"CREATE DATABASE db",
"USE db",
"CREATE TABLE table0 (device string id, level string id, attr1 string attribute, attr2 string attribute, num int32 measurement, bigNum int64 measurement, "
+ "floatNum double measurement, str TEXT measurement, bool BOOLEAN measurement, date DATE measurement)",
+ "floatNum double measurement, str TEXT measurement, bool BOOLEAN measurement, date DATE measurement, blob BLOB measurement, ts TIMESTAMP measurement, stringV STRING measurement)",
"insert into table0(device, level, attr1, attr2, time,num,bigNum,floatNum,str,bool) values('d1', 'l1', 'c', 'd', 0,3,2947483648,231.2121,'coconut',FALSE)",
"insert into table0(device, level, attr1, attr2, time,num,bigNum,floatNum,str,bool) values('d1', 'l2', 'y', 'z', 20,2,2147483648,434.12,'pineapple',TRUE)",
"insert into table0(device, level, attr1, attr2, time,num,bigNum,floatNum,str,bool,blob,ts) values('d1', 'l2', 'y', 'z', 20,2,2147483648,434.12,'pineapple',TRUE,X'108DCD62',2024-09-24T06:15:35.000+00:00)",
"insert into table0(device, level, attr1, attr2, time,num,bigNum,floatNum,str,bool) values('d1', 'l3', 't', 'a', 40,1,2247483648,12.123,'apricot',TRUE)",
"insert into table0(device, level, time,num,bigNum,floatNum,str,bool) values('d1', 'l4', 80,9,2147483646,43.12,'apple',FALSE)",
"insert into table0(device, level, time,num,bigNum,floatNum,str,bool) values('d1', 'l5', 100,8,2147483964,4654.231,'papaya',TRUE)",
"insert into table0(device, level, time,num,bigNum,floatNum,str,bool) values('d1', 'l1', 31536000000,6,2147483650,1231.21,'banana',TRUE)",
"insert into table0(device, level, time,num,bigNum,floatNum,str,bool) values('d1', 'l2',31536000100,10,3147483648,231.55,'pumelo',FALSE)",
"insert into table0(device,level, time,num,bigNum,floatNum,str,bool) values('d1', 'l3',31536000500,4,2147493648,213.1,'peach',FALSE)",
"insert into table0(device, level, time,num,bigNum,floatNum,str,bool) values('d1', 'l4',31536001000,5,2149783648,56.32,'orange',FALSE)",
"insert into table0(device, level, time,num,bigNum,floatNum,str,bool) values('d1', 'l5',31536010000,7,2147983648,213.112,'lemon',TRUE)",
"insert into table0(device, level, time,num,bigNum,floatNum,str,bool,blob,ts,stringV) values('d1', 'l4',31536001000,5,2149783648,56.32,'orange',FALSE,X'108DCD62',2024-09-15T06:15:35.000+00:00,'test-string1')",
"insert into table0(device, level, time,num,bigNum,floatNum,str,bool,blob,ts) values('d1', 'l5',31536010000,7,2147983648,213.112,'lemon',TRUE,X'108DCD63',2024-09-25T06:15:35.000+00:00)",
"insert into table0(device, level, time,num,bigNum,floatNum,str,bool) values('d1', 'l1',31536100000,11,2147468648,54.121,'pitaya',FALSE)",
"insert into table0(device,level,attr1,attr2,time,num,bigNum,floatNum,str,bool) values('d2','l1','d','c',0,3,2947483648,231.2121,'coconut',FALSE)",
"insert into table0(device,level,attr1,time,num,bigNum,floatNum,str,bool) values('d2','l2', 'vv', 31536000100,10,3147483648,231.55,'pumelo',FALSE)",
Expand All @@ -72,14 +72,14 @@ public class IoTDBMultiIDsWithAttributesTableIT {
new String[] {
"insert into table0(device,level,time,num,bigNum,floatNum,str,bool) values('d2','l2',20,2,2147483648,434.12,'pineapple',TRUE)",
"insert into table0(device,level,time,num,bigNum,floatNum,str,bool) values('d2','l3',40,1,2247483648,12.123,'apricot',TRUE)",
"insert into table0(device,level,time,num,bigNum,floatNum,str,bool) values('d2','l4',80,9,2147483646,43.12,'apple',FALSE)",
"insert into table0(device,level,time,num,bigNum,floatNum,str,bool,blob,ts,stringV) values('d2','l4',80,9,2147483646,43.12,'apple',FALSE,X'108DCD63',2024-09-20T06:15:35.000+00:00,'test-string2')",
"insert into table0(device,level,time,num,bigNum,floatNum,str,bool) values('d2','l5',100,8,2147483964,4654.231,'papaya',TRUE)",
"insert into table0(device,level,time,num,bigNum,floatNum,str,bool) values('d2','l1',31536000000,6,2147483650,1231.21,'banana',TRUE)",
"insert into table0(device,level,time,num,bigNum,floatNum,str,bool) values('d2','l3',31536000500,4,2147493648,213.1,'peach',FALSE)",
"insert into table0(device,level,time,num,bigNum,floatNum,str,bool) values('d2','l4',31536001000,5,2149783648,56.32,'orange',FALSE)",
"insert into table0(device,level,time,num,bigNum,floatNum,str,bool) values('d2','l5',31536010000,7,2147983648,213.112,'lemon',TRUE)",
"flush",
"insert into table0(device,level,time,num,bigNum,floatNum,str,bool) values('d2','l1',31536100000,11,2147468648,54.121,'pitaya',FALSE)",
"insert into table0(device,level,time,num,bigNum,floatNum,str,bool,ts,StringV) values('d2','l1',31536100000,11,2147468648,54.121,'pitaya',FALSE,2024-08-01T06:15:35.000+00:00,'test-string3')",
"insert into table0(device,level,time,num,bigNum,floatNum,str,bool) values('d2','l2',41536000000,12,2146483648,45.231,'strawberry',FALSE)",
"insert into table0(device,level,time,num,bigNum,floatNum,str,bool) values('d2','l3',41536000020,14,2907483648,231.34,'cherry',FALSE)",
"insert into table0(device,level,time,num,bigNum,floatNum,str,bool) values('d2','l4',41536900000,13,2107483648,54.12,'lychee',TRUE)",
Expand Down Expand Up @@ -933,6 +933,62 @@ public void aggregationNoDataTest() {
tableResultSetEqualTest(sql, expectedHeader, retArray, DATABASE_NAME);
}

@Test
public void lastFirstMaxMinTest() {
expectedHeader =
new String[] {
"_col0", "_col1", "_col2", "_col3", "_col4", "_col5", "_col6", "_col7", "_col8", "_col9",
"_col10", "_col11", "_col12", "_col13",
};
retArray =
new String[] {
"1971-04-26T18:01:40.000Z,d1,l4,null,null,13,2107483648,54.12,lychee,true,null,0x108dcd62,2024-09-15T06:15:35.000Z,test-string1,",
};
sql =
"select last(time),last(device),last(level),last(attr1),last(attr2),last(num),last(bignum),last(floatnum),last(str),last(bool),last(date),last(blob),last(ts),last(stringv) from table0 where device='d1' and level='l4'";
tableResultSetEqualTest(sql, expectedHeader, retArray, DATABASE_NAME);
retArray =
new String[] {
"1970-01-01T00:00:00.080Z,d1,l4,null,null,9,2147483646,43.12,apple,false,null,0x108dcd62,2024-09-15T06:15:35.000Z,test-string1,",
};
sql =
"select first(time),first(device),first(level),first(attr1),first(attr2),first(num),first(bignum),first(floatnum),first(str),first(bool),first(date),first(blob),first(ts),first(stringv) from table0 where device='d1' and level='l4'";
tableResultSetEqualTest(sql, expectedHeader, retArray, DATABASE_NAME);

expectedHeader =
new String[] {
"_col0", "_col1", "_col2", "_col3", "_col4", "_col5",
};
retArray =
new String[] {
"15,3147483648,4654.231,1,2107483648,12.123,",
};
sql =
"select max(num),max(bignum),max(floatnum),min(num),min(bignum),min(floatnum) from table0";
tableResultSetEqualTest(sql, expectedHeader, retArray, DATABASE_NAME);

expectedHeader =
new String[] {
"device", "level", "_col2", "_col3", "_col4", "_col5", "_col6", "_col7",
};
retArray =
new String[] {
"d1,l1,11,2947483648,1231.21,3,2147468648,54.121,",
"d1,l2,12,3147483648,434.12,2,2146483648,45.231,",
"d1,l3,14,2907483648,231.34,1,2147493648,12.123,",
"d1,l4,13,2149783648,56.32,5,2107483648,43.12,",
"d1,l5,15,3147483648,4654.231,7,2147483964,213.112,",
"d2,l1,11,2947483648,1231.21,3,2147468648,54.121,",
"d2,l2,12,3147483648,434.12,2,2146483648,45.231,",
"d2,l3,14,2907483648,231.34,1,2147493648,12.123,",
"d2,l4,13,2149783648,56.32,5,2107483648,43.12,",
"d2,l5,15,3147483648,4654.231,7,2147483964,213.112,",
};
sql =
"select device,level,max(num),max(bignum),max(floatnum),min(num),min(bignum),min(floatnum) from table0 group by device,level order by device,level";
tableResultSetEqualTest(sql, expectedHeader, retArray, DATABASE_NAME);
}

// ==================================================================
// ============================ Join Test ===========================
// ==================================================================
Expand Down
Loading

0 comments on commit 6d51a19

Please sign in to comment.