ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject [07/15] ignite git commit: IGNITE-4163 Fixed load range queries.
Date Mon, 21 Nov 2016 13:42:55 GMT
IGNITE-4163 Fixed load range queries.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e39888a0
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e39888a0
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e39888a0

Branch: refs/heads/ignite-4242
Commit: e39888a08da313bec4d30f96488eccb36b4abacc
Parents: 85a4b96
Author: Vasiliy Sisko <vsisko@gridgain.com>
Authored: Thu Nov 17 11:41:05 2016 +0700
Committer: Andrey Novikov <anovikov@gridgain.com>
Committed: Thu Nov 17 11:41:05 2016 +0700

----------------------------------------------------------------------
 .../ignite/cache/store/jdbc/CacheAbstractJdbcStore.java      | 2 +-
 .../ignite/cache/store/jdbc/dialect/BasicJdbcDialect.java    | 4 ++--
 .../apache/ignite/cache/store/jdbc/dialect/DB2Dialect.java   | 8 ++++++++
 .../ignite/cache/store/jdbc/dialect/OracleDialect.java       | 8 ++++++++
 .../ignite/cache/store/jdbc/dialect/SQLServerDialect.java    | 8 ++++++++
 5 files changed, 27 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/e39888a0/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
index 4eb5b56..4bfd92b 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
@@ -1982,7 +1982,7 @@ public abstract class CacheAbstractJdbcStore<K, V> implements
CacheStore<K, V>,
                 Map<String, Integer> colIdxs = U.newHashMap(meta.getColumnCount());
 
                 for (int i = 1; i <= meta.getColumnCount(); i++)
-                    colIdxs.put(meta.getColumnLabel(i), i);
+                    colIdxs.put(meta.getColumnLabel(i).toUpperCase(), i);
 
                 while (rs.next()) {
                     K1 key = buildObject(em.cacheName, em.keyType(), em.keyKind(), em.keyColumns(),
em.keyCols, colIdxs, rs);

http://git-wip-us.apache.org/repos/asf/ignite/blob/e39888a0/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/BasicJdbcDialect.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/BasicJdbcDialect.java
b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/BasicJdbcDialect.java
index 5fa564b..3ab112a 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/BasicJdbcDialect.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/BasicJdbcDialect.java
@@ -157,8 +157,8 @@ public class BasicJdbcDialect implements JdbcDialect {
     @Override public String loadCacheSelectRangeQuery(String fullTblName, Collection<String>
keyCols) {
         String cols = mkString(keyCols, ",");
 
-        return String.format("SELECT %s FROM (SELECT %s, ROWNUM() AS rn FROM %s ORDER BY
%s) WHERE mod(rn, ?) = 0",
-            cols, cols, fullTblName, cols);
+        return String.format("SELECT %1$s FROM (SELECT %1$s, ROW_NUMBER() OVER() AS rn FROM
(SELECT %1$s FROM %2$s ORDER BY %1$s) AS tbl) AS tbl WHERE mod(rn, ?) = 0",
+            cols, fullTblName);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/e39888a0/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/DB2Dialect.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/DB2Dialect.java
b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/DB2Dialect.java
index 4bae14a..551782e 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/DB2Dialect.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/DB2Dialect.java
@@ -29,6 +29,14 @@ public class DB2Dialect extends BasicJdbcDialect {
     private static final long serialVersionUID = 0L;
 
     /** {@inheritDoc} */
+    @Override public String loadCacheSelectRangeQuery(String fullTblName, Collection<String>
keyCols) {
+        String cols = mkString(keyCols, ",");
+
+        return String.format("SELECT %1$s FROM (SELECT %1$s, ROW_NUMBER() OVER(ORDER BY %1$s)
AS rn FROM %2$s) WHERE mod(rn, ?) = 0 ORDER BY %1$s",
+            cols, fullTblName);
+    }
+
+    /** {@inheritDoc} */
     @Override public boolean hasMerge() {
         return true;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/e39888a0/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/OracleDialect.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/OracleDialect.java
b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/OracleDialect.java
index a9efe0d..e268b24 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/OracleDialect.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/OracleDialect.java
@@ -34,6 +34,14 @@ public class OracleDialect extends BasicJdbcDialect {
     }
 
     /** {@inheritDoc} */
+    @Override public String loadCacheSelectRangeQuery(String fullTblName, Collection<String>
keyCols) {
+        String cols = mkString(keyCols, ",");
+
+        return String.format("SELECT %1$s FROM (SELECT %1$s, ROWNUM AS rn FROM (SELECT %1$s
FROM %2$s ORDER BY %1$s)) WHERE mod(rn, ?) = 0",
+            cols, fullTblName);
+    }
+
+    /** {@inheritDoc} */
     @Override public String mergeQuery(String fullTblName, Collection<String> keyCols,
Collection<String> uniqCols) {
         Collection<String> cols = F.concat(false, keyCols, uniqCols);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/e39888a0/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/SQLServerDialect.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/SQLServerDialect.java
b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/SQLServerDialect.java
index 883918f..ace1d3f 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/SQLServerDialect.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/SQLServerDialect.java
@@ -34,6 +34,14 @@ public class SQLServerDialect extends BasicJdbcDialect {
     }
 
     /** {@inheritDoc} */
+    @Override public String loadCacheSelectRangeQuery(String fullTblName, Collection<String>
keyCols) {
+        String cols = mkString(keyCols, ",");
+
+        return String.format("SELECT %1$s FROM (SELECT %1$s, ROW_NUMBER() OVER(ORDER BY %1$s)
AS rn FROM %2$s) tbl WHERE rn %% ? = 0 ORDER BY %1$s",
+            cols, fullTblName);
+    }
+
+    /** {@inheritDoc} */
     @Override public boolean hasMerge() {
         return true;
     }


Mime
View raw message