@@ -126,28 +126,20 @@ public void setUp() throws MetadataException, IOException, WriteProcessException
126126 new Symbol ("time" ),
127127 new ColumnSchema (
128128 "time" , TypeFactory .getType (TSDataType .INT64 ), false , TsTableColumnCategory .TIME ));
129- columnSchemaMap .put (
130- new Symbol ("sensor0" ),
131- new ColumnSchema (
132- "sensor0" , TypeFactory .getType (TSDataType .INT32 ), false , TsTableColumnCategory .FIELD ));
133- columnSchemaMap .put (
134- new Symbol ("sensor1" ),
135- new ColumnSchema (
136- "sensor1" , TypeFactory .getType (TSDataType .INT32 ), false , TsTableColumnCategory .FIELD ));
137- columnSchemaMap .put (
138- new Symbol ("sensor2" ),
139- new ColumnSchema (
140- "sensor2" , TypeFactory .getType (TSDataType .INT32 ), false , TsTableColumnCategory .FIELD ));
141- columnSchemaMap .put (
142- new Symbol ("sensor3" ),
143- new ColumnSchema (
144- "sensor3" , TypeFactory .getType (TSDataType .INT32 ), false , TsTableColumnCategory .FIELD ));
129+ for (int i = 0 ; i < 10000 ; i ++) {
130+ columnSchemaMap .put (
131+ new Symbol ("sensor" + i ),
132+ new ColumnSchema (
133+ "sensor" + i ,
134+ TypeFactory .getType (TSDataType .INT32 ),
135+ false ,
136+ TsTableColumnCategory .FIELD ));
137+ }
145138
146139 Map <Symbol , Type > symbolTSDataTypeMap = new HashMap <>();
147- symbolTSDataTypeMap .put (new Symbol ("sensor0" ), TypeFactory .getType (TSDataType .INT32 ));
148- symbolTSDataTypeMap .put (new Symbol ("sensor1" ), TypeFactory .getType (TSDataType .INT32 ));
149- symbolTSDataTypeMap .put (new Symbol ("sensor2" ), TypeFactory .getType (TSDataType .INT32 ));
150- symbolTSDataTypeMap .put (new Symbol ("sensor3" ), TypeFactory .getType (TSDataType .INT32 ));
140+ for (int i = 0 ; i < 10000 ; i ++) {
141+ symbolTSDataTypeMap .put (new Symbol ("sensor" + i ), TypeFactory .getType (TSDataType .INT32 ));
142+ }
151143 symbolTSDataTypeMap .put (new Symbol ("time" ), TypeFactory .getType (TypeEnum .INT64 ));
152144 symbolTSDataTypeMap .put (new Symbol ("tag1" ), TypeFactory .getType (TSDataType .TEXT ));
153145 typeProvider = new TypeProvider (symbolTSDataTypeMap );
@@ -158,10 +150,9 @@ public void setUp() throws MetadataException, IOException, WriteProcessException
158150 tsTable .addColumnSchema (new TagColumnSchema ("id_column" , TSDataType .STRING ));
159151 tsTable .addColumnSchema (new TimeColumnSchema ("time" , TSDataType .INT64 ));
160152 tsTable .addColumnSchema (new TagColumnSchema ("tag1" , TSDataType .TEXT ));
161- tsTable .addColumnSchema (new FieldColumnSchema ("sensor0" , TSDataType .INT32 ));
162- tsTable .addColumnSchema (new FieldColumnSchema ("sensor1" , TSDataType .INT32 ));
163- tsTable .addColumnSchema (new FieldColumnSchema ("sensor2" , TSDataType .INT32 ));
164- tsTable .addColumnSchema (new FieldColumnSchema ("sensor3" , TSDataType .INT32 ));
153+ for (int i = 0 ; i < 10000 ; i ++) {
154+ tsTable .addColumnSchema (new FieldColumnSchema ("sensor" + i , TSDataType .INT32 ));
155+ }
165156 tsTable .addProp (TsTable .TTL_PROPERTY , Long .MAX_VALUE + "" );
166157 tsTable .addProp (
167158 TreeViewSchema .TREE_PATH_PATTERN ,
@@ -176,6 +167,36 @@ public void tearDown() throws IOException {
176167 SeriesReaderTestUtil .tearDown (seqResources , unSeqResources );
177168 }
178169
170+ @ Test
171+ public void testQueryManyDevices () throws Exception {
172+ List <String > outputColumnList = new ArrayList <>(10000 + 2 );
173+ TreeNonAlignedDeviceViewScanNode node = getTreeNonAlignedDeviceViewScanNode (outputColumnList );
174+ node .setPushDownOffset (500 );
175+ node .setPushDownLimit (500 );
176+ node .setPushDownPredicate (
177+ new ComparisonExpression (
178+ ComparisonExpression .Operator .GREATER_THAN ,
179+ new Symbol ("sensor1" ).toSymbolReference (),
180+ new LongLiteral ("1000" )));
181+ for (int i = 0 ; i < 10000 ; i ++) {
182+ outputColumnList .add ("sensor" + i );
183+ }
184+ outputColumnList .add ("time" );
185+ outputColumnList .add ("tag1" );
186+ ExecutorService instanceNotificationExecutor =
187+ IoTDBThreadPoolFactory .newFixedThreadPool (1 , "test-instance-notification" );
188+ Operator operator = getOperator (node , instanceNotificationExecutor );
189+ try {
190+ assertTrue (operator instanceof DeviceIteratorScanOperator );
191+ } catch (Exception e ) {
192+ e .printStackTrace ();
193+ fail (e .getMessage ());
194+ } finally {
195+ operator .close ();
196+ instanceNotificationExecutor .shutdown ();
197+ }
198+ }
199+
179200 @ Test
180201 public void testScanWithPushDownPredicateAndLimitAndOffset () throws Exception {
181202 List <String > outputColumnList = Arrays .asList ("sensor0" , "sensor1" , "sensor2" , "time" , "tag1" );
0 commit comments