ignite-gg9499 - splitter

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

Branch: refs/heads/sprint-1
Commit: ebd548ca9c5c1cbe0da1c20a6f693406b3026d0c
Parents: 24ccccf
Author: S.Vladykin <svlady...@gridgain.com>
Authored: Tue Dec 30 17:08:44 2014 +0300
Committer: S.Vladykin <svlady...@gridgain.com>
Committed: Tue Dec 30 17:08:44 2014 +0300

----------------------------------------------------------------------
 .../query/h2/sql/GridSqlQuerySplitter.java      | 65 ++++++++++++++++++++
 1 file changed, 65 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ebd548ca/modules/indexing/src/main/java/org/gridgain/grid/kernal/processors/query/h2/sql/GridSqlQuerySplitter.java
----------------------------------------------------------------------
diff --git 
a/modules/indexing/src/main/java/org/gridgain/grid/kernal/processors/query/h2/sql/GridSqlQuerySplitter.java
 
b/modules/indexing/src/main/java/org/gridgain/grid/kernal/processors/query/h2/sql/GridSqlQuerySplitter.java
new file mode 100644
index 0000000..bef0ce9
--- /dev/null
+++ 
b/modules/indexing/src/main/java/org/gridgain/grid/kernal/processors/query/h2/sql/GridSqlQuerySplitter.java
@@ -0,0 +1,65 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.gridgain.grid.kernal.processors.query.h2.sql;
+
+import org.gridgain.grid.kernal.processors.cache.query.*;
+
+import java.sql.*;
+import java.util.*;
+
+/**
+ * Splits a single SQL query into two step map-reduce query.
+ */
+public class GridSqlQuerySplitter {
+    /**
+     * @param conn Connection.
+     * @param query Query.
+     * @param params Parameters.
+     * @return Two step query.
+     */
+    public GridCacheTwoStepQuery split(Connection conn, String query, 
Collection<?> params) {
+        GridSqlSelect qry = GridSqlQueryParser.parse(conn, query);
+
+//        GridSqlSelect rdcQry = qry.clone();
+
+        for (GridSqlElement el : qry.select()) {
+
+        }
+
+        if (qry.distinct()) {
+
+        }
+
+        qry.from();
+
+        qry.where();
+
+        qry.groups();
+
+        qry.having();
+
+        qry.sort();
+    }
+
+    private boolean checkGroup(GridSqlSelect qry) {
+        if (qry.distinct())
+            return true;
+
+        qry.from();
+
+        qry.where();
+
+        qry.groups();
+
+        qry.having();
+
+        qry.sort();
+    }
+}

Reply via email to