[IoTDB-468] Restructure QueryPlan#796
Conversation
qiaojialin
left a comment
There was a problem hiding this comment.
The QueryPlan looks nice now.
|
|
||
| public class AlignByDevicePlan extends QueryPlan { | ||
|
|
||
| private List<String> measurements; // for group by device sql, e.g. temperature |
There was a problem hiding this comment.
| private List<String> measurements; // for group by device sql, e.g. temperature | |
| private List<String> measurements; // e.g. temperature |
give a more complex example, such as m1, m2, m3
There was a problem hiding this comment.
What's the difference between this measurements with the paths in QueryPlan?
Refactor the organization or rename this field
There was a problem hiding this comment.
Actually, the paths in QueryPlan are paths of all devices. It's for verification and complete DataTypeMap to execute the datatypes for the execution paths this time in DataSet.
|
|
||
| private List<String> measurements; // for group by device sql, e.g. temperature | ||
| private Map<String, Set<String>> deviceToMeasurementsMap; // for group by device sql, e.g. root.ln.d1 -> temperature | ||
| private Map<String, TSDataType> dataTypeConsistencyChecker; // for group by device sql, e.g. root.ln.d1.temperature -> Float |
There was a problem hiding this comment.
| private Map<String, TSDataType> dataTypeConsistencyChecker; // for group by device sql, e.g. root.ln.d1.temperature -> Float | |
| private Map<String, TSDataType> seriesTypeMap; // e.g. root.ln.d1.temperature -> Float |
make the field name clear
There was a problem hiding this comment.
Add a comment to explain it.
|
|
||
| private GroupByPlan groupByPlan; | ||
| private FillQueryPlan fillQueryPlan; | ||
| private AggregationPlan aggregationPlan; |
There was a problem hiding this comment.
why there isn't a RawDataQueryPan
There was a problem hiding this comment.
Of course there isn't a RawDataQueryPan. We don't need parameters in it.
There was a problem hiding this comment.
but you need to do a RawData query for each device a
There was a problem hiding this comment.
I have added a RawDataQueryPlan in AlignByDeviceDataSet.
| //the measurements that have quotation mark. e.g., "abc", | ||
| // '11', the data type is considered as String and the value is considered is the same with measurement name | ||
| private List<String> constMeasurements = new ArrayList<>(); // for group by device sql | ||
| private List<Integer> positionOfConstMeasurements = new ArrayList<>(); // for group by device sql |
There was a problem hiding this comment.
put fields in the front of the class
| this.constMeasurements = alignByDevicePlan.getConstMeasurements(); | ||
| this.positionOfNotExistMeasurements = alignByDevicePlan.getPositionOfNotExistMeasurements(); | ||
| this.positionOfConstMeasurements = alignByDevicePlan.getPositionOfConstMeasurements(); | ||
| //BuildOutDataTypes(); |
| } else if (queryPlan instanceof FillQueryPlan) { | ||
| } else if (alignByDevicePlan.getFillQueryPlan() != null) { | ||
| this.dataSetType = DataSetType.FILL; | ||
| // assign parameters |
| //BuildOutDataTypes(); | ||
|
|
||
| if (queryPlan instanceof GroupByPlan) { | ||
| if (alignByDevicePlan.getGroupByPlan() != null) { |
There was a problem hiding this comment.
We could add a queryType in AlignByDevicePlan, and use switch here
| break; | ||
| case QUERY: | ||
| QueryPlan queryPlan = new QueryPlan(); | ||
| RawDataQueryPlan queryPlan = new RawDataQueryPlan(); |
There was a problem hiding this comment.
Don't you save three plans in AlignByDevicePlan? They could be reused
|
|
||
| private GroupByPlan groupByPlan; | ||
| private FillQueryPlan fillQueryPlan; | ||
| private AggregationPlan aggregationPlan; |
There was a problem hiding this comment.
but you need to do a RawData query for each device a
| super(); | ||
| } | ||
|
|
||
| public AlignByDevicePlan(boolean isQuery, Operator.OperatorType operatorType) { |
|
|
||
| public class GroupByPlan extends AggregationPlan { | ||
| public class | ||
| GroupByPlan extends AggregationPlan { |
|
|
||
| public class GroupByPlan extends AggregationPlan { | ||
| public class | ||
| GroupByPlan extends AggregationPlan { |
There was a problem hiding this comment.
| GroupByPlan extends AggregationPlan { | |
| GroupByTimePlan extends AggregationPlan { |
|
|
||
| private boolean isGroupByDevice = false; | ||
| private boolean isAlign = true; | ||
| private boolean isAlignByDevice = false; |
There was a problem hiding this comment.
| private boolean isAlignByDevice = false; | |
| private boolean alignByDevice = false; |
| private boolean isGroupByDevice = false; | ||
| private boolean isAlign = true; | ||
| private boolean isAlignByDevice = false; | ||
| private boolean isAlignByTime = true; |
There was a problem hiding this comment.
| private boolean isAlignByTime = true; | |
| private boolean alignByTime = true; |
There was a problem hiding this comment.
Just keep it please.
|
|
||
|
|
||
| /** | ||
| * This QueryDataSet is used for GROUP_BY_DEVICE query result. |
There was a problem hiding this comment.
| * This QueryDataSet is used for GROUP_BY_DEVICE query result. | |
| * This QueryDataSet is used for align by device query result. |
| @@ -80,45 +77,41 @@ public class DeviceIterateDataSet extends QueryDataSet { | |||
| private int[] currentColumnMapRelation; | |||
There was a problem hiding this comment.
how about renaming this class to AlignByDeviceDataset
There was a problem hiding this comment.
It's nice. I will rename it.
| break; | ||
| default: | ||
| this.dataSetType = DataSetType.QUERY; | ||
| this.rawDataQueryPlan = new RawDataQueryPlan(); |
There was a problem hiding this comment.
This logic is a little strange
The AlignByDevice query ( which is called groupByDevice before ) and general query aligning by time are both storaged in QueryPlan now. However, they invoke different query process bascially, so it's necessary to restructure the QueryPlan and seperate the AlignByDeviceQuery from it.
The QueryPlan is designed as base class, which has RawDataQueryPlan and AlignByDevicePlan as subclasses. This restructure may bring some usage changes, because the general query which uses QueryPlan directly before has to instantiate RawDataQueryPlan now.
If you think the design is not friendly to users, welcome to comment.