You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/subquery/SubqueryDataSetUtils.java
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -110,6 +110,10 @@ public class SubqueryDataSetUtils {
110
110
"INSERT INTO table3(time,device_id,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values (2024-09-24T06:14:30.000+00:00,'d01',40,40,40.0,40.0,false,'shanghai_huangpu_red_A_d01_40','shanghai_huangpu_red_A_d01_40',X'cafebabe40',2024-09-24T06:14:00.000+00:00,'2024-09-24')",
111
111
"INSERT INTO table3(time,device_id,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values (2024-09-24T06:13:30.000+00:00,'d_null',30,30,30.0,30.0,true,'shanghai_huangpu_red_A_d01_30','shanghai_huangpu_red_A_d01_30',X'cafebabe30',2024-09-24T06:13:00.000+00:00,'2024-09-23')",
112
112
"INSERT INTO table3(time,device_id,s2,s3,s4,s5,s6,s7,s8,s9,s10) values (2024-09-24T06:14:30.000+00:00,'d_null',40,40.0,40.0,false,'shanghai_huangpu_red_A_d01_40','shanghai_huangpu_red_A_d01_40',X'cafebabe40',2024-09-24T06:14:00.000+00:00,'2024-09-24')",
113
+
// table4
114
+
"CREATE TABLE IF NOT EXISTS table4(region STRING TAG, remark STRING ATTRIBUTE, name TEXT FIELD)",
115
+
"INSERT INTO table4 values(1, 'R001', 'good', 'Mary')",
116
+
"INSERT INTO table4 values(2, 'R002', 'bad', 'Tom')",
Copy file name to clipboardExpand all lines: integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/subquery/uncorrelated/IoTDBUncorrelatedScalarSubqueryIT.java
+5Lines changed: 5 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -265,6 +265,11 @@ public void testScalarSubqueryAfterComparisonLegalityCheck() {
265
265
"701: Scalar sub-query has returned multiple rows.",
266
266
DATABASE_NAME);
267
267
268
+
tableAssertTestFail(
269
+
"select s1 from table1 where time = (select time from table4)",
270
+
"701: Scalar sub-query has returned multiple rows.",
271
+
DATABASE_NAME);
272
+
268
273
// Legality check: subquery can not be parsed
269
274
tableAssertTestFail(
270
275
"select s1 from table1 where s1 = (select s1 from)", "mismatched input", DATABASE_NAME);
Copy file name to clipboardExpand all lines: iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/ir/PredicateWithUncorrelatedScalarSubqueryReconstructor.java
+35-26Lines changed: 35 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -162,6 +162,9 @@ public Optional<Literal> fetchUncorrelatedSubqueryResultForPredicate(
162
162
returnOptional.empty();
163
163
}
164
164
165
+
Columncolumn = null;
166
+
TSDataTypedataType = null;
167
+
introwCount = 0;
165
168
while (coordinator.getQueryExecution(queryId).hasNextResult()) {
166
169
finalOptional<TsBlock> tsBlock;
167
170
try {
@@ -174,40 +177,46 @@ public Optional<Literal> fetchUncorrelatedSubqueryResultForPredicate(
0 commit comments