Skip to content
Merged
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 @@ -351,6 +351,11 @@ public void test() throws Exception {
"select * from (select time, battery as device1 from view1 where battery = 'b1') as t1 full outer join (select time, battery as device2 from view2 where battery = 'b') as t2 using(time)",
"select * from (select time, battery as device1 from table1 where battery = 'b1') as t1 full outer join (select time, battery as device2 from table1 where battery = 'b') as t2 using(time)",
true);
compareQueryResults(
session,
"select * from (select * from view1 where battery = 'b1') join (select * from view1 where battery = 'b1' and (voltage > 0 or current > 0)) using(time)",
"select * from (select * from table1 where battery = 'b1') join (select * from table1 where battery = 'b1' and (voltage > 0 or current > 0)) using(time)",
true);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ public Operator visitTreeNonAlignedDeviceViewScan(
List<IMeasurementSchema> measurementSchemas = commonParameter.measurementSchemas;
List<String> measurementColumnNames = commonParameter.measurementColumnNames;
List<ColumnSchema> fullColumnSchemas = commonParameter.columnSchemas;
List<Symbol> symbolInputs = commonParameter.symbolInputs;
int[] columnsIndexArray = commonParameter.columnsIndexArray;

boolean isSingleColumn = measurementSchemas.size() == 1;
Expand Down Expand Up @@ -816,7 +817,8 @@ private Operator getFilterAndProjectOperator(Operator childOperator) {
for (int i = 0; i < fullColumnSchemas.size(); i++) {
ColumnSchema columnSchema = fullColumnSchemas.get(i);
symbolInputLocationMap
.computeIfAbsent(new Symbol(columnSchema.getName()), key -> new ArrayList<>())
.computeIfAbsent(
new Symbol(symbolInputs.get(i).getName()), key -> new ArrayList<>())
.add(new InputLocation(0, i));
inputDataTypeList.add(getTSDataType(columnSchema.getType()));
}
Expand Down Expand Up @@ -868,6 +870,7 @@ private static class CommonTableScanOperatorParameters {

List<Symbol> outputColumnNames;
List<ColumnSchema> columnSchemas;
List<Symbol> symbolInputs;
int[] columnsIndexArray;
Map<Symbol, ColumnSchema> columnSchemaMap;
Map<Symbol, Integer> tagAndAttributeColumnsIndexMap;
Expand All @@ -886,6 +889,7 @@ private CommonTableScanOperatorParameters(
int outputColumnCount =
keepNonOutputMeasurementColumns ? node.getAssignments().size() : outputColumnNames.size();
columnSchemas = new ArrayList<>(outputColumnCount);
symbolInputs = new ArrayList<>(outputColumnCount);
columnsIndexArray = new int[outputColumnCount];
columnSchemaMap = node.getAssignments();
tagAndAttributeColumnsIndexMap = node.getTagAndAttributeIndexMap();
Expand All @@ -900,6 +904,7 @@ private CommonTableScanOperatorParameters(
ColumnSchema schema =
requireNonNull(columnSchemaMap.get(columnName), columnName + " is null");

symbolInputs.add(columnName);
switch (schema.getColumnCategory()) {
case TAG:
case ATTRIBUTE:
Expand Down Expand Up @@ -938,6 +943,7 @@ private CommonTableScanOperatorParameters(
if (keepNonOutputMeasurementColumns) {
columnSchemas.add(entry.getValue());
columnsIndexArray[idx++] = measurementColumnCount;
symbolInputs.add(entry.getKey());
}
measurementColumnCount++;
String realMeasurementName =
Expand All @@ -952,13 +958,12 @@ private CommonTableScanOperatorParameters(
} else if (entry.getValue().getColumnCategory() == TIME) {
timeColumnName = entry.getKey().getName();
// for non aligned series table view scan, here the time column will not be obtained
// through
// this structure, but we need to ensure that the length of columnSchemas is consistent
// with
// the length of columnsIndexArray
// through this structure, but we need to ensure that the length of columnSchemas is
// consistent with the length of columnsIndexArray
if (keepNonOutputMeasurementColumns && !addedTimeColumn) {
columnSchemas.add(entry.getValue());
columnsIndexArray[idx++] = -1;
symbolInputs.add(entry.getKey());
}
}
}
Expand Down
Loading