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/08/14 10:30:46 UTC
[36/50] ignite git commit: Cleanup.
Cleanup.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b0bef64d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b0bef64d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b0bef64d
Branch: refs/heads/ignite-5991-6019
Commit: b0bef64de6b090a3a17de3d62ef13ba65aaed40d
Parents: 8c731b3
Author: devozerov <vo...@gridgain.com>
Authored: Mon Aug 14 11:33:12 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Mon Aug 14 11:33:12 2017 +0300
----------------------------------------------------------------------
.../processors/query/h2/IgniteH2Indexing.java | 22 ---
.../twostep/MapQueryStreamingResultTarget.java | 136 -------------------
2 files changed, 158 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bef64d/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index d6cc7e7..d4342ca 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -111,7 +111,6 @@ import org.apache.ignite.internal.processors.query.h2.sql.GridSqlQueryParser;
import org.apache.ignite.internal.processors.query.h2.sql.GridSqlQuerySplitter;
import org.apache.ignite.internal.processors.query.h2.twostep.GridMapQueryExecutor;
import org.apache.ignite.internal.processors.query.h2.twostep.GridReduceQueryExecutor;
-import org.apache.ignite.internal.processors.query.h2.twostep.MapQueryStreamingResultTarget;
import org.apache.ignite.internal.processors.query.h2.twostep.MapQueryLazyWorker;
import org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheVisitor;
import org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheVisitorClosure;
@@ -139,10 +138,8 @@ import org.apache.ignite.resources.LoggerResource;
import org.apache.ignite.spi.indexing.IndexingQueryFilter;
import org.h2.api.ErrorCode;
import org.h2.api.JavaObjectSerializer;
-import org.h2.command.CommandContainer;
import org.h2.command.Prepared;
import org.h2.command.dml.Insert;
-import org.h2.command.dml.Select;
import org.h2.engine.Session;
import org.h2.engine.SysProperties;
import org.h2.index.Index;
@@ -988,25 +985,6 @@ public class IgniteH2Indexing implements GridQueryIndexing {
}
/**
- * Execute SQL in streaming mode, trying to avoid loading everything to memory.
- *
- * @param conn Connection.
- * @param sql SQL statement.
- * @param params Parameters.
- * @throws IgniteCheckedException If failed.
- */
- public void executeSqlStreaming(Connection conn, String sql, @Nullable Collection<Object> params)
- throws IgniteCheckedException {
- JdbcPreparedStatement stmt = (JdbcPreparedStatement) preparedStatementWithParams(conn, sql, params, false);
-
- CommandContainer cmd = U.field(stmt, "command");
-
- Select select = U.field(cmd, "prepared");
-
- select.query(0, new MapQueryStreamingResultTarget(1, false));
- }
-
- /**
* Executes sql query and prints warning if query is too slow.
*
* @param stmt Prepared statement for query.
http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bef64d/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/MapQueryStreamingResultTarget.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/MapQueryStreamingResultTarget.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/MapQueryStreamingResultTarget.java
deleted file mode 100644
index 2b1203d..0000000
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/MapQueryStreamingResultTarget.java
+++ /dev/null
@@ -1,136 +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.twostep;
-
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2ValueMessageFactory;
-import org.h2.result.ResultTarget;
-import org.h2.value.Value;
-
-import java.util.concurrent.Semaphore;
-
-/**
- * Map query streaming result target.
- */
-public class MapQueryStreamingResultTarget implements ResultTarget {
- /** Page size. */
- private final int pageSize;
-
- /** Local node flag. */
- private final boolean loc;
-
- /** Semaphore for blocking. */
- private final Semaphore sem = new Semaphore(1);
-
- /** Row counter. */
- private int rowCnt;
-
- /** Data. */
- private Object[] data;
-
- /** Cancellation flag. */
- private volatile boolean cancelled;
-
- /**
- * Constructor.
- *
- * @param pageSize Page size.
- * @param loc Local node flag.
- */
- public MapQueryStreamingResultTarget(int pageSize, boolean loc) {
- this.pageSize = pageSize;
- this.loc = loc;
- }
-
- /** {@inheritDoc} */
- @Override public void addRow(Value[] vals) {
- if (cancelled)
- return;
-
- int colCnt = vals.length;
-
- if (data == null)
- data = new Object[colCnt * pageSize];
-
- int idx = rowCnt * colCnt;
-
- if (loc) {
- for (Value val : vals)
- data[idx++] = val;
- }
- else {
- try {
- for (Value val : vals)
- data[idx++] = GridH2ValueMessageFactory.toMessage(val);
- }
- catch (IgniteCheckedException e) {
- throw new IgniteException("Failed to convert H2 value to message.", e);
- }
- }
-
- rowCnt++;
-
- if (rowCnt == pageSize) {
- send();
-
- block();
- }
- }
-
- private void send() {
- if (!cancelled) {
- // TODO
- }
- }
-
- /**
- * Block data output.
- */
- private void block() {
- try {
- sem.acquire();
- }
- catch (InterruptedException e) {
-
- }
- }
-
- /**
- * Handle next page request.
- */
- public void onNextPageRequest() {
- // TODO
-
- sem.release();
- }
-
- /**
- * Cancel target (node is stopping).
- */
- public void cancel() {
- cancelled = true;
-
- sem.release();
- }
-
- /** {@inheritDoc} */
- @Override public int getRowCount() {
- return rowCnt;
- }
-}