You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by se...@apache.org on 2015/08/17 20:25:31 UTC
[1/3] incubator-ignite git commit: master - schema drop fix for TL
tables
Repository: incubator-ignite
Updated Branches:
refs/heads/master ad121478b -> d31c8c647
master - schema drop fix for TL tables
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/952c7fc9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/952c7fc9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/952c7fc9
Branch: refs/heads/master
Commit: 952c7fc99d63b5af0d5a3fe7df4b610f8baf9001
Parents: ad12147
Author: S.Vladykin <sv...@gridgain.com>
Authored: Mon Aug 17 21:22:50 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Mon Aug 17 21:22:50 2015 +0300
----------------------------------------------------------------------
.../query/h2/twostep/GridThreadLocalTable.java | 22 +++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/952c7fc9/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridThreadLocalTable.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridThreadLocalTable.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridThreadLocalTable.java
index c468371..f6735b5 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridThreadLocalTable.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridThreadLocalTable.java
@@ -21,6 +21,7 @@ import org.h2.api.*;
import org.h2.command.ddl.*;
import org.h2.engine.*;
import org.h2.index.*;
+import org.h2.message.*;
import org.h2.result.*;
import org.h2.schema.*;
import org.h2.table.*;
@@ -154,7 +155,7 @@ public class GridThreadLocalTable extends Table {
/** {@inheritDoc} */
@Override public String getTableType() {
- return tbl.get().getTableType();
+ return EXTERNAL_TABLE_ENGINE;
}
/** {@inheritDoc} */
@@ -179,7 +180,7 @@ public class GridThreadLocalTable extends Table {
/** {@inheritDoc} */
@Override public long getMaxDataModificationId() {
- return tbl.get().getMaxDataModificationId();
+ return 0;
}
/** {@inheritDoc} */
@@ -194,7 +195,7 @@ public class GridThreadLocalTable extends Table {
/** {@inheritDoc} */
@Override public boolean canDrop() {
- return tbl.get().canDrop();
+ return false;
}
/** {@inheritDoc} */
@@ -204,12 +205,14 @@ public class GridThreadLocalTable extends Table {
/** {@inheritDoc} */
@Override public long getRowCountApproximation() {
- return tbl.get().getRowCountApproximation();
+ Table t = tbl.get();
+
+ return t == null ? 0 : t.getRowCountApproximation();
}
/** {@inheritDoc} */
@Override public long getDiskSpaceUsed() {
- return tbl.get().getDiskSpaceUsed();
+ return 0;
}
/** {@inheritDoc} */
@@ -219,12 +222,17 @@ public class GridThreadLocalTable extends Table {
/** {@inheritDoc} */
@Override public String getDropSQL() {
- return tbl.get().getDropSQL();
+ return "";
+ }
+
+ /** {@inheritDoc} */
+ @Override public void addDependencies(HashSet<DbObject> dependencies) {
+ // No-op. We should not have any dependencies to add.
}
/** {@inheritDoc} */
@Override public void checkRename() {
- tbl.get().checkRename();
+ throw DbException.getUnsupportedException("rename");
}
/**
[3/3] incubator-ignite git commit: master - OFFSET clause fix
IGNITE-1259
Posted by se...@apache.org.
master - OFFSET clause fix IGNITE-1259
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/d31c8c64
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/d31c8c64
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/d31c8c64
Branch: refs/heads/master
Commit: d31c8c6477e03563bf73db3cf216250b9c22b562
Parents: 9c939be
Author: S.Vladykin <sv...@gridgain.com>
Authored: Mon Aug 17 21:25:25 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Mon Aug 17 21:25:25 2015 +0300
----------------------------------------------------------------------
.../query/h2/sql/GridSqlQuerySplitter.java | 3 +
.../query/IgniteSqlSplitterSelfTest.java | 152 +++++++++++++++++++
.../IgniteCacheQuerySelfTestSuite.java | 2 +
3 files changed, 157 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d31c8c64/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
index 2f8bcdd..34aef87 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
@@ -205,6 +205,9 @@ public class GridSqlQuerySplitter {
if (mapQry.offset() != null) {
rdcQry.offset(mapQry.offset());
+ if (mapQry.limit() != null) // LIMIT off + lim
+ mapQry.limit(op(GridSqlOperationType.PLUS, mapQry.offset(), mapQry.limit()));
+
mapQry.offset(null);
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d31c8c64/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
new file mode 100644
index 0000000..6ec6bb3
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
@@ -0,0 +1,152 @@
+/*
+ * 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;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
+import org.apache.ignite.cache.query.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.util.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.apache.ignite.testframework.junits.common.*;
+
+import java.util.*;
+
+/**
+ * Tests for correct distributed partitioned queries.
+ */
+@SuppressWarnings("unchecked")
+public class IgniteSqlSplitterSelfTest extends GridCommonAbstractTest {
+ /** */
+ private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration() throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration();
+
+ cfg.setPeerClassLoadingEnabled(false);
+
+ TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+ disco.setIpFinder(ipFinder);
+
+ cfg.setDiscoverySpi(disco);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ startGridsMultiThreaded(3, false);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ stopAllGrids();
+ }
+
+ /**
+ * @param name Cache name.
+ * @param partitioned Partition or replicated cache.
+ * @param idxTypes Indexed types.
+ * @return Cache configuration.
+ */
+ private static CacheConfiguration cacheConfig(String name, boolean partitioned, Class<?>... idxTypes) {
+ return new CacheConfiguration()
+ .setName(name)
+ .setCacheMode(partitioned ? CacheMode.PARTITIONED : CacheMode.REPLICATED)
+ .setAtomicityMode(CacheAtomicityMode.ATOMIC)
+ .setBackups(1)
+ .setIndexedTypes(idxTypes);
+ }
+
+ /**
+ * Tests offset and limit clauses for query.
+ * @throws Exception If failed.
+ */
+ public void testOffsetLimit() throws Exception {
+ IgniteCache<Integer, Integer> c = ignite(0).getOrCreateCache(cacheConfig("ints", true,
+ Integer.class, Integer.class));
+
+ try {
+ List<Integer> res = new ArrayList<>();
+
+ Random rnd = new GridRandom();
+
+ for (int i = 0; i < 10; i++) {
+ int val = rnd.nextInt(100);
+
+ c.put(i, val);
+ res.add(val);
+ }
+
+ Collections.sort(res);
+
+ String qry = "select _val from Integer order by _val ";
+
+ assertEqualsCollections(res,
+ column(0, c.query(new SqlFieldsQuery(qry)).getAll()));
+
+ assertEqualsCollections(res.subList(0, 0),
+ column(0, c.query(new SqlFieldsQuery(qry + "limit ?").setArgs(0)).getAll()));
+
+ assertEqualsCollections(res.subList(0, 3),
+ column(0, c.query(new SqlFieldsQuery(qry + "limit ?").setArgs(3)).getAll()));
+
+ assertEqualsCollections(res.subList(0, 9),
+ column(0, c.query(new SqlFieldsQuery(qry + "limit ? offset ?").setArgs(9, 0)).getAll()));
+
+ assertEqualsCollections(res.subList(3, 7),
+ column(0, c.query(new SqlFieldsQuery(qry + "limit ? offset ?").setArgs(4, 3)).getAll()));
+
+ assertEqualsCollections(res.subList(7, 9),
+ column(0, c.query(new SqlFieldsQuery(qry + "limit ? offset ?").setArgs(2, 7)).getAll()));
+
+ assertEqualsCollections(res.subList(8, 10),
+ column(0, c.query(new SqlFieldsQuery(qry + "limit ? offset ?").setArgs(2, 8)).getAll()));
+
+ assertEqualsCollections(res.subList(9, 10),
+ column(0, c.query(new SqlFieldsQuery(qry + "limit ? offset ?").setArgs(1, 9)).getAll()));
+
+ assertEqualsCollections(res.subList(10, 10),
+ column(0, c.query(new SqlFieldsQuery(qry + "limit ? offset ?").setArgs(1, 10)).getAll()));
+
+ assertEqualsCollections(res.subList(9, 10),
+ column(0, c.query(new SqlFieldsQuery(qry + "limit ? offset abs(-(4 + ?))").setArgs(1, 5)).getAll()));
+ }
+ finally {
+ c.destroy();
+ }
+ }
+
+ /**
+ * @param idx Column index.
+ * @param rows Rows.
+ * @return Column as list.
+ */
+ private static List<?> column(int idx, List<List<?>> rows) {
+ List res = new ArrayList<>(rows.size());
+
+ for (List<?> row : rows)
+ res.add(row.get(idx));
+
+ return res;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d31c8c64/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
index a3849d7..730c79f 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
@@ -25,6 +25,7 @@ import org.apache.ignite.internal.processors.cache.local.*;
import org.apache.ignite.internal.processors.cache.query.*;
import org.apache.ignite.internal.processors.cache.query.continuous.*;
import org.apache.ignite.internal.processors.cache.reducefields.*;
+import org.apache.ignite.internal.processors.query.*;
import org.apache.ignite.internal.processors.query.h2.sql.*;
import org.apache.ignite.spi.communication.tcp.*;
@@ -43,6 +44,7 @@ public class IgniteCacheQuerySelfTestSuite extends TestSuite {
suite.addTestSuite(GridQueryParsingTest.class);
// Queries tests.
+ suite.addTestSuite(IgniteSqlSplitterSelfTest.class);
suite.addTestSuite(GridCacheQueryIndexDisabledSelfTest.class);
suite.addTestSuite(IgniteCacheQueryLoadSelfTest.class);
suite.addTestSuite(IgniteCacheLocalQuerySelfTest.class);
[2/3] incubator-ignite git commit: master - index sort fix for merge
tables
Posted by se...@apache.org.
master - index sort fix for merge tables
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/9c939bec
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/9c939bec
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/9c939bec
Branch: refs/heads/master
Commit: 9c939bec1bfa2c3396051c155ffb06775a329aad
Parents: 952c7fc
Author: S.Vladykin <sv...@gridgain.com>
Authored: Mon Aug 17 21:23:26 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Mon Aug 17 21:23:26 2015 +0300
----------------------------------------------------------------------
.../internal/processors/query/h2/twostep/GridMergeTable.java | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9c939bec/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeTable.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeTable.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeTable.java
index 0b335d3..7d2235d 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeTable.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeTable.java
@@ -35,9 +35,6 @@ public class GridMergeTable extends TableBase {
private final GridKernalContext ctx;
/** */
- private final ArrayList<Index> idxs = new ArrayList<>(1);
-
- /** */
private final GridMergeIndex idx;
/**
@@ -49,8 +46,6 @@ public class GridMergeTable extends TableBase {
this.ctx = ctx;
idx = new GridMergeIndexUnsorted(this, "merge_scan");
-
- idxs.add(idx);
}
/**
@@ -124,7 +119,7 @@ public class GridMergeTable extends TableBase {
/** {@inheritDoc} */
@Override public ArrayList<Index> getIndexes() {
- return idxs;
+ return null;
}
/** {@inheritDoc} */