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 @@ -226,6 +226,22 @@ public void testCompareWithNull() {
"select s1 from sg1 where s1 = null", new String[] {"s1"}, new String[] {}, DATABASE_NAME);
}

@Test
public void testCountDevicesWithFunctionOnTag() {
// The tag position in the device path depends on the depth of the view's path prefix:
// root.sg1.** has two levels and root.vehicle.testNaN.** has three.
tableResultSetEqualTest(
"count devices from sg1 where upper(device) = 'D1'",
new String[] {"count(devices)"},
new String[] {"1,"},
DATABASE_NAME);
tableResultSetEqualTest(
"count devices from testNaN where upper(device) = 'D1'",
new String[] {"count(devices)"},
new String[] {"1,"},
DATABASE_NAME);
}

@Test
public void testCalculateWithNull() {
tableResultSetEqualTest(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
import org.apache.iotdb.calc.transformation.dag.column.ColumnTransformer;
import org.apache.iotdb.calc.transformation.dag.column.leaf.LeafColumnTransformer;
import org.apache.iotdb.commons.exception.MetadataException;
import org.apache.iotdb.commons.schema.table.TreeViewSchema;
import org.apache.iotdb.commons.schema.table.TsTable;
import org.apache.iotdb.commons.schema.table.column.TsTableColumnSchema;
import org.apache.iotdb.commons.utils.PathUtils;
import org.apache.iotdb.db.schemaengine.schemaregion.read.resp.info.IDeviceSchemaInfo;
import org.apache.iotdb.db.schemaengine.table.DataNodeTreeViewSchemaUtils;

Expand Down Expand Up @@ -73,9 +73,9 @@ protected DevicePredicateHandler(
.map(TsTableColumnSchema::getDataType)
.collect(Collectors.toList());
this.tagIndex =
PathUtils.isTableModelDatabase(database)
? 3
: DataNodeTreeViewSchemaUtils.getPatternNodes(table).length;
TreeViewSchema.isTreeViewTable(table)
? DataNodeTreeViewSchemaUtils.getPatternNodes(table).length
: 3;
}

public void addBatch(final IDeviceSchemaInfo deviceSchemaInfo) {
Expand Down