liutaohua commented on a change in pull request #1731:
URL: https://github.com/apache/incubator-iotdb/pull/1731#discussion_r490812091
##########
File path: server/src/main/java/org/apache/iotdb/db/utils/QueryUtils.java
##########
@@ -166,26 +157,28 @@ public static QueryDataSet
getQueryDataSet(List<ShowTimeSeriesResult> timeseries
List<RowRecord> records = new ArrayList<>();
List<PartialPath> paths = new ArrayList<>();
List<TSDataType> dataTypes = new ArrayList<>();
- constructPathAndDataTypes(paths, dataTypes, timeseriesList);
+ constructPathAndDataTypes(paths, dataTypes);
for (ShowTimeSeriesResult result : timeseriesList) {
RowRecord record = new RowRecord(0);
updateRecord(record, result.getName());
updateRecord(record, result.getAlias());
updateRecord(record, result.getSgName());
- updateRecord(record, result.getDataType());
- updateRecord(record, result.getEncoding());
- updateRecord(record, result.getCompressor());
- updateRecord(record, result.getTagAndAttribute(), paths);
+ updateRecord(record, result.getDataType().toString());
+ updateRecord(record, result.getEncoding().toString());
+ updateRecord(record, result.getCompressor().toString());
Review comment:
same
##########
File path: server/src/main/java/org/apache/iotdb/db/utils/QueryUtils.java
##########
@@ -112,36 +122,16 @@ public static void filterQueryDataSource(QueryDataSource
queryDataSource,
unseqResources.removeIf(fileFilter::fileNotSatisfy);
}
- public static void constructPathAndDataTypes(List<PartialPath> paths,
List<TSDataType> dataTypes,
- List<ShowTimeSeriesResult> timeseriesList) {
- paths.add(new PartialPath(COLUMN_TIMESERIES, false));
- dataTypes.add(TSDataType.TEXT);
- paths.add(new PartialPath(COLUMN_TIMESERIES_ALIAS, false));
- dataTypes.add(TSDataType.TEXT);
- paths.add(new PartialPath(COLUMN_STORAGE_GROUP, false));
- dataTypes.add(TSDataType.TEXT);
- paths.add(new PartialPath(COLUMN_TIMESERIES_DATATYPE, false));
- dataTypes.add(TSDataType.TEXT);
- paths.add(new PartialPath(COLUMN_TIMESERIES_ENCODING, false));
- dataTypes.add(TSDataType.TEXT);
- paths.add(new PartialPath(COLUMN_TIMESERIES_COMPRESSION, false));
- dataTypes.add(TSDataType.TEXT);
-
- Set<String> tagAndAttributeName = new TreeSet<>();
- for (ShowTimeSeriesResult result : timeseriesList) {
- tagAndAttributeName.addAll(result.getTagAndAttribute().keySet());
- }
- for (String key : tagAndAttributeName) {
- paths.add(new PartialPath(key, false));
- dataTypes.add(TSDataType.TEXT);
- }
+ public static void constructPathAndDataTypes(List<PartialPath> paths,
List<TSDataType> dataTypes) {
+ Collections.addAll(paths, resourcePaths);
+ Collections.addAll(dataTypes, resourceTypes);
}
public static QueryDataSet getQueryDataSet(List<ShowTimeSeriesResult>
timeseriesList,
ShowTimeSeriesPlan showTimeSeriesPlan, QueryContext context) {
List<PartialPath> paths = new ArrayList<>();
List<TSDataType> dataTypes = new ArrayList<>();
- constructPathAndDataTypes(paths, dataTypes, timeseriesList);
+ constructPathAndDataTypes(paths, dataTypes);
Review comment:
I think that `constructPath` and `updateRecord` behavior belongs to
`Dataset`, how about move it to `ShowTimeseriesDataSet ` class?
and next line , the `showTimeSeriesPlan` already exists in dataset...
@qiaojialin what do you think?
##########
File path: server/src/main/java/org/apache/iotdb/db/utils/QueryUtils.java
##########
@@ -152,10 +142,11 @@ public static QueryDataSet
getQueryDataSet(List<ShowTimeSeriesResult> timeseries
updateRecord(record, result.getName());
updateRecord(record, result.getAlias());
updateRecord(record, result.getSgName());
- updateRecord(record, result.getDataType());
- updateRecord(record, result.getEncoding());
- updateRecord(record, result.getCompressor());
- updateRecord(record, result.getTagAndAttribute(), paths);
+ updateRecord(record, result.getDataType().toString());
+ updateRecord(record, result.getEncoding().toString());
+ updateRecord(record, result.getCompressor().toString());
Review comment:
i think that too many type cast , how about used only in
`serialize/deserialize`.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]