You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by "Wei-hao-Li (via GitHub)" <gi...@apache.org> on 2023/03/08 08:19:32 UTC
[GitHub] [iotdb] Wei-hao-Li opened a new pull request, #9242: [IOTDB-5644] NPE when there are no select expressions after analyzed in align by device query
Wei-hao-Li opened a new pull request, #9242:
URL: https://github.com/apache/iotdb/pull/9242
cause: the device has no measurement to compute in select, but was planned because it has measurement in `where/having/groupBy`
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] liuminghui233 merged pull request #9242: [IOTDB-5644] Fix unexpected result when there are no select expressions after analyzed in query
Posted by "liuminghui233 (via GitHub)" <gi...@apache.org>.
liuminghui233 merged PR #9242:
URL: https://github.com/apache/iotdb/pull/9242
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] liuminghui233 commented on a diff in pull request #9242: [IOTDB-5644] Fix unexpected result when there are no select expressions after analyzed in query
Posted by "liuminghui233 (via GitHub)" <gi...@apache.org>.
liuminghui233 commented on code in PR #9242:
URL: https://github.com/apache/iotdb/pull/9242#discussion_r1130360403
##########
server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/AnalyzeVisitor.java:
##########
@@ -303,6 +307,9 @@ public Analysis visitQuery(QueryStatement queryStatement, MPPQueryContext contex
} else {
Map<Integer, List<Pair<Expression, String>>> outputExpressionMap =
analyzeSelect(analysis, queryStatement, schemaTree);
+ if (outputExpressionMap.values().stream().allMatch(List::isEmpty)) {
+ return finishQuery(analysis);
+ }
Review Comment:
It's better to check `outputExpressions` below. That way we don't need to traverse the outputExpressionMap twice.
##########
server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/AnalyzeVisitor.java:
##########
@@ -350,6 +357,11 @@ public Analysis visitQuery(QueryStatement queryStatement, MPPQueryContext contex
return analysis;
}
+ private Analysis finishQuery(Analysis analysis) {
+ analysis.setFinishQueryAfterAnalyze(true);
Review Comment:
We need to set empty headers in different formats.
```suggestion
if (queryStatement.isSelectInto()) {
analysis.setRespDatasetHeader(
DatasetHeaderFactory.getSelectIntoHeader(queryStatement.isAlignByDevice()));
}
if (queryStatement.isLastQuery()) {
analysis.setRespDatasetHeader(DatasetHeaderFactory.getLastQueryHeader());
}
analysis.setFinishQueryAfterAnalyze(true);
```
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org