SteveYurongSu commented on a change in pull request #4453:
URL: https://github.com/apache/iotdb/pull/4453#discussion_r762829002
##########
File path: server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
##########
@@ -654,7 +655,7 @@ private TSExecuteStatementResp
internalExecuteQueryStatement(
TSExecuteStatementResp resp = null;
// execute it before createDataSet since it may change the content of
query plan
- if (plan instanceof QueryPlan && !(plan instanceof UDFPlan)) {
+ if (plan instanceof QueryPlan && !(plan instanceof UDFPlan) && !(plan
instanceof UDAFPlan)) {
Review comment:
UDAFPlan implements UDFPlan
##########
File path:
server/src/main/java/org/apache/iotdb/db/qp/physical/crud/UDAFPlan.java
##########
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iotdb.db.qp.physical.crud;
+
+import org.apache.iotdb.db.exception.metadata.MetadataException;
+import org.apache.iotdb.db.qp.logical.Operator.OperatorType;
+import org.apache.iotdb.db.qp.strategy.PhysicalGenerator;
+import org.apache.iotdb.db.query.expression.Expression;
+import org.apache.iotdb.db.query.expression.ResultColumn;
+
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+public class UDAFPlan extends RawDataQueryPlan {
Review comment:
```suggestion
public class UDAFPlan extends RawDataQueryPlan implements UDFPlan {
```
##########
File path:
server/src/main/java/org/apache/iotdb/db/query/expression/binary/BinaryExpression.java
##########
@@ -60,9 +68,24 @@ public boolean isConstantOperandInternal() {
@Override
public boolean isTimeSeriesGeneratingFunctionExpression() {
+ if (isUDAFExpression()) {
+ return false;
+ }
return true;
Review comment:
```suggestion
return !isUDAFExpression();
```
##########
File path: server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
##########
@@ -683,12 +684,14 @@ private TSExecuteStatementResp
internalExecuteQueryStatement(
if (plan instanceof ShowPlan || plan instanceof AuthorPlan) {
resp = getListDataSetHeaders(newDataSet);
} else if (plan instanceof UDFPlan
+ || plan instanceof UDAFPlan
Review comment:
UDAFPlan implements UDFPlan
##########
File path: server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
##########
@@ -860,6 +863,14 @@ private void getWideQueryHeaders(
}
seriesTypes = SchemaUtils.getSeriesTypesByPaths(paths, aggregations);
break;
+ case UDAF:
+ seriesTypes = new ArrayList<>();
+ UDAFPlan udafPlan = (UDAFPlan) plan;
Review comment:
It may be useless?
##########
File path:
server/src/main/java/org/apache/iotdb/db/query/executor/IQueryRouter.java
##########
@@ -44,6 +45,11 @@ QueryDataSet aggregate(AggregationPlan aggregationPlan,
QueryContext context)
throws QueryFilterOptimizationException, StorageEngineException,
IOException,
QueryProcessException;
+ /** Execute UDAF query. */
+ QueryDataSet udafQuery(UDAFPlan udafPlan, QueryContext context)
Review comment:
Can the plan be executed in cluster mode?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]