CRZbulabula commented on code in PR #9665:
URL: https://github.com/apache/iotdb/pull/9665#discussion_r1172554759
##########
antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4:
##########
@@ -447,23 +447,36 @@ showConfigNodes
// ---- Get Region Id
getRegionId
- : SHOW (DATA|SCHEMA) REGIONID OF path=prefixPath WHERE (SERIESSLOTID
operator_eq
- seriesSlot=INTEGER_LITERAL|DEVICEID operator_eq deviceId=prefixPath)
(OPERATOR_AND (TIMESLOTID operator_eq timeSlot=INTEGER_LITERAL|
- TIMESTAMP operator_eq timeStamp=INTEGER_LITERAL))?
+ : SHOW (DATA|SCHEMA) REGIONID WHERE (DATABASE operator_eq
database=prefixPath
+ |(DEVICE|DEVICEID) operator_eq device=prefixPath)
Review Comment:
```suggestion
| DEVICE operator_eq device=prefixPath)
```
"DEVICEID" will be strange because we only accept input device=prefixPath
##########
confignode/src/main/java/org/apache/iotdb/confignode/manager/IManager.java:
##########
@@ -629,9 +631,11 @@ TDataPartitionTableResp getOrCreateDataPartition(
TGetRegionIdResp getRegionId(TGetRegionIdReq req);
- TGetTimeSlotListResp getTimeSlotList(GetTimeSlotListPlan plan);
+ TGetTimeSlotListResp getTimeSlotList(TGetTimeSlotListReq req);
- TGetSeriesSlotListResp getSeriesSlotList(GetSeriesSlotListPlan plan);
+ TCountTimeSlotListResp countTimeSlotList(TCountTimeSlotListReq req);
+
+ TGetSeriesSlotListResp getSeriesSlotList(TGetSeriesSlotListReq req);
Review Comment:
Add function annotations for these interfaces
##########
server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/CountTimeSlotListStatement.java:
##########
@@ -0,0 +1,107 @@
+/*
+ * 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.mpp.plan.statement.metadata;
+
+import org.apache.iotdb.commons.exception.IllegalPathException;
+import org.apache.iotdb.commons.path.PartialPath;
+import org.apache.iotdb.db.mpp.plan.analyze.QueryType;
+import org.apache.iotdb.db.mpp.plan.statement.IConfigStatement;
+import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public class CountTimeSlotListStatement extends Statement implements
IConfigStatement {
+
+ private String database;
+
+ private String device;
+
+ private long regionId = -1;
+
+ private long startTime = -1;
+
+ private long endTime = -1;
+
+ public CountTimeSlotListStatement() {
+ super();
+ }
+
+ public void setDatabase(String database) {
+ this.database = database;
+ }
+
+ public String getDatabase() {
+ return database;
+ }
+
+ public long getStartTime() {
+ return startTime;
+ }
+
+ public void setStartTime(long startTime) {
+ this.startTime = startTime;
+ }
+
+ public long getEndTime() {
+ return endTime;
+ }
+
+ public void setEndTime(long endTime) {
+ this.endTime = endTime;
+ }
+
+ public void setDevice(String device) {
+ this.device = device;
+ }
+
+ public String getDevice() {
+ return this.device;
+ }
+
+ public void setRegionId(long regionId) {
+ this.regionId = regionId;
+ }
+
+ public long getRegionId() {
+ return this.regionId;
+ }
+
+ @Override
+ public <R, C> R accept(StatementVisitor<R, C> visitor, C context) {
+ return visitor.visitCountTimeSlotList(this, context);
+ }
+
+ @Override
+ public QueryType getQueryType() {
+ return QueryType.READ;
+ }
+
+ @Override
+ public List<PartialPath> getPaths() {
+ try {
+ return Collections.singletonList(new PartialPath(database));
+ } catch (IllegalPathException | NullPointerException e) {
+ return new ArrayList<>();
+ }
Review Comment:
```suggestion
if (database == null) {
return new ArrayList<>();
}
try {
return Collections.singletonList(new PartialPath(database));
} catch (IllegalPathException e) {
/** Throw or log IllegalPathException here */
return new ArrayList<>();
}
```
##########
antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4:
##########
@@ -447,23 +447,36 @@ showConfigNodes
// ---- Get Region Id
getRegionId
- : SHOW (DATA|SCHEMA) REGIONID OF path=prefixPath WHERE (SERIESSLOTID
operator_eq
- seriesSlot=INTEGER_LITERAL|DEVICEID operator_eq deviceId=prefixPath)
(OPERATOR_AND (TIMESLOTID operator_eq timeSlot=INTEGER_LITERAL|
- TIMESTAMP operator_eq timeStamp=INTEGER_LITERAL))?
+ : SHOW (DATA|SCHEMA) REGIONID WHERE (DATABASE operator_eq
database=prefixPath
+ |(DEVICE|DEVICEID) operator_eq device=prefixPath)
+ (OPERATOR_AND (TIMESTAMP|TIME) operator_eq time = timeValue)?
;
// ---- Get Time Slot List
getTimeSlotList
- : SHOW TIMESLOTID OF path=prefixPath WHERE SERIESSLOTID operator_eq
seriesSlot=INTEGER_LITERAL
+ : SHOW (TIMESLOTID|TIMEPARTITION) WHERE ((DEVICE|DEVICEID) operator_eq
device=prefixPath
Review Comment:
```suggestion
: SHOW (TIMESLOTID|TIMEPARTITION) WHERE (DEVICE operator_eq
device=prefixPath
```
The same as above
##########
confignode/pom.xml:
##########
@@ -69,6 +69,10 @@
<artifactId>powermock-api-mockito2</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ </dependency>
Review Comment:
What is this dependency for?
##########
server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/GetTimeSlotListStatement.java:
##########
@@ -93,8 +108,8 @@ public QueryType getQueryType() {
@Override
public List<PartialPath> getPaths() {
try {
- return Collections.singletonList(new PartialPath(storageGroup));
- } catch (IllegalPathException e) {
+ return Collections.singletonList(new PartialPath(database));
+ } catch (IllegalPathException | NullPointerException e) {
return new ArrayList<>();
Review Comment:
The same as above
##########
server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/GetRegionIdStatement.java:
##########
@@ -115,8 +94,8 @@ public QueryType getQueryType() {
@Override
public List<PartialPath> getPaths() {
try {
- return Collections.singletonList(new PartialPath(storageGroup));
- } catch (IllegalPathException e) {
+ return Collections.singletonList(new PartialPath(database));
+ } catch (IllegalPathException | NullPointerException e) {
return new ArrayList<>();
}
Review Comment:
The same as above
--
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]