You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2021/03/18 07:26:43 UTC
[shardingsphere] branch master updated: create
ExecuteProcessContext (#9721)
This is an automated email from the ASF dual-hosted git repository.
zhangyonglun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 13e53a0 create ExecuteProcessContext (#9721)
13e53a0 is described below
commit 13e53a072670a881c45c900f365983fa259a5ead
Author: Juan Pan(Trista) <pa...@apache.org>
AuthorDate: Thu Mar 18 15:26:16 2021 +0800
create ExecuteProcessContext (#9721)
---
.../process/ExecuteProcessStrategyEvaluator.java | 2 +-
.../sql/process/model/ExecuteProcessContext.java | 52 ++++++++++++++++++++++
2 files changed, 53 insertions(+), 1 deletion(-)
diff --git a/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/process/ExecuteProcessStrategyEvaluator.java b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/process/ExecuteProcessStrategyEvaluator.java
index b76ed27..f7e7e90 100644
--- a/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/process/ExecuteProcessStrategyEvaluator.java
+++ b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/process/ExecuteProcessStrategyEvaluator.java
@@ -38,6 +38,6 @@ public final class ExecuteProcessStrategyEvaluator {
*/
public static boolean evaluate(final SQLStatementContext<?> context, final ExecutionGroupContext<? extends SQLExecutionUnit> executionGroupContext) {
// TODO : Add more conditions to evaluate whether to submit this process task or not
- return true;
+ return false;
}
}
diff --git a/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/process/model/ExecuteProcessContext.java b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/process/model/ExecuteProcessContext.java
new file mode 100644
index 0000000..2123b31
--- /dev/null
+++ b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/process/model/ExecuteProcessContext.java
@@ -0,0 +1,52 @@
+/*
+ * 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.shardingsphere.infra.executor.sql.process.model;
+
+import lombok.Getter;
+import org.apache.shardingsphere.infra.executor.kernel.model.ExecutionGroup;
+import org.apache.shardingsphere.infra.executor.kernel.model.ExecutionGroupContext;
+import org.apache.shardingsphere.infra.executor.sql.execute.engine.SQLExecutionUnit;
+
+import java.util.Collection;
+import java.util.LinkedList;
+
+/**
+ * Execute process context.
+ */
+@Getter
+public final class ExecuteProcessContext {
+
+ private final String executionID;
+
+ private final Collection<ExecuteProcessUnit> unitStatuses;
+
+ public ExecuteProcessContext(final ExecutionGroupContext<SQLExecutionUnit> executionGroupContext) {
+ this.executionID = executionGroupContext.getExecutionID();
+ unitStatuses = createExecutionUnitStatuses(executionGroupContext);
+ }
+
+ private Collection<ExecuteProcessUnit> createExecutionUnitStatuses(final ExecutionGroupContext<SQLExecutionUnit> executionGroupContext) {
+ Collection<ExecuteProcessUnit> result = new LinkedList<>();
+ for (ExecutionGroup<SQLExecutionUnit> group : executionGroupContext.getInputGroups()) {
+ for (SQLExecutionUnit each : group.getInputs()) {
+ result.add(new ExecuteProcessUnit(String.valueOf(each.getExecutionUnit().hashCode()), ExecuteProcessConstants.EXECUTE_STATUS_START));
+ }
+ }
+ return result;
+ }
+}