You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2017/12/19 12:18:16 UTC
[19/31] ignite git commit: Old approach to new classes.
Old approach to new classes.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7a9cd6ac
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7a9cd6ac
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7a9cd6ac
Branch: refs/heads/ignite-6022-proto
Commit: 7a9cd6acee77aad378c41ad52f096489afc5c543
Parents: 94aabda
Author: devozerov <vo...@gridgain.com>
Authored: Mon Dec 18 11:31:18 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Mon Dec 18 11:31:18 2017 +0300
----------------------------------------------------------------------
.../query/h2/DmlStatementsProcessor.java | 6 +-
.../query/h2/dml/FastUpdateArgument.java | 27 ------
.../query/h2/dml/FastUpdateArguments.java | 93 --------------------
.../processors/query/h2/dml/UpdatePlan.java | 6 +-
.../query/h2/dml/UpdatePlanBuilder.java | 16 ++--
5 files changed, 11 insertions(+), 137 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7a9cd6ac/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java
index 8de756c..4ca034e 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java
@@ -48,11 +48,11 @@ import org.apache.ignite.internal.processors.query.GridQueryCancel;
import org.apache.ignite.internal.processors.query.GridQueryFieldsResult;
import org.apache.ignite.internal.processors.query.GridQueryFieldsResultAdapter;
import org.apache.ignite.internal.processors.query.IgniteSQLException;
+import org.apache.ignite.internal.processors.query.h2.dml.DmlArgument;
import org.apache.ignite.internal.processors.query.h2.dml.DmlBatchSender;
import org.apache.ignite.internal.processors.query.h2.dml.DmlDistributedPlanInfo;
import org.apache.ignite.internal.processors.query.h2.dml.DmlUtils;
import org.apache.ignite.internal.processors.query.h2.dml.FastUpdate;
-import org.apache.ignite.internal.processors.query.h2.dml.FastUpdateArgument;
import org.apache.ignite.internal.processors.query.h2.dml.UpdateMode;
import org.apache.ignite.internal.processors.query.h2.dml.UpdatePlan;
import org.apache.ignite.internal.processors.query.h2.dml.UpdatePlanBuilder;
@@ -421,11 +421,11 @@ public class DmlStatementsProcessor {
GridH2RowDescriptor desc = plan.table().rowDescriptor();
- for (List<FastUpdateArgument> argRow : plan.rows()) {
+ for (List<DmlArgument> argRow : plan.rows()) {
List<Object> row = new ArrayList<>();
for (int j = 0; j < plan.columnNames().length; j++) {
- Object colVal = argRow.get(j).apply(args);
+ Object colVal = argRow.get(j).get(args);
if (j == plan.keyColumnIndex() || j == plan.valueColumnIndex())
colVal = DmlUtils.convert(colVal, desc, j == plan.keyColumnIndex() ? desc.type().keyClass() :
http://git-wip-us.apache.org/repos/asf/ignite/blob/7a9cd6ac/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/FastUpdateArgument.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/FastUpdateArgument.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/FastUpdateArgument.java
deleted file mode 100644
index dc90fe9..0000000
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/FastUpdateArgument.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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.ignite.internal.processors.query.h2.dml;
-
-import org.apache.ignite.internal.util.lang.GridPlainClosure;
-
-/**
- * Operand for fast UPDATE or DELETE (single item operation that does not involve any SELECT).
- */
-public interface FastUpdateArgument extends GridPlainClosure<Object[], Object> {
- // No-op.
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7a9cd6ac/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/FastUpdateArguments.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/FastUpdateArguments.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/FastUpdateArguments.java
deleted file mode 100644
index c7a45a3..0000000
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/FastUpdateArguments.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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.ignite.internal.processors.query.h2.dml;
-
-import org.apache.ignite.IgniteCheckedException;
-
-/**
- * Arguments for fast, query-less UPDATE or DELETE - key and, optionally, value and new value.
- */
-public final class FastUpdateArguments {
- /** Operand to compute key. */
- public final FastUpdateArgument key;
-
- /** Operand to compute value. */
- public final FastUpdateArgument val;
-
- /** Operand to compute new value. */
- public final FastUpdateArgument newVal;
-
- /** */
- public FastUpdateArguments(FastUpdateArgument key, FastUpdateArgument val, FastUpdateArgument newVal) {
- assert key != null;
- assert val != null;
- assert newVal != null;
-
- this.key = key;
- this.val = val;
- this.newVal = newVal;
- }
-
- /**
- * Simple constant value based operand.
- */
- public final static class ValueArgument implements FastUpdateArgument {
- /** Value to return. */
- private final Object val;
-
- /**
- * Constructor.
- *
- * @param val Value.
- */
- public ValueArgument(Object val) {
- this.val = val;
- }
-
- /** {@inheritDoc} */
- @Override public Object apply(Object[] arg) throws IgniteCheckedException {
- return val;
- }
- }
-
- /**
- * User given param value operand.
- */
- public final static class ParamArgument implements FastUpdateArgument {
- /** Index of param to take. */
- private final int paramIdx;
-
- /**
- * Constructor.
- *
- * @param paramIdx Parameter index.
- */
- public ParamArgument(int paramIdx) {
- assert paramIdx >= 0;
-
- this.paramIdx = paramIdx;
- }
-
- /** {@inheritDoc} */
- @Override public Object apply(Object[] arg) throws IgniteCheckedException {
- assert arg.length > paramIdx;
-
- return arg[paramIdx];
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7a9cd6ac/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/UpdatePlan.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/UpdatePlan.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/UpdatePlan.java
index b1b5ada..f33331a 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/UpdatePlan.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/UpdatePlan.java
@@ -74,7 +74,7 @@ public final class UpdatePlan {
private final boolean isLocSubqry;
/** Rows for query-less MERGE or INSERT. */
- private final List<List<FastUpdateArgument>> rows;
+ private final List<List<DmlArgument>> rows;
/** Number of rows in rows based MERGE or INSERT. */
private final int rowsNum;
@@ -114,7 +114,7 @@ public final class UpdatePlan {
int valColIdx,
String selectQry,
boolean isLocSubqry,
- List<List<FastUpdateArgument>> rows,
+ List<List<DmlArgument>> rows,
int rowsNum,
@Nullable FastUpdate fastUpdate,
@Nullable DmlDistributedPlanInfo distributed
@@ -410,7 +410,7 @@ public final class UpdatePlan {
/**
* @return Rows for query-less MERGE or INSERT.
*/
- public List<List<FastUpdateArgument>> rows() {
+ public List<List<DmlArgument>> rows() {
return rows;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7a9cd6ac/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/UpdatePlanBuilder.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/UpdatePlanBuilder.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/UpdatePlanBuilder.java
index d04cea9..bbbff17 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/UpdatePlanBuilder.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/UpdatePlanBuilder.java
@@ -42,12 +42,10 @@ import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing;
import org.apache.ignite.internal.processors.query.h2.opt.GridH2RowDescriptor;
import org.apache.ignite.internal.processors.query.h2.opt.GridH2Table;
import org.apache.ignite.internal.processors.query.h2.sql.GridSqlColumn;
-import org.apache.ignite.internal.processors.query.h2.sql.GridSqlConst;
import org.apache.ignite.internal.processors.query.h2.sql.GridSqlDelete;
import org.apache.ignite.internal.processors.query.h2.sql.GridSqlElement;
import org.apache.ignite.internal.processors.query.h2.sql.GridSqlInsert;
import org.apache.ignite.internal.processors.query.h2.sql.GridSqlMerge;
-import org.apache.ignite.internal.processors.query.h2.sql.GridSqlParameter;
import org.apache.ignite.internal.processors.query.h2.sql.GridSqlQuery;
import org.apache.ignite.internal.processors.query.h2.sql.GridSqlQueryParser;
import org.apache.ignite.internal.processors.query.h2.sql.GridSqlQuerySplitter;
@@ -132,7 +130,7 @@ public final class UpdatePlanBuilder {
List<GridSqlElement[]> elRows = null;
- List<List<FastUpdateArgument>> rows = null;
+ List<List<DmlArgument>> rows = null;
if (stmt instanceof GridSqlInsert) {
GridSqlInsert ins = (GridSqlInsert) stmt;
@@ -178,16 +176,12 @@ public final class UpdatePlanBuilder {
rows = new ArrayList<>(elRows.size());
for (GridSqlElement[] elRow : elRows) {
- List<FastUpdateArgument> row = new ArrayList<>(cols.length);
+ List<DmlArgument> row = new ArrayList<>(cols.length);
for (GridSqlElement e : elRow) {
- if (e instanceof GridSqlConst)
- row.add(new FastUpdateArguments.ValueArgument(((GridSqlConst) e).value().getObject()));
- else if (e instanceof GridSqlParameter)
- row.add(new FastUpdateArguments.ParamArgument(((GridSqlParameter) e).index()));
- else
- throw new IgniteSQLException("Unexpected element type: " + e.getClass().getSimpleName(),
- IgniteQueryErrorCode.UNEXPECTED_ELEMENT_TYPE);
+ DmlArgument arg = DmlArguments.create(e);
+
+ row.add(arg);
}
rows.add(row);