You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by hu...@apache.org on 2022/10/25 07:04:16 UTC

[iotdb] 01/04: add cq related statements

This is an automated email from the ASF dual-hosted git repository.

hui pushed a commit to branch lmh/mppCQ
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 274e80518ae8d0803445f58e70fd86a2b9736120
Author: Minghui Liu <li...@foxmail.com>
AuthorDate: Tue Oct 25 10:10:55 2022 +0800

    add cq related statements
---
 .../metadata/CreateContinuousQueryStatement.java   | 121 +++++++++++++++++++++
 .../metadata/DropContinuousQueryStatement.java     |  54 +++++++++
 .../metadata/ShowContinuousQueriesStatement.java   |  46 ++++++++
 3 files changed, 221 insertions(+)

diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/CreateContinuousQueryStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/CreateContinuousQueryStatement.java
new file mode 100644
index 0000000000..01589fc5d8
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/CreateContinuousQueryStatement.java
@@ -0,0 +1,121 @@
+/*
+ * 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.cq.TimeoutPolicy;
+import org.apache.iotdb.commons.path.PartialPath;
+import org.apache.iotdb.db.mpp.plan.analyze.QueryType;
+import org.apache.iotdb.db.mpp.plan.constant.StatementType;
+import org.apache.iotdb.db.mpp.plan.statement.IConfigStatement;
+import org.apache.iotdb.db.mpp.plan.statement.Statement;
+
+import java.util.Collections;
+import java.util.List;
+
+public class CreateContinuousQueryStatement extends Statement implements IConfigStatement {
+
+  private String cqId;
+  private long everyInterval;
+  private long boundaryTime;
+  private long startTimeOffset;
+  private long endTimeOffset;
+  private TimeoutPolicy timeoutPolicy;
+  private String queryBody;
+  private String sql;
+
+  public CreateContinuousQueryStatement() {
+    super();
+    statementType = StatementType.CREATE_CONTINUOUS_QUERY;
+  }
+
+  public String getCqId() {
+    return cqId;
+  }
+
+  public void setCqId(String cqId) {
+    this.cqId = cqId;
+  }
+
+  public long getEveryInterval() {
+    return everyInterval;
+  }
+
+  public void setEveryInterval(long everyInterval) {
+    this.everyInterval = everyInterval;
+  }
+
+  public long getBoundaryTime() {
+    return boundaryTime;
+  }
+
+  public void setBoundaryTime(long boundaryTime) {
+    this.boundaryTime = boundaryTime;
+  }
+
+  public long getStartTimeOffset() {
+    return startTimeOffset;
+  }
+
+  public void setStartTimeOffset(long startTimeOffset) {
+    this.startTimeOffset = startTimeOffset;
+  }
+
+  public long getEndTimeOffset() {
+    return endTimeOffset;
+  }
+
+  public void setEndTimeOffset(long endTimeOffset) {
+    this.endTimeOffset = endTimeOffset;
+  }
+
+  public TimeoutPolicy getTimeoutPolicy() {
+    return timeoutPolicy;
+  }
+
+  public void setTimeoutPolicy(TimeoutPolicy timeoutPolicy) {
+    this.timeoutPolicy = timeoutPolicy;
+  }
+
+  public String getQueryBody() {
+    return queryBody;
+  }
+
+  public void setQueryBody(String queryBody) {
+    this.queryBody = queryBody;
+  }
+
+  public String getSql() {
+    return sql;
+  }
+
+  public void setSql(String sql) {
+    this.sql = sql;
+  }
+
+  @Override
+  public QueryType getQueryType() {
+    return QueryType.WRITE;
+  }
+
+  @Override
+  public List<? extends PartialPath> getPaths() {
+    return Collections.emptyList();
+  }
+}
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/DropContinuousQueryStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/DropContinuousQueryStatement.java
new file mode 100644
index 0000000000..fe35672421
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/DropContinuousQueryStatement.java
@@ -0,0 +1,54 @@
+/*
+ * 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.path.PartialPath;
+import org.apache.iotdb.db.mpp.plan.analyze.QueryType;
+import org.apache.iotdb.db.mpp.plan.constant.StatementType;
+import org.apache.iotdb.db.mpp.plan.statement.IConfigStatement;
+import org.apache.iotdb.db.mpp.plan.statement.Statement;
+
+import java.util.Collections;
+import java.util.List;
+
+public class DropContinuousQueryStatement extends Statement implements IConfigStatement {
+
+  private final String cqId;
+
+  public DropContinuousQueryStatement(String cqId) {
+    super();
+    statementType = StatementType.DROP_CONTINUOUS_QUERY;
+    this.cqId = cqId;
+  }
+
+  public String getCqId() {
+    return cqId;
+  }
+
+  @Override
+  public QueryType getQueryType() {
+    return QueryType.WRITE;
+  }
+
+  @Override
+  public List<? extends PartialPath> getPaths() {
+    return Collections.emptyList();
+  }
+}
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/ShowContinuousQueriesStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/ShowContinuousQueriesStatement.java
new file mode 100644
index 0000000000..94edcdd8d5
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/ShowContinuousQueriesStatement.java
@@ -0,0 +1,46 @@
+/*
+ * 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.path.PartialPath;
+import org.apache.iotdb.db.mpp.plan.analyze.QueryType;
+import org.apache.iotdb.db.mpp.plan.constant.StatementType;
+import org.apache.iotdb.db.mpp.plan.statement.IConfigStatement;
+
+import java.util.Collections;
+import java.util.List;
+
+public class ShowContinuousQueriesStatement extends ShowStatement implements IConfigStatement {
+
+  public ShowContinuousQueriesStatement() {
+    super();
+    statementType = StatementType.SHOW_CONTINUOUS_QUERIES;
+  }
+
+  @Override
+  public QueryType getQueryType() {
+    return QueryType.READ;
+  }
+
+  @Override
+  public List<PartialPath> getPaths() {
+    return Collections.emptyList();
+  }
+}