Skip to content
Open
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 @@ -203,13 +203,13 @@ public void testMismatchedDataTypes() {
"The output type of the expression in WHERE clause should be BOOLEAN, actual data type: DOUBLE.");
assertTestFail(
"select count(s1) from root.sg1.d1 group by ([0, 40), 5ms) having count(s1) + 1;",
"The output type of the expression in HAVING clause should be BOOLEAN, actual data type: DOUBLE.");
"The output type of the expression in HAVING clause should be BOOLEAN, actual data type: INT64.");
assertTestFail(
"select s1 from root.sg1.d1 where s1 align by device;",
"The output type of the expression in WHERE clause should be BOOLEAN, actual data type: DOUBLE.");
assertTestFail(
"select count(s1) from root.sg1.d1 group by ([0, 40), 5ms) having count(s1) + 1 align by device;",
"The output type of the expression in HAVING clause should be BOOLEAN, actual data type: DOUBLE.");
"The output type of the expression in HAVING clause should be BOOLEAN, actual data type: INT64.");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,10 +496,10 @@ public void testDistributiveLaw() {
Assert.assertTrue(rs.next());
Assert.assertEquals(i, rs.getLong(1));
Assert.assertEquals(i, rs.getInt(2));
Assert.assertEquals(2 * i + 2.0D, rs.getDouble(3), 0.01);
Assert.assertEquals(2 * i + 2.0D, rs.getDouble(4), 0.01);
Assert.assertEquals(i / 2.0D + 0.5D, rs.getDouble(5), 0.01);
Assert.assertEquals((i / 2) + 1 / 2, rs.getDouble(6), 0.01);
Assert.assertEquals((i + 1) * 2, rs.getLong(3));
Assert.assertEquals(i * 2 + 1 * 2, rs.getLong(4));
Assert.assertEquals((i + 1) / 2, rs.getLong(5));
Assert.assertEquals(i / 2 + 1 / 2, rs.getLong(6));
}
Assert.assertFalse(rs.next());
}
Expand All @@ -524,9 +524,9 @@ public void testOrderOfArithmeticOperations() {
for (int i = 1; i <= ITERATION_TIMES; i++) {
Assert.assertTrue(rs.next());
Assert.assertEquals(i, rs.getLong(1));
Assert.assertEquals(2 * i + 2.0D, rs.getDouble(2), 0.01);
Assert.assertEquals(2 * i + 3.0D, rs.getDouble(3), 0.01);
Assert.assertEquals(3 * i + 3.0D, rs.getDouble(4), 0.01);
Assert.assertEquals(1 + i * 2 + 1, rs.getLong(2));
Assert.assertEquals((1 + i) * 2 + 1, rs.getLong(3));
Assert.assertEquals((1 + i) * (2 + 1), rs.getLong(4));
}
Assert.assertFalse(rs.next());
}
Expand All @@ -536,9 +536,9 @@ public void testOrderOfArithmeticOperations() {
for (int i = 1; i <= ITERATION_TIMES; i++) {
Assert.assertTrue(rs.next());
Assert.assertEquals(i, rs.getLong(1));
Assert.assertEquals(1.0D - i / 2 + 1, rs.getDouble(2), 0.01);
Assert.assertEquals(1.5 - i / 2.0D, rs.getDouble(3), 0.01);
Assert.assertEquals((1.0D / 3.0D) * (1.0D - i), rs.getDouble(4), 0.01);
Assert.assertEquals(1 - i / 2 + 1, rs.getLong(2));
Assert.assertEquals((1 - i) / 2 + 1, rs.getLong(3));
Assert.assertEquals((1 - i) / (2 + 1), rs.getLong(4));
}
Assert.assertFalse(rs.next());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ public void testMaxByWithExpression() {
"max_by(root.db.d1.x5, -cos(sin(root.db.d1.y2 / 10)))",
"max_by(REPLACE(root.db.d1.x6, '3', '4'), -cos(sin(root.db.d1.y2 / 10)))",
};
String[] retArray = new String[] {"0.0,1.3333333333333333,2.0,2.0,false,2,"};
String[] retArray = new String[] {"0,1,2.0,2.0,false,2,"};
String y = "-cos(sin(y2 / 10))";
resultSetEqualTest(
String.format(
Expand Down Expand Up @@ -330,10 +330,7 @@ public void testMaxByWithAlignByDevice() {
"max_by(REPLACE(x6, '3', '4'), -cos(sin(y2 / 10)))",
};
String[] retArray =
new String[] {
"root.db.d1,0.0,1.3333333333333333,2.0,2.0,false,2,",
"root.db.d2,0.0,1.3333333333333333,2.0,2.0,false,2,"
};
new String[] {"root.db.d1,0,1,2.0,2.0,false,2,", "root.db.d2,0,1,2.0,2.0,false,2,"};
String y = "-cos(sin(y2 / 10))";
resultSetEqualTest(
String.format(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ public void testMaxByWithExpression() {
"min_by(root.db.d1.x5, -cos(sin(root.db.d1.y2 / 10)))",
"min_by(REPLACE(root.db.d1.x6, '3', '4'), -cos(sin(root.db.d1.y2 / 10)))",
};
String[] retArray = new String[] {"0.0,1.3333333333333333,2.0,2.0,false,2,"};
String[] retArray = new String[] {"0,1,2.0,2.0,false,2,"};
String y = "-cos(sin(y2 / 10))";
resultSetEqualTest(
String.format(
Expand Down Expand Up @@ -329,10 +329,7 @@ public void testMaxByWithAlignByDevice() {
"min_by(REPLACE(x6, '3', '4'), -cos(sin(y2 / 10)))",
};
String[] retArray =
new String[] {
"root.db.d1,0.0,1.3333333333333333,2.0,2.0,false,2,",
"root.db.d2,0.0,1.3333333333333333,2.0,2.0,false,2,"
};
new String[] {"root.db.d1,0,1,2.0,2.0,false,2,", "root.db.d2,0,1,2.0,2.0,false,2,"};
String y = "-cos(sin(y2 / 10))";
resultSetEqualTest(
String.format(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,19 +217,19 @@ public void filterTest() {
new String[] {"Device,max_time(s1),count(s1),last_value(s2),count(s1) + last_value(s3)"};
retArray =
new String[] {
"root.sg1.d2,1314000000001,4,false,1319.0,",
"root.sg1.d3,1314000000002,2,false,1318.0,",
"root.sg1.d4,5,1,false,5556.0,",
"root.sg1.d2,1314000000001,4,false,1319,",
"root.sg1.d3,1314000000002,2,false,1318,",
"root.sg1.d4,5,1,false,5556,",
};
resultSetEqualTest(
"SELECT max_time(s1), count(s1), last_value(s2), count(s1)+last_value(s3) FROM root.sg1.** where s3+1=1316 or s2=false having avg(s1)+sum(s3)>5 align by device;",
expectedHeader,
retArray);
retArray =
new String[] {
"root.sg2.d2,1314000000001,4,false,1319.0,",
"root.sg2.d3,1314000000002,2,false,1318.0,",
"root.sg2.d4,5,1,false,5556.0,",
"root.sg2.d2,1314000000001,4,false,1319,",
"root.sg2.d3,1314000000002,2,false,1318,",
"root.sg2.d4,5,1,false,5556,",
};
resultSetEqualTest(
"SELECT max_time(s1), count(s1), last_value(s2), count(s1)+last_value(s3) FROM root.sg2.** where s3+1=1316 or s2=false having avg(s1)+sum(s3)>5 align by device;",
Expand Down Expand Up @@ -650,15 +650,15 @@ public void wildCardTest() {
expectedHeader = new String[] {"Device,count(s3) + 1,count(s1) + 1,count(s2) + 1"};
retArray =
new String[] {
"root.sg1.d2,5.0,5.0,5.0,",
"root.sg1.d2,5,5,5,",
};
resultSetEqualTest(
"SELECT count(*)+1 FROM root.sg1.** where s2=false having count(s3+s1) > 2 align by device;",
expectedHeader,
retArray);
retArray =
new String[] {
"root.sg2.d2,5.0,5.0,5.0,",
"root.sg2.d2,5,5,5,",
};
resultSetEqualTest(
"SELECT count(*)+1 FROM root.sg2.** where s2=false having count(s3+s1) > 2 align by device;",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,23 +114,23 @@ public void testAlignedRawDataAlignByTime2() {
String expectedHeader1 = "Time,root.sg1.d1.s2,root.sg1.d1.s3 + 1,";
String[] retArray1 =
new String[] {
"3,null,30001.0,",
"13,130000,130001.0,",
"16,16,17.0,",
"17,17,18.0,",
"18,18,19.0,",
"19,19,20.0,",
"20,20,21.0,",
"21,null,22.0,",
"22,null,23.0,",
"23,null,230001.0,",
"24,null,25.0,",
"25,null,26.0,",
"26,null,27.0,",
"27,null,28.0,",
"28,null,29.0,",
"29,null,30.0,",
"30,null,31.0,",
"3,null,30001,",
"13,130000,130001,",
"16,16,17,",
"17,17,18,",
"18,18,19,",
"19,19,20,",
"20,20,21,",
"21,null,22,",
"22,null,23,",
"23,null,230001,",
"24,null,25,",
"25,null,26,",
"26,null,27,",
"27,null,28,",
"28,null,29,",
"29,null,30,",
"30,null,31,",
};
resultSetEqualTest(
"select s2, s3 + 1 from root.sg1.d1 where s3 + 1 > 16", expectedHeader1, retArray1);
Expand Down Expand Up @@ -536,38 +536,38 @@ public void testRawDataAlignByDevice2() {
String expectedHeader = "Time,Device,s2,s3 + 1,";
String[] retArray =
new String[] {
"3,root.sg1.d1,null,30001.0,",
"13,root.sg1.d1,130000,130001.0,",
"16,root.sg1.d1,16,17.0,",
"17,root.sg1.d1,17,18.0,",
"18,root.sg1.d1,18,19.0,",
"19,root.sg1.d1,19,20.0,",
"20,root.sg1.d1,20,21.0,",
"21,root.sg1.d1,null,22.0,",
"22,root.sg1.d1,null,23.0,",
"23,root.sg1.d1,null,230001.0,",
"24,root.sg1.d1,null,25.0,",
"25,root.sg1.d1,null,26.0,",
"26,root.sg1.d1,null,27.0,",
"27,root.sg1.d1,null,28.0,",
"28,root.sg1.d1,null,29.0,",
"29,root.sg1.d1,null,30.0,",
"30,root.sg1.d1,null,31.0,",
"16,root.sg1.d2,16,17.0,",
"17,root.sg1.d2,17,18.0,",
"18,root.sg1.d2,18,19.0,",
"19,root.sg1.d2,19,20.0,",
"20,root.sg1.d2,20,21.0,",
"21,root.sg1.d2,null,22.0,",
"22,root.sg1.d2,null,23.0,",
"23,root.sg1.d2,null,24.0,",
"24,root.sg1.d2,null,25.0,",
"25,root.sg1.d2,null,26.0,",
"26,root.sg1.d2,null,27.0,",
"27,root.sg1.d2,null,28.0,",
"28,root.sg1.d2,null,29.0,",
"29,root.sg1.d2,null,30.0,",
"30,root.sg1.d2,null,31.0,",
"3,root.sg1.d1,null,30001,",
"13,root.sg1.d1,130000,130001,",
"16,root.sg1.d1,16,17,",
"17,root.sg1.d1,17,18,",
"18,root.sg1.d1,18,19,",
"19,root.sg1.d1,19,20,",
"20,root.sg1.d1,20,21,",
"21,root.sg1.d1,null,22,",
"22,root.sg1.d1,null,23,",
"23,root.sg1.d1,null,230001,",
"24,root.sg1.d1,null,25,",
"25,root.sg1.d1,null,26,",
"26,root.sg1.d1,null,27,",
"27,root.sg1.d1,null,28,",
"28,root.sg1.d1,null,29,",
"29,root.sg1.d1,null,30,",
"30,root.sg1.d1,null,31,",
"16,root.sg1.d2,16,17,",
"17,root.sg1.d2,17,18,",
"18,root.sg1.d2,18,19,",
"19,root.sg1.d2,19,20,",
"20,root.sg1.d2,20,21,",
"21,root.sg1.d2,null,22,",
"22,root.sg1.d2,null,23,",
"23,root.sg1.d2,null,24,",
"24,root.sg1.d2,null,25,",
"25,root.sg1.d2,null,26,",
"26,root.sg1.d2,null,27,",
"27,root.sg1.d2,null,28,",
"28,root.sg1.d2,null,29,",
"29,root.sg1.d2,null,30,",
"30,root.sg1.d2,null,31,",
};
resultSetEqualTest(
"select s2, s3 + 1 from root.sg1.d1, root.sg1.d2 where s3 + 1 > 16 align by device",
Expand Down
Loading