Alima777 commented on a change in pull request #2478: URL: https://github.com/apache/iotdb/pull/2478#discussion_r557251411
########## File path: server/src/main/java/org/apache/iotdb/db/qp/logical/crud/GroupByQueryOperator.java ########## @@ -0,0 +1,87 @@ +/* + * 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.logical.crud; + +import org.apache.iotdb.db.exception.query.QueryProcessException; +import org.apache.iotdb.db.qp.constant.SQLConstant; +import org.apache.iotdb.db.qp.physical.PhysicalPlan; +import org.apache.iotdb.db.qp.physical.crud.GroupByTimePlan; + +public class GroupByQueryOperator extends QueryOperator { + + // time interval + private long unit; + // sliding step + private long slidingStep; + // if it is left close and right open interval + private boolean leftCRightO; + + + public GroupByQueryOperator() { + super(SQLConstant.TOK_QUERY); + } + + @Override + public PhysicalPlan transform2PhysicalPlan(int fetchSize) throws QueryProcessException { + GroupByTimePlan plan = new GroupByTimePlan(); + convert(plan); + return plan; + } + + protected void convert(GroupByTimePlan plan) { Review comment: `convert` -> `setPlanValues` ? ########## File path: server/src/main/java/org/apache/iotdb/db/qp/sql/IoTDBSqlVisitor.java ########## @@ -1106,7 +1111,8 @@ public Operator visitGroupByFillStatement(GroupByFillStatementContext ctx) { @Override public Operator visitFillStatement(FillStatementContext ctx) { - parseFillClause(ctx.fillClause(), queryOp); + queryOp = new FillQueryOperator(); + parseFillClause(ctx.fillClause(), (FillQueryOperator) queryOp); Review comment: The same. ########## File path: server/src/main/java/org/apache/iotdb/db/qp/sql/IoTDBSqlVisitor.java ########## @@ -1094,7 +1098,8 @@ public Operator visitGroupByTimeStatement(GroupByTimeStatementContext ctx) { @Override public Operator visitGroupByFillStatement(GroupByFillStatementContext ctx) { - parseGroupByFillClause(ctx.groupByFillClause(), queryOp); + queryOp = new GroupByFillQueryOperator(); + parseGroupByFillClause(ctx.groupByFillClause(), (GroupByFillQueryOperator) queryOp); Review comment: Put the constructor inside is better. ```suggestion queryOp = parseGroupByFillClause(ctx.groupByFillClause()); ``` ########## File path: server/src/main/java/org/apache/iotdb/db/qp/sql/IoTDBSqlVisitor.java ########## @@ -1328,41 +1329,41 @@ public void parseSoffsetClause(SoffsetClauseContext ctx, QueryOperator queryOp) queryOp.setSeriesOffset(soffset); } - private void parseGroupByTimeClause(GroupByTimeClauseContext ctx, QueryOperator queryOp) { - queryOp.setGroupByTime(true); - queryOp.setLeftCRightO(ctx.timeInterval().LS_BRACKET() != null); + private GroupByQueryOperator parseGroupByTimeClause(GroupByTimeClauseContext ctx) { + GroupByQueryOperator op; Review comment: Like this, I think this way is better. ########## File path: server/src/main/java/org/apache/iotdb/db/qp/sql/IoTDBSqlVisitor.java ########## @@ -1133,7 +1139,8 @@ public Operator visitAlignByDeviceStatementOrDisableAlignInSpecialClause( @Override public Operator visitGroupByLevelStatement(GroupByLevelStatementContext ctx) { - parseGroupByLevelClause(ctx.groupByLevelClause(), queryOp); + queryOp = new GroupByLevelQueryOperator(); + parseGroupByLevelClause(ctx.groupByLevelClause(), (GroupByLevelQueryOperator) queryOp); Review comment: The same. ---------------------------------------------------------------- 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]
