You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ak...@apache.org on 2015/08/07 13:08:26 UTC
[01/17] incubator-ignite git commit: minor
Repository: incubator-ignite
Updated Branches:
refs/heads/ignite-843 471414788 -> 240912dd2
minor
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/c391165e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/c391165e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/c391165e
Branch: refs/heads/ignite-843
Commit: c391165e6eed8b37def78663db9870f5d809da19
Parents: 44aacec
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Wed Aug 5 15:01:00 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Wed Aug 5 15:01:00 2015 +0300
----------------------------------------------------------------------
.../ignite/spi/discovery/tcp/TcpDiscoverySpi.java | 5 +++++
modules/log4j2/README.txt | 15 ++++++++++++++-
2 files changed, 19 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c391165e/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
index 3216166..18a540c 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
@@ -1889,6 +1889,11 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
impl.brakeConnection();
}
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(TcpDiscoverySpi.class, this);
+ }
+
/**
* Socket timeout object.
*/
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c391165e/modules/log4j2/README.txt
----------------------------------------------------------------------
diff --git a/modules/log4j2/README.txt b/modules/log4j2/README.txt
index 47d01d2..6e21b7a 100644
--- a/modules/log4j2/README.txt
+++ b/modules/log4j2/README.txt
@@ -5,7 +5,20 @@ Apache Ignite Log4J2 module provides IgniteLogger implementation based on Apache
To enable Log4J2 module when starting a standalone node, move 'optional/ignite-log4j2' folder to
'libs' folder before running 'ignite.{sh|bat}' script. The content of the module folder will
-be added to classpath in this case.
+be added to classpath in this case. Also it is needed to configure ignite logger with Log4J2Logger
+and provide log4j2 configuration.
+
+To enable ignite logging with default configuration use:
+
+<bean class="org.apache.ignite.configuration.IgniteConfiguration">
+ ...
+ <property name="gridLogger">
+ <bean class="org.apache.ignite.logger.log4j2.Log4J2Logger">
+ <constructor-arg type="java.lang.String" value="config/ignite-log4j2.xml"/>
+ </bean>
+ </property>
+ ...
+</bean>
Importing Log4J2 Module In Maven Project
---------------------------------------
[07/17] incubator-ignite git commit: master ignite-1207
Posted by ak...@apache.org.
master ignite-1207
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/33e174bb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/33e174bb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/33e174bb
Branch: refs/heads/ignite-843
Commit: 33e174bb9a8c9d79c66962449cf0d5403b921aed
Parents: 2173b0e
Author: Anton Vinogradov <vi...@gmail.com>
Authored: Thu Aug 6 13:03:44 2015 +0300
Committer: Anton Vinogradov <vi...@gmail.com>
Committed: Thu Aug 6 13:03:44 2015 +0300
----------------------------------------------------------------------
assembly/release-hadoop.xml | 5 +++++
1 file changed, 5 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/33e174bb/assembly/release-hadoop.xml
----------------------------------------------------------------------
diff --git a/assembly/release-hadoop.xml b/assembly/release-hadoop.xml
index 7b94144..3f61ec9 100644
--- a/assembly/release-hadoop.xml
+++ b/assembly/release-hadoop.xml
@@ -58,6 +58,11 @@
<source>modules/hadoop/config/hive-site.ignite.xml</source>
<outputDirectory>/config/hadoop</outputDirectory>
</file>
+
+ <file>
+ <source>modules/hadoop/docs/HADOOP_README.txt</source>
+ <outputDirectory>/</outputDirectory>
+ </file>
</files>
<fileSets>
[05/17] incubator-ignite git commit: msg format
Posted by ak...@apache.org.
msg format
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/d7623b47
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/d7623b47
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/d7623b47
Branch: refs/heads/ignite-843
Commit: d7623b47abea23c685856b36ade75027efbb3cc5
Parents: 2173b0e
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu Aug 6 12:38:24 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Aug 6 12:38:24 2015 +0300
----------------------------------------------------------------------
.../ignite/spi/discovery/tcp/ClientImpl.java | 27 +++++++++++++++-----
1 file changed, 21 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d7623b47/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
index 0f9c100..d5d6ea2 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
@@ -29,6 +29,7 @@ import org.apache.ignite.lang.*;
import org.apache.ignite.spi.*;
import org.apache.ignite.spi.discovery.*;
import org.apache.ignite.spi.discovery.tcp.internal.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.*;
import org.apache.ignite.spi.discovery.tcp.messages.*;
import org.jetbrains.annotations.*;
import org.jsr166.*;
@@ -159,7 +160,9 @@ class ClientImpl extends TcpDiscoveryImpl {
/** {@inheritDoc} */
@Override public void spiStart(@Nullable String gridName) throws IgniteSpiException {
- spi.initLocalNode(0, true);
+ spi.initLocalNode(
+ 0,
+ true);
locNode = spi.locNode;
@@ -190,7 +193,10 @@ class ClientImpl extends TcpDiscoveryImpl {
throw new IgniteSpiException("Thread has been interrupted.", e);
}
- timer.schedule(new HeartbeatSender(), spi.hbFreq, spi.hbFreq);
+ timer.schedule(
+ new HeartbeatSender(),
+ spi.hbFreq,
+ spi.hbFreq);
spi.printStartInfo();
}
@@ -408,7 +414,11 @@ class ClientImpl extends TcpDiscoveryImpl {
if (timeout > 0 && (U.currentTimeMillis() - startTime) > timeout)
return null;
- LT.warn(log, null, "No addresses registered in the IP finder (will retry in 2000ms): "
+ LT.warn(log, null, "IP finder returned empty addresses list. " +
+ "Please check IP finder configuration" +
+ (spi.ipFinder instanceof TcpDiscoveryMulticastIpFinder ?
+ " and make sure multicast works on your network. " : ". ") +
+ "Will retry every 2 secs."
+ spi.ipFinder, true);
Thread.sleep(2000);
@@ -460,7 +470,7 @@ class ClientImpl extends TcpDiscoveryImpl {
return null;
LT.warn(log, null, "Failed to connect to any address from IP finder (will retry to join topology " +
- "in 2000ms): " + toOrderedList(addrs0), true);
+ "every 2 secs): " + toOrderedList(addrs0), true);
Thread.sleep(2000);
}
@@ -682,7 +692,9 @@ class ClientImpl extends TcpDiscoveryImpl {
U.interrupt(msgWorker);
U.join(sockWriter, log);
- U.join(msgWorker, log);
+ U.join(
+ msgWorker,
+ log);
}
/** {@inheritDoc} */
@@ -987,7 +999,10 @@ class ClientImpl extends TcpDiscoveryImpl {
}
}
- spi.writeToSocket(sock, msg, socketTimeout);
+ spi.writeToSocket(
+ sock,
+ msg,
+ socketTimeout);
msg = null;
[14/17] incubator-ignite git commit: Renaming
Posted by ak...@apache.org.
Renaming
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/ebcdb4bf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/ebcdb4bf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/ebcdb4bf
Branch: refs/heads/ignite-843
Commit: ebcdb4bf5cfe508670129389637984b8dba43146
Parents: d7dd4a0
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu Aug 6 16:44:21 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Aug 6 16:44:21 2015 +0300
----------------------------------------------------------------------
.../internal/processors/cache/query/GridCacheSqlQuery.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ebcdb4bf/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java
index d5eb379..77bbe39 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java
@@ -53,7 +53,7 @@ public class GridCacheSqlQuery implements Message {
/** */
@GridToStringInclude
@GridDirectTransient
- private LinkedHashMap<String, ?> columns;
+ private LinkedHashMap<String, ?> cols;
/**
* For {@link Message}.
@@ -78,7 +78,7 @@ public class GridCacheSqlQuery implements Message {
* @return Columns.
*/
public LinkedHashMap<String, ?> columns() {
- return columns;
+ return cols;
}
/**
@@ -86,7 +86,7 @@ public class GridCacheSqlQuery implements Message {
* @return {@code this}.
*/
public GridCacheSqlQuery columns(LinkedHashMap<String, ?> columns) {
- this.columns = columns;
+ this.cols = columns;
return this;
}
[12/17] incubator-ignite git commit: Merge remote-tracking branch
'origin/master'
Posted by ak...@apache.org.
Merge remote-tracking branch 'origin/master'
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/63944d41
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/63944d41
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/63944d41
Branch: refs/heads/ignite-843
Commit: 63944d41d9bb7e9e74366f935b9f620e01bc36ce
Parents: 56efb6b b94c130
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu Aug 6 15:54:01 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Aug 6 15:54:01 2015 +0300
----------------------------------------------------------------------
assembly/release-hadoop.xml | 5 +
.../config/benchmark-multicast.properties | 1 +
parent/pom.xml | 97 ++++++++++----------
3 files changed, 54 insertions(+), 49 deletions(-)
----------------------------------------------------------------------
[16/17] incubator-ignite git commit: Merge branches 'ignite-843' and
'master' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into
ignite-843
Posted by ak...@apache.org.
Merge branches 'ignite-843' and 'master' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-843
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/6884c06b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/6884c06b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/6884c06b
Branch: refs/heads/ignite-843
Commit: 6884c06ba75f91a75686e73f85021b95c1228f2a
Parents: 4714147 d9acbd1
Author: AKuznetsov <ak...@gridgain.com>
Authored: Fri Aug 7 15:01:45 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Fri Aug 7 15:01:45 2015 +0700
----------------------------------------------------------------------
assembly/release-hadoop.xml | 5 +
.../cache/query/GridCacheSqlQuery.java | 33 ++-
.../cache/query/GridCacheTwoStepQuery.java | 34 +--
.../ignite/spi/discovery/tcp/ClientImpl.java | 28 +-
.../spi/discovery/tcp/TcpDiscoverySpi.java | 5 +
.../TcpDiscoveryMulticastIpFinder.java | 7 +-
.../processors/query/h2/IgniteH2Indexing.java | 27 +-
.../processors/query/h2/sql/GridSqlElement.java | 18 +-
.../query/h2/sql/GridSqlFunction.java | 17 +-
.../processors/query/h2/sql/GridSqlQuery.java | 4 +-
.../query/h2/sql/GridSqlQueryParser.java | 94 ++++---
.../query/h2/sql/GridSqlQuerySplitter.java | 117 +++++----
.../processors/query/h2/sql/GridSqlSelect.java | 76 +++---
.../processors/query/h2/sql/GridSqlType.java | 24 +-
.../processors/query/h2/sql/GridSqlUnion.java | 2 +-
.../h2/twostep/GridReduceQueryExecutor.java | 211 ++++++---------
.../query/h2/twostep/GridThreadLocalTable.java | 262 +++++++++++++++++++
.../IgniteCacheAbstractFieldsQuerySelfTest.java | 2 +-
modules/log4j2/README.txt | 15 +-
.../ignite/logger/log4j2/Log4J2Logger.java | 2 +-
.../ignite/logger/log4j2/Log4j2FileAware.java | 35 ---
.../org/apache/ignite/spark/IgniteContext.scala | 19 +-
.../config/benchmark-multicast.properties | 1 +
parent/pom.xml | 97 ++++---
scripts/git-apply-patch.sh | 94 -------
scripts/git-patch-functions.sh | 56 +---
26 files changed, 734 insertions(+), 551 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6884c06b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6884c06b/parent/pom.xml
----------------------------------------------------------------------
[11/17] incubator-ignite git commit: minor
Posted by ak...@apache.org.
minor
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/56efb6b1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/56efb6b1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/56efb6b1
Branch: refs/heads/ignite-843
Commit: 56efb6b112abd03f673ee65ca8061b4728e1205d
Parents: 5ce8bc6
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu Aug 6 15:53:48 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Aug 6 15:53:48 2015 +0300
----------------------------------------------------------------------
.../tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/56efb6b1/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java
index bdc7865..b93c547 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java
@@ -330,9 +330,10 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
reqItfs.add(mcastAddr);
}
catch (IOException e) {
- log.debug("Failed to create multicast socket [mcastAddr=" + mcastAddr +
- ", mcastGrp=" + mcastGrp + ", mcastPort=" + mcastPort + ", locAddr=" + mcastAddr +
- ", err=" + e + ']');
+ if (log.isDebugEnabled())
+ log.debug("Failed to create multicast socket [mcastAddr=" + mcastAddr +
+ ", mcastGrp=" + mcastGrp + ", mcastPort=" + mcastPort + ", locAddr=" + mcastAddr +
+ ", err=" + e + ']');
}
}
}
[06/17] incubator-ignite git commit: msg format
Posted by ak...@apache.org.
msg format
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/5ce8bc69
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/5ce8bc69
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/5ce8bc69
Branch: refs/heads/ignite-843
Commit: 5ce8bc692cdc5e7662ccd6ac5f6e8f5b2fd493e4
Parents: d7623b4
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu Aug 6 12:52:59 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Aug 6 12:52:59 2015 +0300
----------------------------------------------------------------------
.../main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5ce8bc69/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
index d5d6ea2..5e81a3e 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
@@ -418,8 +418,7 @@ class ClientImpl extends TcpDiscoveryImpl {
"Please check IP finder configuration" +
(spi.ipFinder instanceof TcpDiscoveryMulticastIpFinder ?
" and make sure multicast works on your network. " : ". ") +
- "Will retry every 2 secs."
- + spi.ipFinder, true);
+ "Will retry every 2 secs.", true);
Thread.sleep(2000);
}
[02/17] incubator-ignite git commit: removed unused file.
Posted by ak...@apache.org.
removed unused file.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/19310d34
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/19310d34
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/19310d34
Branch: refs/heads/ignite-843
Commit: 19310d3468ff9ed9307fe30a5a5769829dfe4219
Parents: c391165
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Wed Aug 5 16:35:44 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Wed Aug 5 16:35:44 2015 +0300
----------------------------------------------------------------------
.../ignite/logger/log4j2/Log4j2FileAware.java | 35 --------------------
1 file changed, 35 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/19310d34/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4j2FileAware.java
----------------------------------------------------------------------
diff --git a/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4j2FileAware.java b/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4j2FileAware.java
deleted file mode 100644
index c389e69..0000000
--- a/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4j2FileAware.java
+++ /dev/null
@@ -1,35 +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.logger.log4j2;
-
-import org.apache.ignite.lang.IgniteClosure;
-
-/**
- * Porting for the Log4j2, the interface is useless with the new implementation
- * of the module
- *
- * @author Gianfranco Murador
- */
-public interface Log4j2FileAware {
-
- /**
- * Sets closure that later evaluate file path.
- *
- * @param filePathClos Closure that generates actual file path.
- */
- void updateFilePath(IgniteClosure<String, String> filePathClos);
-}
[03/17] incubator-ignite git commit: typo + msg format
Posted by ak...@apache.org.
typo + msg format
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/023ffe0e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/023ffe0e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/023ffe0e
Branch: refs/heads/ignite-843
Commit: 023ffe0eee38663fe78dacd9b63d5f121226008b
Parents: 19310d3
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Wed Aug 5 17:29:24 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Wed Aug 5 17:29:24 2015 +0300
----------------------------------------------------------------------
.../main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/023ffe0e/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java
----------------------------------------------------------------------
diff --git a/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java b/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java
index 19f43e6..7ea490a 100644
--- a/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java
+++ b/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java
@@ -237,7 +237,7 @@ public class Log4J2Logger implements IgniteLogger, LoggerNodeIdAware {
}
}
catch (IllegalAccessException | NoSuchFieldException e) {
- error("Faild to get file name. Looks like the implementation of log4j 2 was changed.", e);
+ error("Failed to get file name (was the implementation of log4j2 changed?).", e);
}
}
}
[09/17] incubator-ignite git commit: License generation hotfix
Posted by ak...@apache.org.
License generation hotfix
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/6e496e67
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/6e496e67
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/6e496e67
Branch: refs/heads/ignite-843
Commit: 6e496e67e7b3a1c7cd6e31555a3198a833252f1d
Parents: b031525
Author: Anton Vinogradov <vi...@gmail.com>
Authored: Thu Aug 6 13:44:36 2015 +0300
Committer: Anton Vinogradov <vi...@gmail.com>
Committed: Thu Aug 6 13:44:36 2015 +0300
----------------------------------------------------------------------
parent/pom.xml | 97 ++++++++++++++++++++++++++---------------------------
1 file changed, 48 insertions(+), 49 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6e496e67/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index e703502..efa6494 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -140,6 +140,13 @@
<version>4.11</version>
<scope>test</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.ignite</groupId>
+ <artifactId>ignite-apache-license-gen</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope><!-- hack to have ignite-apache-license-gen at first place at mvn reactor -->
+ </dependency>
</dependencies>
<build>
@@ -567,60 +574,52 @@
</execution>
</executions>
</plugin>
+
+ <plugin><!-- generates dependencies licenses -->
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-remote-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>ignite-dependencies</id>
+ <goals>
+ <goal>process</goal>
+ </goals>
+ <configuration>
+ <resourceBundles>
+ <resourceBundle>org.apache.ignite:ignite-apache-license-gen:${project.version}</resourceBundle>
+ </resourceBundles>
+ <excludeTransitive>true</excludeTransitive>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.7</version>
+ <executions>
+ <execution>
+ <id>licenses-file-rename</id>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <phase>compile</phase>
+ <configuration>
+ <target>
+ <!-- moving licenses generated by "ignite-dependencies" -->
+ <move file="${basedir}/target/classes/META-INF/licenses.txt" tofile="${basedir}/target/licenses/${project.artifactId}-licenses.txt"/>
+ </target>
+ <failOnError>false</failOnError>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
<profiles>
<profile>
- <id>apache-release</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-remote-resources-plugin</artifactId>
- <executions>
- <execution>
- <id>ignite-dependencies</id>
- <goals>
- <goal>process</goal>
- </goals>
- <configuration>
- <resourceBundles>
- <resourceBundle>org.apache.ignite:ignite-apache-license-gen:${project.version}</resourceBundle>
- </resourceBundles>
- <excludeTransitive>true</excludeTransitive>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <version>1.7</version>
- <executions>
- <execution>
- <id>licenses-file-rename</id>
- <goals>
- <goal>run</goal>
- </goals>
- <phase>compile</phase>
- <configuration>
- <target>
- <!-- moving licenses generated by "ignite-dependencies" -->
- <move file="${basedir}/target/classes/META-INF/licenses.txt" tofile="${basedir}/target/licenses/${project.artifactId}-licenses.txt"/>
- </target>
- <failOnError>false</failOnError>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- </plugins>
- </build>
- </profile>
-
- <profile>
<id>check-licenses</id>
<build>
<plugins>
[10/17] incubator-ignite git commit: Added comment in
benchmark-multicast.properties
Posted by ak...@apache.org.
Added comment in benchmark-multicast.properties
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/b94c1302
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/b94c1302
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/b94c1302
Branch: refs/heads/ignite-843
Commit: b94c13026e9097adb2d318548832ce870152c95f
Parents: 6e496e6
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Thu Aug 6 15:39:54 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Thu Aug 6 15:39:54 2015 +0300
----------------------------------------------------------------------
modules/yardstick/config/benchmark-multicast.properties | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b94c1302/modules/yardstick/config/benchmark-multicast.properties
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/benchmark-multicast.properties b/modules/yardstick/config/benchmark-multicast.properties
index 74b152c..82bf766 100644
--- a/modules/yardstick/config/benchmark-multicast.properties
+++ b/modules/yardstick/config/benchmark-multicast.properties
@@ -45,6 +45,7 @@ BENCHMARK_DEFAULT_PROBES=ThroughputLatencyProbe,PercentileProbe,DStatProbe
# Packages where the specified benchmark is searched by reflection mechanism.
BENCHMARK_PACKAGES=org.yardstickframework,org.apache.ignite.yardstick
+# Restart servers for each benchmark.
RESTART_SERVERS=true
# Probe point writer class name.
[08/17] incubator-ignite git commit: Merge remote-tracking branch
'origin/master'
Posted by ak...@apache.org.
Merge remote-tracking branch 'origin/master'
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/b0315250
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/b0315250
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/b0315250
Branch: refs/heads/ignite-843
Commit: b03152504cb5d8da0d57b3a712cadd9a4aea4a83
Parents: 33e174b 5ce8bc6
Author: Anton Vinogradov <vi...@gmail.com>
Authored: Thu Aug 6 13:05:43 2015 +0300
Committer: Anton Vinogradov <vi...@gmail.com>
Committed: Thu Aug 6 13:05:43 2015 +0300
----------------------------------------------------------------------
.../ignite/spi/discovery/tcp/ClientImpl.java | 28 +++++++++++++++-----
1 file changed, 21 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
[04/17] incubator-ignite git commit: # ignite-1198
Posted by ak...@apache.org.
# ignite-1198
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/2173b0e1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/2173b0e1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/2173b0e1
Branch: refs/heads/ignite-843
Commit: 2173b0e1500d3dbc198a610042fca9b92d4f7de7
Parents: 023ffe0
Author: Alexey Goncharuk <ag...@gridgain.com>
Authored: Wed Aug 5 14:05:07 2015 -0700
Committer: Alexey Goncharuk <ag...@gridgain.com>
Committed: Wed Aug 5 14:25:13 2015 -0700
----------------------------------------------------------------------
.../org/apache/ignite/spark/IgniteContext.scala | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2173b0e1/modules/spark/src/main/scala/org/apache/ignite/spark/IgniteContext.scala
----------------------------------------------------------------------
diff --git a/modules/spark/src/main/scala/org/apache/ignite/spark/IgniteContext.scala b/modules/spark/src/main/scala/org/apache/ignite/spark/IgniteContext.scala
index 5267244a..6e48017 100644
--- a/modules/spark/src/main/scala/org/apache/ignite/spark/IgniteContext.scala
+++ b/modules/spark/src/main/scala/org/apache/ignite/spark/IgniteContext.scala
@@ -19,7 +19,8 @@ package org.apache.ignite.spark
import org.apache.ignite.internal.IgnitionEx
-import org.apache.ignite.{Ignition, Ignite}
+import org.apache.ignite.internal.util.IgniteUtils
+import org.apache.ignite.{IgniteSystemProperties, Ignition, Ignite}
import org.apache.ignite.configuration.{CacheConfiguration, IgniteConfiguration}
import org.apache.spark.{Logging, SparkContext}
import org.apache.spark.sql.SQLContext
@@ -41,8 +42,12 @@ class IgniteContext[K, V](
private val cfgClo = new Once(cfgF)
+ private val igniteHome = IgniteUtils.getIgniteHome
+
if (!client) {
- val workers = sparkContext.getExecutorStorageStatus.length - 1
+ // Get required number of executors with default equals to number of available executors.
+ val workers = sparkContext.getConf.getInt("spark.executor.instances",
+ sparkContext.getExecutorStorageStatus.length)
if (workers <= 0)
throw new IllegalStateException("No Spark executors found to start Ignite nodes.")
@@ -125,6 +130,16 @@ class IgniteContext[K, V](
* @return Ignite instance.
*/
def ignite(): Ignite = {
+ val home = IgniteUtils.getIgniteHome
+
+ if (home == null && igniteHome != null) {
+ logInfo("Setting IGNITE_HOME from driver not as it is not available on this worker: " + igniteHome)
+
+ IgniteUtils.nullifyHomeDirectory()
+
+ System.setProperty(IgniteSystemProperties.IGNITE_HOME, igniteHome)
+ }
+
val igniteCfg = cfgClo()
try {
[17/17] incubator-ignite git commit: IGNITE-843 Minor ui improvements
and cleanup.
Posted by ak...@apache.org.
IGNITE-843 Minor ui improvements and cleanup.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/240912dd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/240912dd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/240912dd
Branch: refs/heads/ignite-843
Commit: 240912dd2ef8a6789c07ff1fcb1edf30f67a8440
Parents: 6884c06
Author: AKuznetsov <ak...@gridgain.com>
Authored: Fri Aug 7 18:08:26 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Fri Aug 7 18:08:26 2015 +0700
----------------------------------------------------------------------
.../main/js/controllers/caches-controller.js | 10 +--
.../main/js/controllers/metadata-controller.js | 23 +++--
.../src/main/js/controllers/models/caches.json | 8 +-
.../main/js/controllers/models/clusters.json | 14 ++--
.../main/js/controllers/models/metadata.json | 18 ++--
.../src/main/js/views/configuration/caches.jade | 6 +-
.../main/js/views/configuration/clusters.jade | 6 +-
.../main/js/views/configuration/metadata.jade | 8 +-
.../main/js/views/configuration/summary.jade | 2 +-
.../src/main/js/views/includes/controls.jade | 88 ++++++++++----------
10 files changed, 89 insertions(+), 94 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/240912dd/modules/control-center-web/src/main/js/controllers/caches-controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/caches-controller.js b/modules/control-center-web/src/main/js/controllers/caches-controller.js
index 3469ff8..942fb8e 100644
--- a/modules/control-center-web/src/main/js/controllers/caches-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/caches-controller.js
@@ -134,7 +134,7 @@ controlCenterModule.controller('cachesController', ['$scope', '$http', '$common'
$scope.tableSimpleValid = function (item, field, fx, index) {
if (!$common.isValidJavaClass('SQL function', fx, false))
- return focusInvalidField(index, 'SqlFxField');
+ return focusInvalidField(index, 'SqlFx');
var model = item[field.model];
@@ -145,7 +145,7 @@ controlCenterModule.controller('cachesController', ['$scope', '$http', '$common'
if (idx >= 0 && idx != index) {
$common.showError('SQL function with such class name already exists!');
- return focusInvalidField(index, 'SqlFxField');
+ return focusInvalidField(index, 'SqlFx');
}
}
@@ -154,10 +154,10 @@ controlCenterModule.controller('cachesController', ['$scope', '$http', '$common'
$scope.tablePairValid = function (item, field, keyCls, valCls, index) {
if (!$common.isValidJavaClass('Indexed type key', keyCls, true))
- return focusInvalidField(index, 'IndexedType');
+ return focusInvalidField(index, 'KeyIndexedType');
if (!$common.isValidJavaClass('Indexed type value', valCls, true))
- return focusInvalidField(index, 'IndexedTypeNext');
+ return focusInvalidField(index, 'ValueIndexedType');
var model = item[field.model];
@@ -170,7 +170,7 @@ controlCenterModule.controller('cachesController', ['$scope', '$http', '$common'
if (idx >= 0 && idx != index) {
$common.showError('Indexed type with such key class already exists!');
- return focusInvalidField(index, 'IndexedType');
+ return focusInvalidField(index, 'KeyIndexedType');
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/240912dd/modules/control-center-web/src/main/js/controllers/metadata-controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/metadata-controller.js b/modules/control-center-web/src/main/js/controllers/metadata-controller.js
index 64ec7d2..15c48a1 100644
--- a/modules/control-center-web/src/main/js/controllers/metadata-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/metadata-controller.js
@@ -564,7 +564,7 @@ controlCenterModule.controller('metadataController', [
if (pairField) {
if (!$common.isValidJavaClass(pairField.msg, clsName, true))
- return focusInvalidField(index, pairField.id + 'Next');
+ return focusInvalidField(index, 'Value' + pairField.id);
var model = item[field.model];
@@ -577,7 +577,7 @@ controlCenterModule.controller('metadataController', [
if (idx >= 0 && idx != index) {
$common.showError('Field with such name already exists!');
- return focusInvalidField(index, pairField.id);
+ return focusInvalidField(index, 'Key' + pairField.id);
}
}
}
@@ -611,7 +611,7 @@ controlCenterModule.controller('metadataController', [
};
if (!$common.isValidJavaIdentifier(dbField.msg + ' java name', newJavaName))
- return focusInvalidField(index, dbField.id + 'Next');
+ return focusInvalidField(index, 'JavaName' + dbField.id);
if ($common.isDefined(model)) {
var idx = _.findIndex(model, function (dbMeta) {
@@ -620,9 +620,20 @@ controlCenterModule.controller('metadataController', [
// Found duplicate.
if (idx >= 0 && index != idx) {
- $common.showError('DB field with such name already exists!');
+ $common.showError('Field with such database name already exists!');
- return focusInvalidField(index, dbField.id);
+ return focusInvalidField(index, 'DatabaseName' + dbField.id);
+ }
+
+ idx = _.findIndex(model, function (dbMeta) {
+ return dbMeta.javaName == newJavaName
+ });
+
+ // Found duplicate.
+ if (idx >= 0 && index != idx) {
+ $common.showError('Field with such java name already exists!');
+
+ return focusInvalidField(index, 'JavaName' + dbField.id);
}
if (index < 0) {
@@ -738,7 +749,7 @@ controlCenterModule.controller('metadataController', [
function tableGroupItemValid(fieldName, className, groupIndex, index) {
if (!$common.isValidJavaClass('Group field', className, true))
- return focusInvalidField(index, 'FieldNameNext');
+ return focusInvalidField(index, 'FieldClassName');
var fields = $scope.backupItem.groups[groupIndex].fields;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/240912dd/modules/control-center-web/src/main/js/controllers/models/caches.json
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/models/caches.json b/modules/control-center-web/src/main/js/controllers/models/caches.json
index 09f668e..9d74986 100644
--- a/modules/control-center-web/src/main/js/controllers/models/caches.json
+++ b/modules/control-center-web/src/main/js/controllers/models/caches.json
@@ -387,8 +387,7 @@
"model": "indexedTypes",
"keyName": "keyClass",
"valueName": "valueClass",
- "focusNewItemId": "newIndexedType",
- "focusCurItemId": "curIndexedType",
+ "focusId": "IndexedType",
"addTip": "Add new key and value classes to indexed types.",
"removeTip": "Remove item from indexed types.",
"tip": [
@@ -399,10 +398,8 @@
"label": "SQL functions",
"type": "table-simple",
"model": "sqlFunctionClasses",
- "editIdx": -1,
"placeholder": "SQL function full class name",
- "focusNewItemId": "newSqlFxField",
- "focusCurItemId": "curSqlFxField",
+ "focusId": "SqlFx",
"addTip": "Add new user-defined functions for SQL queries.",
"removeTip": "Remove user-defined function.",
"tableTip": [
@@ -844,7 +841,6 @@
"type": "table-simple",
"path": "cacheStoreFactory.CacheHibernateBlobStoreFactory",
"model": "hibernateProperties",
- "editIdx": -1,
"placeholder": "key=value",
"addTip": "Add new Hibernate property.",
"removeTip": "Remove Hibernate property.",
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/240912dd/modules/control-center-web/src/main/js/controllers/models/clusters.json
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/models/clusters.json b/modules/control-center-web/src/main/js/controllers/models/clusters.json
index e95990d..0da0f58 100644
--- a/modules/control-center-web/src/main/js/controllers/models/clusters.json
+++ b/modules/control-center-web/src/main/js/controllers/models/clusters.json
@@ -65,12 +65,10 @@
"type": "table-simple",
"path": "discovery.Vm",
"model": "addresses",
- "editIdx": -1,
"reordering": true,
"ipaddress": true,
"placeholder": "IP address:port",
- "focusNewItemId": "newIpAddress",
- "focusCurItemId": "curIpAddress",
+ "focusId": "IpAddress",
"addTip": "Add new address.",
"removeTip": "Remove address.",
"tip": [
@@ -219,9 +217,8 @@
"type": "table-simple",
"path": "discovery.Cloud",
"model": "regions",
- "editIdx": -1,
- "focusNewItemId": "newRegion",
- "focusCurItemId": "curRegion",
+ "placeholder": "Region name",
+ "focusId": "Region",
"addTip": "Add new region.",
"removeTip": "Remove region.",
"tableTip": [
@@ -238,9 +235,8 @@
"type": "table-simple",
"path": "discovery.Cloud",
"model": "zones",
- "editIdx": -1,
- "focusNewItemId": "newZone",
- "focusCurItemId": "curZone",
+ "placeholder": "Zone name",
+ "focusId": "Zone",
"addTip": "Add new zone.",
"removeTip": "Remove zone.",
"tableTip": [
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/240912dd/modules/control-center-web/src/main/js/controllers/models/metadata.json
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/models/metadata.json b/modules/control-center-web/src/main/js/controllers/models/metadata.json
index 84ad9e4..ee73c11 100644
--- a/modules/control-center-web/src/main/js/controllers/models/metadata.json
+++ b/modules/control-center-web/src/main/js/controllers/models/metadata.json
@@ -95,8 +95,7 @@
"keyName": "name",
"valueName": "className",
"hide": "backupItem.kind == 'query' || isJavaBuildInClass()",
- "focusNewItemId": "newKeyField",
- "focusCurItemId": "curKeyField",
+ "focusId": "KeyField",
"addTip": "Add key field.",
"removeTip": "Remove key field.",
"tip": [
@@ -110,8 +109,7 @@
"keyName": "name",
"valueName": "className",
"hide": "backupItem.kind != 'both' && backupItem.kind == 'query'",
- "focusNewItemId": "newValueField",
- "focusCurItemId": "curValueField",
+ "focusId": "ValueField",
"addTip": "Add value field.",
"removeTip": "Remove value field.",
"tip": [
@@ -125,8 +123,7 @@
"keyName": "name",
"valueName": "className",
"hide": "backupItem.kind == 'store'",
- "focusNewItemId": "newQryField",
- "focusCurItemId": "curQryField",
+ "focusId": "QryField",
"addTip": "Add field to query.",
"removeTip": "Remove field.",
"tip": [
@@ -140,8 +137,7 @@
"keyName": "name",
"valueName": "className",
"hide": "backupItem.kind == 'store'",
- "focusNewItemId": "newAscField",
- "focusCurItemId": "curAscField",
+ "focusId": "AscField",
"addTip": "Add field to index in ascending order.",
"removeTip": "Remove field.",
"tip": [
@@ -155,8 +151,7 @@
"keyName": "name",
"valueName": "className",
"hide": "backupItem.kind == 'store'",
- "focusNewItemId": "newDescField",
- "focusCurItemId": "curDescField",
+ "focusId": "DescField",
"addTip": "Add field to index in descending order.",
"removeTip": "Remove field.",
"tip": [
@@ -169,8 +164,7 @@
"model": "textFields",
"hide": "backupItem.kind == 'store'",
"placeholder": "Field name",
- "focusNewItemId": "newTextField",
- "focusCurItemId": "curTextField",
+ "focusId": "TextField",
"addTip": "Add field to index as text.",
"removeTip": "Remove field.",
"tableTip": [
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/240912dd/modules/control-center-web/src/main/js/views/configuration/caches.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/configuration/caches.jade b/modules/control-center-web/src/main/js/views/configuration/caches.jade
index 4aeb740..92f98d0 100644
--- a/modules/control-center-web/src/main/js/views/configuration/caches.jade
+++ b/modules/control-center-web/src/main/js/views/configuration/caches.jade
@@ -33,7 +33,7 @@ block content
table.links(st-table='caches')
tbody
tr(ng-repeat='row in caches track by row._id')
- td.col-sm-6(ng-class='{active: row._id == selectedItem._id}')
+ td(ng-class='{active: row._id == selectedItem._id}')
a(event-focus='click' event-focus-id='defaultFocusId' ng-click='selectItem(row)') {{$index + 1}}) {{row.name}}, {{row.mode | displayValue:modes:'Cache mode not set'}}, {{row.atomicityMode | displayValue:atomicities:'Cache atomicity not set'}}
.padding-top-dflt
button.btn.btn-primary(event-focus='click' event-focus-id='defaultFocusId' ng-click='createItem()') Add cache
@@ -47,7 +47,7 @@ block content
.panel-collapse(bs-collapse-target)
.panel-body
.settings-row(ng-repeat='field in general')
- +form-row(['col-sm-3'], ['col-sm-3'])
+ +form-row(['col-sm-3'], ['col-sm-3'], 'backupItem')
.panel-group(bs-collapse data-allow-multiple='true')
div(bs-collapse data-start-collapsed='true')
.panel-title(ng-show='expanded')
@@ -65,7 +65,7 @@ block content
.panel-collapse(bs-collapse-target)
.panel-body
.settings-row(ng-repeat='field in group.fields')
- +form-row
+ +form-row('backupItem')
.panel-title
h3
i.fa.fa-chevron-circle-up(ng-show='expanded' ng-click='expanded = !expanded')
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/240912dd/modules/control-center-web/src/main/js/views/configuration/clusters.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/configuration/clusters.jade b/modules/control-center-web/src/main/js/views/configuration/clusters.jade
index c9e4397..d2e05ce 100644
--- a/modules/control-center-web/src/main/js/views/configuration/clusters.jade
+++ b/modules/control-center-web/src/main/js/views/configuration/clusters.jade
@@ -33,7 +33,7 @@ block content
table.links(st-table='clusters')
tbody
tr(ng-repeat='row in clusters track by row._id')
- td.col-sm-6(ng-class='{active: row._id == selectedItem._id}')
+ td(ng-class='{active: row._id == selectedItem._id}')
a(event-focus='click' event-focus-id='defaultFocusId' ng-click='selectItem(row)') {{$index + 1}}) {{row.name}}, {{row.discovery.kind | displayValue:discoveries:'Discovery not set'}}
.padding-top-dflt
button.btn.btn-primary(event-focus='click' event-focus-id='defaultFocusId' ng-click='createItem()')  Add cluster
@@ -50,7 +50,7 @@ block content
.panel-collapse(bs-collapse-target)
.panel-body
.settings-row(ng-repeat='field in general')
- +form-row
+ +form-row('backupItem')
.panel-group(bs-collapse data-allow-multiple='true')
div(bs-collapse data-start-collapsed='true')
.panel-title(ng-show='expanded')
@@ -68,7 +68,7 @@ block content
.panel-collapse(bs-collapse-target)
.panel-body
.settings-row(ng-repeat='field in group.fields')
- +form-row
+ +form-row('backupItem')
.panel-title
h3
i.fa.fa-chevron-circle-up(ng-show='expanded' ng-click='expanded = !expanded')
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/240912dd/modules/control-center-web/src/main/js/views/configuration/metadata.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/configuration/metadata.jade b/modules/control-center-web/src/main/js/views/configuration/metadata.jade
index 0c90085..1ee1312 100644
--- a/modules/control-center-web/src/main/js/views/configuration/metadata.jade
+++ b/modules/control-center-web/src/main/js/views/configuration/metadata.jade
@@ -33,7 +33,7 @@ block content
table.links(st-table='metadatas')
tbody
tr(ng-repeat='row in metadatas track by row._id')
- td.col-sm-6(ng-class='{active: row._id == selectedItem._id}')
+ td(ng-class='{active: row._id == selectedItem._id}')
a(event-focus='click' event-focus-id='defaultFocusId' ng-click='selectItem(row)') {{$index + 1}}) {{row.name}}
.padding-top-dflt
button.btn.btn-primary(event-focus='click' event-focus-id='defaultFocusId' ng-click='panels.activePanel = [0]; createItem()')  Add metadata
@@ -50,7 +50,7 @@ block content
.panel-body
form.form-horizontal(name='manualForm' ng-if='backupItem' novalidate)
.settings-row(ng-repeat='field in metadataManual')
- +form-row
+ +form-row('backupItem')
button.btn.btn-primary(ng-disabled='manualForm.$invalid' ng-click='saveItem()') Save
button.btn.btn-primary(ng-show='backupItem._id' ng-disabled='inputForm.$invalid' ng-click='saveItemAs()') Copy
button.btn.btn-primary.btn-second(ng-show='backupItem._id' ng-click='removeItem()') Remove
@@ -62,12 +62,12 @@ block content
.panel-body
form.form-horizontal(name='dbForm' novalidate)
.settings-row(ng-repeat='field in metadataDb')
- +form-row
+ +form-row('backupItem')
div(ng-hide='tables.length == 0')
table.links(st-table='tables')
tbody
tr(ng-repeat='row in tables')
- td.col-sm-6
+ td
a {{$index + 1}}) {{::row.schemaName}} / {{::row.tableName}}
button.btn.btn-primary(ng-disabled='dbForm.$invalid' ng-click='saveItem()') Save
button.btn.btn-primary.btn-second(ng-show='backupItem._id' ng-click='removeItem()') Remove
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/240912dd/modules/control-center-web/src/main/js/views/configuration/summary.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/configuration/summary.jade b/modules/control-center-web/src/main/js/views/configuration/summary.jade
index 07e177e..d9c5ebc 100644
--- a/modules/control-center-web/src/main/js/views/configuration/summary.jade
+++ b/modules/control-center-web/src/main/js/views/configuration/summary.jade
@@ -46,7 +46,7 @@ block content
table.links(st-table='clusters')
tbody
tr(ng-repeat='row in clusters track by row._id')
- td.col-sm-6(ng-class='{active: row._id == selectedItem._id}')
+ td(ng-class='{active: row._id == selectedItem._id}')
a(ng-click='selectItem(row)') {{$index + 1}}) {{row.name}}
div(ng-show='selectedItem' role='tab' method='post' action='summary/download')
.padding-dflt(bs-collapse data-start-collapsed='false')
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/240912dd/modules/control-center-web/src/main/js/views/includes/controls.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/includes/controls.jade b/modules/control-center-web/src/main/js/views/includes/controls.jade
index 3f4cd49..69564df 100644
--- a/modules/control-center-web/src/main/js/views/includes/controls.jade
+++ b/modules/control-center-web/src/main/js/views/includes/controls.jade
@@ -53,15 +53,16 @@ mixin btn-down(show, click)
i.tipField.fa.fa-arrow-down(ng-show=show ng-click=click bs-tooltip data-title='Move item down')
mixin table-pair-edit(keyModel, valModel, keyPlaceholder, valPlaceholder, keyJavaBuildInTypes, valueJavaBuildInTypes, focusId, index)
- -var focusIdNext = focusId + 'Next'
+ -var focusIdKey = keyModel + focusId
+ -var focusIdVal = valModel + focusId
.col-sm-6
label.fieldSep /
.input-tip
if keyJavaBuildInTypes
- input.form-control(id=focusId enter-focus-next enter-focus-next-id=focusIdNext type='text' ng-model=keyModel placeholder=keyPlaceholder bs-typeahead retain-selection data-min-length='1' bs-options='javaClass for javaClass in javaBuildInClasses' on-escape='tableReset()')
+ input.form-control(id=focusIdKey enter-focus-next enter-focus-next-id=focusIdVal type='text' ng-model=keyModel placeholder=keyPlaceholder bs-typeahead retain-selection data-min-length='1' bs-options='javaClass for javaClass in javaBuildInClasses' on-escape='tableReset()')
else
- input.form-control(id=focusId enter-focus-next enter-focus-next-id=focusIdNext type='text' ng-model=keyModel placeholder=keyPlaceholder on-escape='tableReset()')
+ input.form-control(id=focusIdKey enter-focus-next enter-focus-next-id=focusIdVal type='text' ng-model=keyModel placeholder=keyPlaceholder on-escape='tableReset()')
.col-sm-6
-var arg = keyModel + ', ' + valModel
-var btnVisible = 'tablePairSaveVisible(' + arg + ')'
@@ -71,29 +72,29 @@ mixin table-pair-edit(keyModel, valModel, keyPlaceholder, valPlaceholder, keyJav
+btn-save(btnVisible, btnSave)
.input-tip
if valueJavaBuildInTypes
- input.form-control(id=focusIdNext type='text' ng-model=valModel placeholder=valPlaceholder bs-typeahead retain-selection data-min-length='1' bs-options='javaClass for javaClass in javaBuildInClasses' on-enter=btnVisibleAndSave on-escape='tableReset()')
+ input.form-control(id=focusIdVal type='text' ng-model=valModel placeholder=valPlaceholder bs-typeahead retain-selection data-min-length='1' bs-options='javaClass for javaClass in javaBuildInClasses' on-enter=btnVisibleAndSave on-escape='tableReset()')
else
- input.form-control(id=focusIdNext type='text' ng-model=valModel placeholder=valPlaceholder on-enter=btnVisibleAndSave on-escape='tableReset()')
+ input.form-control(id=focusIdVal type='text' ng-model=valModel placeholder=valPlaceholder on-enter=btnVisibleAndSave on-escape='tableReset()')
mixin table-pair(header, tblMdl, keyFld, valFld, keyPlaceholder, valPlaceholder, keyJavaBuildInTypes, valueJavaBuildInTypes)
- .col-sm-6
+ .col-sm-7
label.table-header #{header}:
+tipLabel('field.tip')
- +btn-add('tableNewItem(field)', 'field.addTip', '{{::field.focusNewItemId}}')
+ +btn-add('tableNewItem(field)', 'field.addTip', 'newKey{{::field.focusId}}')
.table-details(ng-show='(#{tblMdl} && #{tblMdl}.length > 0) || tableNewItemActive(field)')
table.links-edit.col-sm-12(st-table=tblMdl)
tbody
tr(ng-repeat='item in #{tblMdl}')
td.col-sm-12
div(ng-show='!tableEditing(field, $index)')
- a.labelFormField(event-focus='click' event-focus-id='{{::field.focusCurItemId}}' ng-click='curPair = tableStartEdit(backupItem, field, $index); curKey = curPair.#{keyFld}; curValue = curPair.#{valFld}') {{$index + 1}}) {{item.#{keyFld}}} / {{item.#{valFld}}}
+ a.labelFormField(event-focus='click' event-focus-id='curKey{{::field.focusId}}' ng-click='curPair = tableStartEdit(backupItem, field, $index); curKey = curPair.#{keyFld}; curValue = curPair.#{valFld}') {{$index + 1}}) {{item.#{keyFld}}} / {{item.#{valFld}}}
+btn-remove('tableRemove(backupItem, field, $index)', 'field.removeTip')
div(ng-if='tableEditing(field, $index)')
- +table-pair-edit('curKey', 'curValue', keyPlaceholder, valPlaceholder, keyJavaBuildInTypes, valueJavaBuildInTypes, '{{::field.focusCurItemId}}', '$index')
+ +table-pair-edit('curKey', 'curValue', keyPlaceholder, valPlaceholder, keyJavaBuildInTypes, valueJavaBuildInTypes, '{{::field.focusId}}', '$index')
tfoot(ng-show='tableNewItemActive(field)')
tr
td.col-sm-12
- +table-pair-edit('newKey', 'newValue', keyPlaceholder, valPlaceholder, keyJavaBuildInTypes, valueJavaBuildInTypes, '{{::field.focusNewItemId}}', '-1')
+ +table-pair-edit('newKey', 'newValue', keyPlaceholder, valPlaceholder, keyJavaBuildInTypes, valueJavaBuildInTypes, '{{::field.focusId}}', '-1')
mixin details-row
- var lblDetailClasses = ['col-sm-4', 'details-label']
@@ -147,7 +148,7 @@ mixin details-row
tr(ng-repeat='item in #{detailMdl} track by $index')
td
div(ng-show='!tableEditing(detail, $index)')
- a.labelFormField(event-focus='click' event-focus-id='{{::detail.focusCurItemId}}' ng-click='curValue = tableStartEdit(backupItem, detail, $index)') {{$index + 1}}) {{item}}
+ a.labelFormField(event-focus='click' event-focus-id='cur{{::detail.focusId}}' ng-click='curValue = tableStartEdit(backupItem, detail, $index)') {{$index + 1}}) {{item}}
+btn-remove('tableRemove(backupItem, detail, $index)', 'detail.removeTip')
+btn-down('detail.reordering && tableSimpleDownVisible(backupItem, detail, $index)', 'tableSimpleDown(backupItem, detail, $index)')
+btn-up('detail.reordering && $index > 0', 'tableSimpleUp(backupItem, detail, $index)')
@@ -155,41 +156,38 @@ mixin details-row
label.labelField {{$index + 1}})
+btn-save('tableSimpleSaveVisible(curValue)', 'tableSimpleSave(tableSimpleValid, backupItem, detail, curValue, $index)')
.input-tip.form-group.has-feedback
- input.form-control(id='{{::detail.focusCurItemId}}' name='{{detail.model}}.edit' type='text' ng-model='curValue' placeholder='{{::detail.placeholder}}' on-enter='tableSimpleSave(tableSimpleValid, backupItem, detail, curValue, $index)' on-escape='tableReset()')&attributes(customValidators)
+ input.form-control(id='cur{{::detail.focusId}}' name='{{detail.model}}.edit' type='text' ng-model='curValue' placeholder='{{::detail.placeholder}}' on-enter='tableSimpleSave(tableSimpleValid, backupItem, detail, curValue, $index)' on-escape='tableReset()')&attributes(customValidators)
+ico-exclamation('{{detail.model}}.edit', 'ipaddress', 'Invalid address, see help for format description.')
button.btn.btn-primary.fieldButton(ng-disabled='!newValue' ng-click='tableSimpleSave(tableSimpleValid, backupItem, detail, newValue, -1)') Add
+tipField('detail.tip')
.input-tip.form-group.has-feedback
- input.form-control(name='{{detail.model}}' type='text' ng-model='newValue' ng-focus='tableNewItem(detail)' placeholder='{{::detail.placeholder}}' on-enter='tableSimpleSave(tableSimpleValid, backupItem, detail, newValue, -1)' on-escape='tableReset()')&attributes(customValidators)
+ input.form-control(id='new{{::detail.focusId}}' name='{{detail.model}}' type='text' ng-model='newValue' ng-focus='tableNewItem(detail)' placeholder='{{::detail.placeholder}}' on-enter='tableSimpleSave(tableSimpleValid, backupItem, detail, newValue, -1)' on-escape='tableReset()')&attributes(customValidators)
+ico-exclamation('{{detail.model}}', 'ipaddress', 'Invalid address, see help for format description.')
-mixin table-db-field-edit(databaseName, databaseType, javaName, javaType, focusId, index)
- -var focusIdNext = focusId + 'Next'
-
+mixin table-db-field-edit(databaseName, databaseType, javaName, javaType, index)
.col-sm-3
label.fieldSep /
.input-tip
- input.form-control(id=focusId enter-focus-next enter-focus-next-id=focusIdNext type='text' ng-model=databaseName placeholder='DB name' on-escape='tableReset()')
+ input.form-control(id=databaseName enter-focus-next enter-focus-next-id=databaseType type='text' ng-model=databaseName placeholder='DB name' on-escape='tableReset()')
.col-sm-3
label.fieldSep /
.input-tip
- button.form-control(ng-model=databaseType bs-select data-placeholder='JDBC type' bs-options='item.value as item.label for item in {{jdbcTypes}}')
+ select.form-control(id=databaseType enter-focus-next enter-focus-next-id=javaName ng-model=databaseType ng-options='item.value as item.label for item in {{jdbcTypes}}' on-escape='tableReset()')
.col-sm-3
label.fieldSep /
.input-tip
- input.form-control(id=focusIdNext type='text' ng-model=javaName placeholder='Java name' on-escape='tableReset()')
+ input.form-control(id=javaName enter-focus-next enter-focus-next-id=javaType type='text' ng-model=javaName placeholder='Java name' on-escape='tableReset()')
.col-sm-3
-var args = databaseName + ', ' + databaseType + ', ' + javaName + ', ' + javaType
-var btnVisible = 'tableDbFieldSaveVisible(' + args + ')'
-var btnSave = 'tableDbFieldSave(field, ' + args + ', ' + index +')'
+ -var btnVisibleAndSave = btnVisible + ' && ' + btnSave
+btn-save(btnVisible, btnSave)
.input-tip
- button.form-control(ng-model=javaType bs-select data-placeholder='Java type' bs-options='item.value as item.label for item in {{javaTypes}}')
+ select.form-control(id=javaType ng-model=javaType ng-options='item.value as item.label for item in {{javaTypes}}' on-enter=btnVisibleAndSave on-escape='tableReset()')
mixin table-group-item-edit(fieldName, className, direction, index)
- -var focusIdNext = fieldName + 'Next'
- -var focusIdNext2 = fieldName + 'Next2'
-var args = fieldName + ', ' + className
-var btnVisible = 'tableGroupItemSaveVisible(' + args + ')'
-var btnSave = 'tableGroupItemSave(' + args + ', ' + direction + ', groupIndex, ' + index +')'
@@ -198,18 +196,18 @@ mixin table-group-item-edit(fieldName, className, direction, index)
.col-sm-4
label.fieldSep /
.input-tip
- input.form-control(id=fieldName enter-focus-next enter-focus-next-id=focusIdNext type='text' ng-model=fieldName placeholder='Field name' on-escape='tableReset()')
+ input.form-control(id=fieldName enter-focus-next enter-focus-next-id=className type='text' ng-model=fieldName placeholder='Field name' on-escape='tableReset()')
.col-sm-5
label.fieldSep /
.input-tip
- input.form-control(id=focusIdNext enter-focus-next enter-focus-next-id=focusIdNext2 type='text' ng-model=className placeholder='Class name' bs-typeahead retain-selection data-min-length='1' bs-options='javaClass for javaClass in javaBuildInClasses' on-escape='tableReset()')
+ input.form-control(id=className enter-focus-next enter-focus-next-id=direction type='text' ng-model=className placeholder='Class name' bs-typeahead retain-selection data-min-length='1' bs-options='javaClass for javaClass in javaBuildInClasses' on-escape='tableReset()')
.col-sm-3
+btn-save(btnVisible, btnSave)
.input-tip
- select.form-control(id=focusIdNext2 ng-model=direction ng-options='item.value as item.label for item in {{sortDirections}}' on-enter=btnVisibleAndSave on-escape='tableReset()')
+ select.form-control(id=direction ng-model=direction ng-options='item.value as item.label for item in {{sortDirections}}' on-enter=btnVisibleAndSave on-escape='tableReset()')
-mixin form-row
- +form-row-custom(['col-sm-2'], ['col-sm-4'], 'backupItem')
+mixin form-row(dataSource)
+ +form-row-custom(['col-sm-2'], ['col-sm-5'], dataSource)
mixin form-row-custom(lblClasses, fieldClasses, dataSource)
- var fieldMdl = 'getModel('+ dataSource + ', field)[field.model]';
@@ -218,9 +216,9 @@ mixin form-row-custom(lblClasses, fieldClasses, dataSource)
- var fieldHide = '{{field.hide}}'
div(ng-switch='field.type')
- div.col-sm-6(ng-switch-when='label')
+ div(ng-switch-when='label')
label {{::field.label}}
- div.checkbox.col-sm-6(ng-switch-when='check' ng-hide=fieldHide)
+ div.checkbox(ng-switch-when='check' ng-hide=fieldHide)
label
input(type='checkbox')&attributes(fieldCommon)
| {{::field.label}}
@@ -280,23 +278,23 @@ mixin form-row-custom(lblClasses, fieldClasses, dataSource)
.input-tip
button.form-control(bs-select data-placeholder='{{::field.placeholder}}' bs-options='item.value as item.label for item in {{field.items}}')&attributes(fieldCommon)
a.customize(ng-show='#{fieldMdl} && field.details[#{fieldMdl}].fields' ng-click='#{expanded} = !#{expanded}') {{#{expanded} ? "Hide settings" : "Show settings"}}
- .col-sm-6.panel-details(ng-show='#{expanded} && #{fieldMdl}')
+ .col-sm-7.panel-details(ng-show='#{expanded} && #{fieldMdl}')
.details-row(ng-repeat='detail in field.details[#{fieldMdl}].fields')
+details-row
div(ng-switch-when='table-simple' ng-hide=fieldHide)&attributes(fieldCommon)
- .col-sm-6
+ .col-sm-7
label.table-header {{::field.label}}:
+tipLabel('field.tableTip')
- +btn-add('tableNewItem(field)', 'field.addTip', '{{::field.focusNewItemId}}')
+ +btn-add('tableNewItem(field)', 'field.addTip', 'new{{::field.focusId}}')
.col-sm-12(ng-show='(#{fieldMdl} && #{fieldMdl}.length > 0) || tableNewItemActive(field)')
- .col-sm-6
+ .col-sm-7
.table-details
table.links-edit.col-sm-12(st-table='#{fieldMdl}')
tbody
tr(ng-repeat='item in #{fieldMdl} track by $index')
td.col-sm-12
div(ng-show='!tableEditing(field, $index)')
- a.labelFormField(event-focus='click' event-focus-id='{{::field.focusCurItemId}}' ng-click='curValue = tableStartEdit(backupItem, field, $index)') {{$index + 1}}) {{item | compact}}
+ a.labelFormField(event-focus='click' event-focus-id='cur{{::field.focusId}}' ng-click='curValue = tableStartEdit(backupItem, field, $index)') {{$index + 1}}) {{item | compact}}
+btn-remove('tableRemove(backupItem, field, $index)', 'field.removeTip')
+btn-down('field.reordering && tableSimpleDownVisible(backupItem, field, $index)', 'tableSimpleDown(backupItem, field, $index)')
+btn-up('field.reordering && $index > 0', 'tableSimpleUp(backupItem, field, $index)')
@@ -304,45 +302,45 @@ mixin form-row-custom(lblClasses, fieldClasses, dataSource)
label.labelField {{$index + 1}})
+btn-save('tableSimpleSaveVisible(curValue)', 'tableSimpleSave(tableSimpleValid, backupItem, field, curValue, $index)')
.input-tip
- input.form-control(id='{{::field.focusCurItemId}}' type='text' ng-model='curValue' placeholder='{{::field.placeholder}}' on-enter='tableSimpleSaveVisible(curValue) && tableSimpleSave(tableSimpleValid, backupItem, field, curValue, $index)' on-escape='tableReset()')
+ input.form-control(id='cur{{::field.focusId}}' type='text' ng-model='curValue' placeholder='{{::field.placeholder}}' on-enter='tableSimpleSaveVisible(curValue) && tableSimpleSave(tableSimpleValid, backupItem, field, curValue, $index)' on-escape='tableReset()')
tfoot(ng-show='tableNewItemActive(field)')
tr
td.col-sm-12
+btn-save('tableSimpleSaveVisible(newValue)', 'tableSimpleSave(tableSimpleValid, backupItem, field, newValue, -1)')
.input-tip
- input.form-control(id='{{::field.focusNewItemId}}' type='text' ng-model='newValue' placeholder='{{::field.placeholder}}' on-enter='tableSimpleSaveVisible(newValue) && tableSimpleSave(tableSimpleValid, backupItem, field, newValue, -1)' on-escape='tableReset()')
+ input.form-control(id='new{{::field.focusId}}' type='text' ng-model='newValue' placeholder='{{::field.placeholder}}' on-enter='tableSimpleSaveVisible(newValue) && tableSimpleSave(tableSimpleValid, backupItem, field, newValue, -1)' on-escape='tableReset()')
div(ng-switch-when='indexedTypes')
+table-pair('Index key-value type pairs', fieldMdl, 'keyClass', 'valueClass', 'Key class full name', 'Value class full name', true, false)
div(ng-switch-when='queryFields' ng-hide=fieldHide)
+table-pair('{{::field.label}}', fieldMdl, 'name', 'className', 'Field name', 'Field class full name', false, true)
div(ng-switch-when='dbFields' ng-hide=fieldHide)
- .col-sm-6
+ .col-sm-7
label.table-header {{::field.label}}:
+tipLabel('field.tip')
- +btn-add('tableNewItem(field)', 'field.addTip', '{{::field.focusNewItemId}}')
+ +btn-add('tableNewItem(field)', 'field.addTip', 'newDatabaseName{{::field.focusId}}')
.col-sm-12(ng-show='(#{fieldMdl} && #{fieldMdl}.length > 0) || tableNewItemActive(field)')
- .col-sm-6
+ .col-sm-7
.table-details
table.links-edit.col-sm-12(st-table=fieldMdl)
tbody
tr(ng-repeat='item in #{fieldMdl}')
td.col-sm-12
div(ng-show='!tableEditing(field, $index)')
- a.labelFormField(event-focus='click' event-focus-id='{{::field.focusCurItemId}}' ng-click='curField = tableStartEdit(backupItem, field, $index); curDatabaseName = curField.databaseName; curDatabaseType = curField.databaseType; curJavaName = curField.javaName; curJavaType = curField.javaType') {{$index + 1}}) {{item.databaseName}} / {{item.databaseType}} / {{item.javaName}} / {{item.javaType}}
+ a.labelFormField(event-focus='click' event-focus-id='curDatabaseName' ng-click='curField = tableStartEdit(backupItem, field, $index); curDatabaseName = curField.databaseName; curDatabaseType = curField.databaseType; curJavaName = curField.javaName; curJavaType = curField.javaType') {{$index + 1}}) {{item.databaseName}} / {{item.databaseType}} / {{item.javaName}} / {{item.javaType}}
+btn-remove('tableRemove(backupItem, field, $index)', 'field.removeTip')
div(ng-if='tableEditing(field, $index)')
- +table-db-field-edit('curDatabaseName', 'curDatabaseType', 'curJavaName', 'curJavaType', '{{::field.focusCurItemId}}', '$index')
+ +table-db-field-edit('curDatabaseName', 'curDatabaseType', 'curJavaName', 'curJavaType', '$index')
tfoot(ng-show='tableNewItemActive(field)')
tr
- td.col-sm-12
- +table-db-field-edit('newDatabaseName', 'newDatabaseType', 'newJavaName', 'newJavaType', '{{::field.focusNewItemId}}', '-1')
+ td.col-sm-12(ng-init='newDatabaseType="INTEGER"; newJavaType="Integer"')
+ +table-db-field-edit('newDatabaseName', 'newDatabaseType', 'newJavaName', 'newJavaType', '-1')
div(ng-switch-when='queryGroups' ng-hide=fieldHide)
- .col-sm-6
+ .col-sm-7
label.table-header {{::field.label}}:
+tipLabel('field.tip')
+btn-add('tableNewItem(field)', 'field.addTip', 'newGroupName')
.col-sm-12(ng-show='(#{fieldMdl} && #{fieldMdl}.length > 0) || tableNewItemActive(field)')
- .col-sm-6
+ .col-sm-7
.table-details
table.links-edit.col-sm-12(st-table=fieldMdl ng-init='newDirection = false')
tbody
[13/17] incubator-ignite git commit: # ignite-1142
Posted by ak...@apache.org.
# ignite-1142
Signed-off-by: Yakov Zhdanov <yz...@gridgain.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/d7dd4a02
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/d7dd4a02
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/d7dd4a02
Branch: refs/heads/ignite-843
Commit: d7dd4a0272aff8e00324254ac97f47393d05f70c
Parents: 63944d4
Author: S.Vladykin <sv...@gridgain.com>
Authored: Thu Aug 6 16:24:56 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Aug 6 16:27:59 2015 +0300
----------------------------------------------------------------------
.../cache/query/GridCacheSqlQuery.java | 33 ++-
.../cache/query/GridCacheTwoStepQuery.java | 34 +--
.../processors/query/h2/IgniteH2Indexing.java | 27 +-
.../processors/query/h2/sql/GridSqlElement.java | 18 +-
.../query/h2/sql/GridSqlFunction.java | 17 +-
.../processors/query/h2/sql/GridSqlQuery.java | 4 +-
.../query/h2/sql/GridSqlQueryParser.java | 94 ++++---
.../query/h2/sql/GridSqlQuerySplitter.java | 117 +++++----
.../processors/query/h2/sql/GridSqlSelect.java | 76 +++---
.../processors/query/h2/sql/GridSqlType.java | 24 +-
.../processors/query/h2/sql/GridSqlUnion.java | 2 +-
.../h2/twostep/GridReduceQueryExecutor.java | 211 ++++++---------
.../query/h2/twostep/GridThreadLocalTable.java | 262 +++++++++++++++++++
.../IgniteCacheAbstractFieldsQuerySelfTest.java | 2 +-
14 files changed, 614 insertions(+), 307 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d7dd4a02/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java
index 7a0e140..d5eb379 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java
@@ -26,6 +26,7 @@ import org.apache.ignite.marshaller.*;
import org.apache.ignite.plugin.extensions.communication.*;
import java.nio.*;
+import java.util.*;
/**
* Query.
@@ -38,9 +39,6 @@ public class GridCacheSqlQuery implements Message {
public static final Object[] EMPTY_PARAMS = {};
/** */
- private String alias;
-
- /** */
@GridToStringInclude
private String qry;
@@ -52,6 +50,11 @@ public class GridCacheSqlQuery implements Message {
/** */
private byte[] paramsBytes;
+ /** */
+ @GridToStringInclude
+ @GridDirectTransient
+ private LinkedHashMap<String, ?> columns;
+
/**
* For {@link Message}.
*/
@@ -60,24 +63,32 @@ public class GridCacheSqlQuery implements Message {
}
/**
- * @param alias Alias.
* @param qry Query.
* @param params Query parameters.
*/
- public GridCacheSqlQuery(String alias, String qry, Object[] params) {
+ public GridCacheSqlQuery(String qry, Object[] params) {
A.ensure(!F.isEmpty(qry), "qry must not be empty");
- this.alias = alias;
this.qry = qry;
this.params = F.isEmpty(params) ? EMPTY_PARAMS : params;
}
/**
- * @return Alias.
+ * @return Columns.
*/
- public String alias() {
- return alias;
+ public LinkedHashMap<String, ?> columns() {
+ return columns;
+ }
+
+ /**
+ * @param columns Columns.
+ * @return {@code this}.
+ */
+ public GridCacheSqlQuery columns(LinkedHashMap<String, ?> columns) {
+ this.columns = columns;
+
+ return this;
}
/**
@@ -138,7 +149,7 @@ public class GridCacheSqlQuery implements Message {
switch (writer.state()) {
case 0:
- if (!writer.writeString("alias", alias))
+ if (!writer.writeString("alias", null))
return false;
writer.incrementState();
@@ -169,7 +180,7 @@ public class GridCacheSqlQuery implements Message {
switch (reader.state()) {
case 0:
- alias = reader.readString("alias");
+ reader.readString("alias");
if (!reader.isLastRead())
return false;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d7dd4a02/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
index 1dacd10..83a79e3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
@@ -17,10 +17,7 @@
package org.apache.ignite.internal.processors.cache.query;
-import org.apache.ignite.*;
-import org.apache.ignite.internal.util.*;
import org.apache.ignite.internal.util.tostring.*;
-import org.apache.ignite.internal.util.typedef.*;
import org.apache.ignite.internal.util.typedef.internal.*;
import java.util.*;
@@ -34,11 +31,11 @@ public class GridCacheTwoStepQuery {
/** */
@GridToStringInclude
- private Map<String, GridCacheSqlQuery> mapQrys;
+ private List<GridCacheSqlQuery> mapQrys = new ArrayList<>();
/** */
@GridToStringInclude
- private GridCacheSqlQuery reduce;
+ private GridCacheSqlQuery rdc;
/** */
private int pageSize = DFLT_PAGE_SIZE;
@@ -51,13 +48,14 @@ public class GridCacheTwoStepQuery {
/**
* @param spaces All spaces accessed in query.
- * @param qry Reduce query.
- * @param params Reduce query parameters.
+ * @param rdc Reduce query.
*/
- public GridCacheTwoStepQuery(Set<String> spaces, String qry, Object ... params) {
+ public GridCacheTwoStepQuery(Set<String> spaces, GridCacheSqlQuery rdc) {
+ assert rdc != null;
+
this.spaces = spaces;
- reduce = new GridCacheSqlQuery(null, qry, params);
+ this.rdc = rdc;
}
/**
@@ -89,32 +87,24 @@ public class GridCacheTwoStepQuery {
}
/**
- * @param alias Alias.
* @param qry SQL Query.
- * @param params Query parameters.
*/
- public void addMapQuery(String alias, String qry, Object ... params) {
- A.ensure(!F.isEmpty(alias), "alias must not be empty");
-
- if (mapQrys == null)
- mapQrys = new GridLeanMap<>();
-
- if (mapQrys.put(alias, new GridCacheSqlQuery(alias, qry, params)) != null)
- throw new IgniteException("Failed to add query, alias already exists: " + alias + ".");
+ public void addMapQuery(GridCacheSqlQuery qry) {
+ mapQrys.add(qry);
}
/**
* @return Reduce query.
*/
public GridCacheSqlQuery reduceQuery() {
- return reduce;
+ return rdc;
}
/**
* @return Map queries.
*/
- public Collection<GridCacheSqlQuery> mapQueries() {
- return mapQrys.values();
+ public List<GridCacheSqlQuery> mapQueries() {
+ return mapQrys;
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d7dd4a02/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 c76dbe7..dc61d76 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
@@ -599,6 +599,9 @@ public class IgniteH2Indexing implements GridQueryIndexing {
String name = rsMeta.getColumnLabel(i);
String type = rsMeta.getColumnClassName(i);
+ if (type == null) // Expression always returns NULL.
+ type = Void.class.getName();
+
meta.add(new SqlFieldMetadata(schemaName, typeName, name, type));
}
@@ -852,6 +855,14 @@ public class IgniteH2Indexing implements GridQueryIndexing {
throw new CacheException("Failed to parse query: " + sqlQry, e);
}
+ try {
+ bindParameters(stmt, F.asList(qry.getArgs()));
+ }
+ catch (IgniteCheckedException e) {
+ throw new CacheException("Failed to bind parameters: [qry=" + sqlQry + ", params=" +
+ Arrays.deepToString(qry.getArgs()) + "]", e);
+ }
+
GridCacheTwoStepQuery twoStepQry;
List<GridQueryFieldMetadata> meta;
@@ -1318,14 +1329,20 @@ public class IgniteH2Indexing implements GridQueryIndexing {
}
}
- executeStatement("INFORMATION_SCHEMA", "SHUTDOWN");
-
for (Connection c : conns)
U.close(c, log);
conns.clear();
schemas.clear();
+ try (Connection c = DriverManager.getConnection(dbUrl);
+ Statement s = c.createStatement()) {
+ s.execute("SHUTDOWN");
+ }
+ catch (SQLException e) {
+ U.error(log, "Failed to shutdown database.", e);
+ }
+
if (log.isDebugEnabled())
log.debug("Cache query index stopped.");
}
@@ -1341,9 +1358,6 @@ public class IgniteH2Indexing implements GridQueryIndexing {
createSchema(schema);
- executeStatement(schema, "CREATE ALIAS " + GridSqlQuerySplitter.TABLE_FUNC_NAME +
- " NOBUFFER FOR \"" + GridReduceQueryExecutor.class.getName() + ".mergeTableFunction\"");
-
createSqlFunctions(schema, ccfg.getSqlFunctionClasses());
}
@@ -1881,8 +1895,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
* @param type Type.
*/
SqlFieldMetadata(@Nullable String schemaName, @Nullable String typeName, String name, String type) {
- assert name != null;
- assert type != null;
+ assert name != null && type != null : schemaName + " | " + typeName + " | " + name + " | " + type;
this.schemaName = schemaName;
this.typeName = typeName;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d7dd4a02/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlElement.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlElement.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlElement.java
index 44705de..0f98a33 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlElement.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlElement.java
@@ -27,7 +27,7 @@ public abstract class GridSqlElement implements Iterable<GridSqlElement> {
protected List<GridSqlElement> children;
/** */
- private GridSqlType expressionResultType;
+ private GridSqlType resultType;
/**
* @param children Initial child list.
@@ -41,15 +41,18 @@ public abstract class GridSqlElement implements Iterable<GridSqlElement> {
/**
* @return Optional expression result type (if this is an expression and result type is known).
*/
- public GridSqlType expressionResultType() {
- return expressionResultType;
+ public GridSqlType resultType() {
+ return resultType;
}
/**
* @param type Optional expression result type (if this is an expression and result type is known).
+ * @return {@code this}.
*/
- public void expressionResultType(GridSqlType type) {
- expressionResultType = type;
+ public GridSqlElement resultType(GridSqlType type) {
+ resultType = type;
+
+ return this;
}
/**
@@ -110,4 +113,9 @@ public abstract class GridSqlElement implements Iterable<GridSqlElement> {
@Override public Iterator<GridSqlElement> iterator() {
return children.iterator();
}
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return getSQL();
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d7dd4a02/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlFunction.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlFunction.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlFunction.java
index c41bbb7..77039b0 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlFunction.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlFunction.java
@@ -50,9 +50,6 @@ public class GridSqlFunction extends GridSqlElement {
/** */
protected final GridSqlFunctionType type;
- /** */
- private String castType;
-
/**
* @param type Function type.
*/
@@ -87,16 +84,6 @@ public class GridSqlFunction extends GridSqlElement {
this(schema, TYPE_MAP.get(name), name);
}
- /**
- * @param castType Type for {@link GridSqlFunctionType#CAST} function.
- * @return {@code this}.
- */
- public GridSqlFunction setCastType(String castType) {
- this.castType = castType;
-
- return this;
- }
-
/** {@inheritDoc} */
@Override public String getSQL() {
StatementBuilder buff = new StatementBuilder();
@@ -123,12 +110,16 @@ public class GridSqlFunction extends GridSqlElement {
buff.append('(');
if (type == CAST) {
+ String castType = resultType().sql();
+
assert !F.isEmpty(castType) : castType;
assert size() == 1;
buff.append(child().getSQL()).append(" AS ").append(castType);
}
else if (type == CONVERT) {
+ String castType = resultType().sql();
+
assert !F.isEmpty(castType) : castType;
assert size() == 1;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d7dd4a02/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuery.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuery.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuery.java
index ad13dfe..329304a 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuery.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuery.java
@@ -134,7 +134,7 @@ public abstract class GridSqlQuery {
* @param col Column index.
* @return Expression for column index.
*/
- protected abstract GridSqlElement expression(int col);
+ protected abstract GridSqlElement column(int col);
/**
* @param buff Statement builder.
@@ -157,7 +157,7 @@ public abstract class GridSqlQuery {
if (idx < visibleCols)
buff.append(idx + 1);
else {
- GridSqlElement expr = expression(idx);
+ GridSqlElement expr = column(idx);
if (expr == null) // For plain select should never be null, for union H2 itself can't parse query.
throw new IllegalStateException("Failed to build query: " + buff.toString());
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d7dd4a02/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
index 4267b4a..a52f3b0 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
@@ -22,7 +22,6 @@ import org.h2.command.*;
import org.h2.command.dml.*;
import org.h2.engine.*;
import org.h2.expression.*;
-import org.h2.expression.Parameter;
import org.h2.jdbc.*;
import org.h2.result.*;
import org.h2.table.*;
@@ -205,12 +204,12 @@ public class GridSqlQueryParser {
res = new GridSqlSubquery(parse(qry));
}
else if (tbl instanceof FunctionTable)
- res = parseExpression(FUNC_EXPR.get((FunctionTable)tbl));
+ res = parseExpression(FUNC_EXPR.get((FunctionTable)tbl), false);
else if (tbl instanceof RangeTable) {
res = new GridSqlFunction(GridSqlFunctionType.SYSTEM_RANGE);
- res.addChild(parseExpression(RANGE_MIN.get((RangeTable)tbl)));
- res.addChild(parseExpression(RANGE_MAX.get((RangeTable)tbl)));
+ res.addChild(parseExpression(RANGE_MIN.get((RangeTable)tbl), false));
+ res.addChild(parseExpression(RANGE_MAX.get((RangeTable)tbl), false));
}
else
assert0(false, filter.getSelect().getSQL());
@@ -242,7 +241,7 @@ public class GridSqlQueryParser {
res.distinct(select.isDistinct());
Expression where = CONDITION.get(select);
- res.where(parseExpression(where));
+ res.where(parseExpression(where, false));
Set<TableFilter> allFilters = new HashSet<>(select.getTopFilters());
@@ -257,7 +256,7 @@ public class GridSqlQueryParser {
GridSqlElement gridFilter = parseTable(filter);
from = from == null ? gridFilter : new GridSqlJoin(from, gridFilter, filter.isJoinOuter(),
- parseExpression(filter.getJoinCondition()));
+ parseExpression(filter.getJoinCondition(), false));
allFilters.remove(filter);
@@ -272,7 +271,7 @@ public class GridSqlQueryParser {
ArrayList<Expression> expressions = select.getExpressions();
for (int i = 0; i < expressions.size(); i++)
- res.addSelectExpression(parseExpression(expressions.get(i)), i < select.getColumnCount());
+ res.addColumn(parseExpression(expressions.get(i), true), i < select.getColumnCount());
int[] grpIdx = GROUP_INDEXES.get(select);
@@ -286,8 +285,8 @@ public class GridSqlQueryParser {
processSortOrder(select.getSortOrder(), res);
- res.limit(parseExpression(select.getLimit()));
- res.offset(parseExpression(select.getOffset()));
+ res.limit(parseExpression(select.getLimit(), false));
+ res.offset(parseExpression(select.getOffset(), false));
return res;
}
@@ -346,8 +345,8 @@ public class GridSqlQueryParser {
res.unionType(union.getUnionType());
- res.limit(parseExpression(union.getLimit()));
- res.offset(parseExpression(union.getOffset()));
+ res.limit(parseExpression(union.getLimit(), false));
+ res.offset(parseExpression(union.getOffset(), false));
processSortOrder(UNION_SORT.get(union), res);
@@ -358,22 +357,29 @@ public class GridSqlQueryParser {
/**
* @param expression Expression.
+ * @param calcTypes Calculate types for all the expressions.
+ * @return Parsed expression.
*/
- private GridSqlElement parseExpression(@Nullable Expression expression) {
+ private GridSqlElement parseExpression(@Nullable Expression expression, boolean calcTypes) {
if (expression == null)
return null;
GridSqlElement res = (GridSqlElement)h2ObjToGridObj.get(expression);
if (res == null) {
- res = parseExpression0(expression);
+ res = parseExpression0(expression, calcTypes);
- if (expression.getType() != Value.UNKNOWN) {
- Column c = new Column(null, expression.getType(), expression.getPrecision(), expression.getScale(),
- expression.getDisplaySize());
+ if (calcTypes) {
+ GridSqlType type = GridSqlType.UNKNOWN;
- res.expressionResultType(new GridSqlType(c.getType(), c.getScale(), c.getPrecision(), c.getDisplaySize(),
- c.getCreateSQL()));
+ if (expression.getType() != Value.UNKNOWN) {
+ Column c = new Column(null, expression.getType(), expression.getPrecision(), expression.getScale(),
+ expression.getDisplaySize());
+
+ type = new GridSqlType(c.getType(), c.getScale(), c.getPrecision(), c.getDisplaySize(), c.getCreateSQL());
+ }
+
+ res.resultType(type);
}
h2ObjToGridObj.put(expression, res);
@@ -384,8 +390,10 @@ public class GridSqlQueryParser {
/**
* @param expression Expression.
+ * @param calcTypes Calculate types for all the expressions.
+ * @return Parsed expression.
*/
- private GridSqlElement parseExpression0(Expression expression) {
+ private GridSqlElement parseExpression0(Expression expression, boolean calcTypes) {
if (expression instanceof ExpressionColumn) {
TableFilter tblFilter = ((ExpressionColumn)expression).getTableFilter();
@@ -395,7 +403,8 @@ public class GridSqlQueryParser {
}
if (expression instanceof Alias)
- return new GridSqlAlias(expression.getAlias(), parseExpression(expression.getNonAliasExpression()), true);
+ return new GridSqlAlias(expression.getAlias(),
+ parseExpression(expression.getNonAliasExpression(), calcTypes), true);
if (expression instanceof ValueExpression)
return new GridSqlConst(expression.getValue(null));
@@ -408,12 +417,13 @@ public class GridSqlQueryParser {
if (type == Operation.NEGATE) {
assert OPERATION_RIGHT.get(operation) == null;
- return new GridSqlOperation(GridSqlOperationType.NEGATE, parseExpression(OPERATION_LEFT.get(operation)));
+ return new GridSqlOperation(GridSqlOperationType.NEGATE,
+ parseExpression(OPERATION_LEFT.get(operation), calcTypes));
}
return new GridSqlOperation(OPERATION_OP_TYPES[type],
- parseExpression(OPERATION_LEFT.get(operation)),
- parseExpression(OPERATION_RIGHT.get(operation)));
+ parseExpression(OPERATION_LEFT.get(operation), calcTypes),
+ parseExpression(OPERATION_RIGHT.get(operation), calcTypes));
}
if (expression instanceof Comparison) {
@@ -423,18 +433,18 @@ public class GridSqlQueryParser {
assert opType != null : COMPARISON_TYPE.get(cmp);
- GridSqlElement left = parseExpression(COMPARISON_LEFT.get(cmp));
+ GridSqlElement left = parseExpression(COMPARISON_LEFT.get(cmp), calcTypes);
if (opType.childrenCount() == 1)
return new GridSqlOperation(opType, left);
- GridSqlElement right = parseExpression(COMPARISON_RIGHT.get(cmp));
+ GridSqlElement right = parseExpression(COMPARISON_RIGHT.get(cmp), calcTypes);
return new GridSqlOperation(opType, left, right);
}
if (expression instanceof ConditionNot)
- return new GridSqlOperation(NOT, parseExpression(expression.getNotIfPossible(null)));
+ return new GridSqlOperation(NOT, parseExpression(expression.getNotIfPossible(null), calcTypes));
if (expression instanceof ConditionAndOr) {
ConditionAndOr andOr = (ConditionAndOr)expression;
@@ -444,7 +454,7 @@ public class GridSqlQueryParser {
assert type == ConditionAndOr.AND || type == ConditionAndOr.OR;
return new GridSqlOperation(type == ConditionAndOr.AND ? AND : OR,
- parseExpression(ANDOR_LEFT.get(andOr)), parseExpression(ANDOR_RIGHT.get(andOr)));
+ parseExpression(ANDOR_LEFT.get(andOr), calcTypes), parseExpression(ANDOR_RIGHT.get(andOr), calcTypes));
}
if (expression instanceof Subquery) {
@@ -458,12 +468,12 @@ public class GridSqlQueryParser {
if (expression instanceof ConditionIn) {
GridSqlOperation res = new GridSqlOperation(IN);
- res.addChild(parseExpression(LEFT_CI.get((ConditionIn)expression)));
+ res.addChild(parseExpression(LEFT_CI.get((ConditionIn)expression), calcTypes));
List<Expression> vals = VALUE_LIST_CI.get((ConditionIn)expression);
for (Expression val : vals)
- res.addChild(parseExpression(val));
+ res.addChild(parseExpression(val, calcTypes));
return res;
}
@@ -471,12 +481,12 @@ public class GridSqlQueryParser {
if (expression instanceof ConditionInConstantSet) {
GridSqlOperation res = new GridSqlOperation(IN);
- res.addChild(parseExpression(LEFT_CICS.get((ConditionInConstantSet) expression)));
+ res.addChild(parseExpression(LEFT_CICS.get((ConditionInConstantSet)expression), calcTypes));
List<Expression> vals = VALUE_LIST_CICS.get((ConditionInConstantSet)expression);
for (Expression val : vals)
- res.addChild(parseExpression(val));
+ res.addChild(parseExpression(val, calcTypes));
return res;
}
@@ -490,7 +500,7 @@ public class GridSqlQueryParser {
assert0(!all, expression);
assert0(compareType == Comparison.EQUAL, expression);
- res.addChild(parseExpression(LEFT_CIS.get((ConditionInSelect) expression)));
+ res.addChild(parseExpression(LEFT_CIS.get((ConditionInSelect) expression), calcTypes));
Query qry = QUERY.get((ConditionInSelect)expression);
@@ -506,8 +516,9 @@ public class GridSqlQueryParser {
boolean regexp = REGEXP_CL.get((CompareLike)expression);
- return new GridSqlOperation(regexp ? REGEXP : LIKE, parseExpression(LEFT.get((CompareLike) expression)),
- parseExpression(RIGHT.get((CompareLike) expression)));
+ return new GridSqlOperation(regexp ? REGEXP : LIKE,
+ parseExpression(LEFT.get((CompareLike)expression), calcTypes),
+ parseExpression(RIGHT.get((CompareLike)expression), calcTypes));
}
if (expression instanceof Function) {
@@ -524,13 +535,16 @@ public class GridSqlQueryParser {
res.addChild(GridSqlPlaceholder.EMPTY);
}
else
- res.addChild(parseExpression(arg));
+ res.addChild(parseExpression(arg, calcTypes));
}
}
- if (f.getFunctionType() == Function.CAST || f.getFunctionType() == Function.CONVERT)
- res.setCastType(new Column(null, f.getType(), f.getPrecision(), f.getScale(), f.getDisplaySize())
- .getCreateSQL());
+ if (f.getFunctionType() == Function.CAST || f.getFunctionType() == Function.CONVERT) {
+ Column c = new Column(null, f.getType(), f.getPrecision(), f.getScale(), f.getDisplaySize());
+
+ res.resultType(new GridSqlType(c.getType(), c.getScale(), c.getPrecision(),
+ c.getDisplaySize(), c.getCreateSQL()));
+ }
return res;
}
@@ -544,7 +558,7 @@ public class GridSqlQueryParser {
if (f.getArgs() != null) {
for (Expression arg : f.getArgs())
- res.addChild(parseExpression(arg));
+ res.addChild(parseExpression(arg, calcTypes));
}
return res;
@@ -560,7 +574,7 @@ public class GridSqlQueryParser {
Expression on = ON.get((Aggregate)expression);
if (on != null)
- res.addChild(parseExpression(on));
+ res.addChild(parseExpression(on, calcTypes));
return res;
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d7dd4a02/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 502366d..2f8bcdd 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
@@ -22,7 +22,6 @@ import org.apache.ignite.internal.processors.cache.query.*;
import org.apache.ignite.internal.processors.query.h2.*;
import org.apache.ignite.internal.util.typedef.*;
import org.h2.jdbc.*;
-import org.h2.value.*;
import org.jetbrains.annotations.*;
import java.util.*;
@@ -35,20 +34,20 @@ import static org.apache.ignite.internal.processors.query.h2.sql.GridSqlPlacehol
*/
public class GridSqlQuerySplitter {
/** */
- private static final String TABLE_PREFIX = "__T";
+ private static final String TABLE_SCHEMA = "PUBLIC";
/** */
- private static final String COLUMN_PREFIX = "__C";
+ private static final String TABLE_PREFIX = "__T";
/** */
- public static final String TABLE_FUNC_NAME = "__Z0";
+ private static final String COLUMN_PREFIX = "__C";
/**
* @param idx Index of table.
- * @return Table name.
+ * @return Table.
*/
- private static String table(int idx) {
- return TABLE_PREFIX + idx;
+ public static GridSqlTable table(int idx) {
+ return new GridSqlTable(TABLE_SCHEMA, TABLE_PREFIX + idx);
}
/**
@@ -88,7 +87,9 @@ public class GridSqlQuerySplitter {
int c = 0;
- for (GridSqlElement expr : left.select(true)) {
+ for (GridSqlElement expr : left.columns(true)) {
+ GridSqlType type = expr.resultType();
+
String colName;
if (expr instanceof GridSqlAlias)
@@ -101,12 +102,14 @@ public class GridSqlQuerySplitter {
expr = alias(colName, expr);
// Set generated alias to the expression.
- left.setSelectExpression(c, expr);
+ left.setColumn(c, expr);
}
GridSqlColumn col = column(colName);
- wrapQry.addSelectExpression(col, true);
+ col.resultType(type);
+
+ wrapQry.addColumn(col, true);
c++;
}
@@ -137,17 +140,15 @@ public class GridSqlQuerySplitter {
// nullifying or updating things, have to make sure that we will not need them in the original form later.
final GridSqlSelect mapQry = wrapUnion(collectAllSpaces(GridSqlQueryParser.parse(stmt), spaces));
- final String mergeTable = TABLE_FUNC_NAME + "()"; // table(0); TODO IGNITE-1142
-
final boolean explain = mapQry.explain();
mapQry.explain(false);
- GridSqlSelect rdcQry = new GridSqlSelect().from(new GridSqlFunction(null, TABLE_FUNC_NAME)); // table(mergeTable)); TODO IGNITE-1142
+ GridSqlSelect rdcQry = new GridSqlSelect().from(table(0));
// Split all select expressions into map-reduce parts.
List<GridSqlElement> mapExps = F.addAll(new ArrayList<GridSqlElement>(mapQry.allColumns()),
- mapQry.select(false));
+ mapQry.columns(false));
GridSqlElement[] rdcExps = new GridSqlElement[mapQry.visibleColumns()];
@@ -159,16 +160,16 @@ public class GridSqlQuerySplitter {
aggregateFound |= splitSelectExpression(mapExps, rdcExps, colNames, i, collocated);
// Fill select expressions.
- mapQry.clearSelect();
+ mapQry.clearColumns();
for (GridSqlElement exp : mapExps) // Add all map expressions as visible.
- mapQry.addSelectExpression(exp, true);
+ mapQry.addColumn(exp, true);
for (GridSqlElement rdcExp : rdcExps) // Add corresponding visible reduce columns.
- rdcQry.addSelectExpression(rdcExp, true);
+ rdcQry.addColumn(rdcExp, true);
for (int i = rdcExps.length; i < mapExps.size(); i++) // Add all extra map columns as invisible reduce columns.
- rdcQry.addSelectExpression(column(((GridSqlAlias)mapExps.get(i)).alias()), false);
+ rdcQry.addColumn(column(((GridSqlAlias)mapExps.get(i)).alias()), false);
// -- GROUP BY
if (mapQry.groupColumns() != null && !collocated)
@@ -214,11 +215,12 @@ public class GridSqlQuerySplitter {
}
// Build resulting two step query.
- GridCacheTwoStepQuery res = new GridCacheTwoStepQuery(spaces, rdcQry.getSQL(),
- findParams(rdcQry, params, new ArrayList<>()).toArray());
+ GridCacheTwoStepQuery res = new GridCacheTwoStepQuery(spaces, new GridCacheSqlQuery(rdcQry.getSQL(),
+ findParams(rdcQry, params, new ArrayList<>()).toArray()));
- res.addMapQuery(mergeTable, mapQry.getSQL(),
- findParams(mapQry, params, new ArrayList<>(params.length)).toArray());
+ res.addMapQuery(new GridCacheSqlQuery(mapQry.getSQL(),
+ findParams(mapQry, params, new ArrayList<>(params.length)).toArray())
+ .columns(collectColumns(mapExps)));
res.explain(explain);
@@ -226,6 +228,37 @@ public class GridSqlQuerySplitter {
}
/**
+ * @param cols Columns from SELECT clause.
+ * @return Map of columns with types.
+ */
+ private static LinkedHashMap<String,?> collectColumns(List<GridSqlElement> cols) {
+ LinkedHashMap<String, GridSqlType> res = new LinkedHashMap<>(cols.size(), 1f, false);
+
+ for (int i = 0; i < cols.size(); i++) {
+ GridSqlElement col = cols.get(i);
+ GridSqlType t = col.resultType();
+
+ if (t == null)
+ throw new NullPointerException("Column type.");
+
+ if (t == GridSqlType.UNKNOWN)
+ throw new IllegalStateException("Unknown type: " + col);
+
+ String alias;
+
+ if (col instanceof GridSqlAlias)
+ alias = ((GridSqlAlias)col).alias();
+ else
+ alias = columnName(i);
+
+ if (res.put(alias, t) != null)
+ throw new IllegalStateException("Alias already exists: " + alias);
+ }
+
+ return res;
+ }
+
+ /**
* @param qry Query.
* @param spaces Space names.
* @return Query.
@@ -242,7 +275,7 @@ public class GridSqlQuerySplitter {
collectAllSpacesInFrom(select.from(), spaces);
- for (GridSqlElement el : select.select(false))
+ for (GridSqlElement el : select.columns(false))
collectAllSpacesInSubqueries(el, spaces);
collectAllSpacesInSubqueries(select.where(), spaces);
@@ -325,7 +358,7 @@ public class GridSqlQuerySplitter {
if (params.length == 0)
return target;
- for (GridSqlElement el : qry.select(false))
+ for (GridSqlElement el : qry.columns(false))
findParams(el, params, target);
findParams(qry.from(), params, target);
@@ -422,11 +455,6 @@ public class GridSqlQuerySplitter {
if (idx < rdcSelect.length) { // SELECT __C0 AS original_alias
GridSqlElement rdcEl = column(mapColAlias);
- GridSqlType type = el.expressionResultType();
-
- if (type != null && type.type() == Value.UUID) // There is no JDBC type UUID, so conversion to bytes occurs.
- rdcEl = function(CAST).setCastType("UUID").addChild(rdcEl); // TODO IGNITE-1142 - remove this cast when table function removed
-
if (colNames.add(rdcColAlias)) // To handle column name duplication (usually wildcard for few tables).
rdcEl = alias(rdcColAlias, rdcEl);
@@ -499,6 +527,8 @@ public class GridSqlQuerySplitter {
) {
GridSqlAggregateFunction agg = parentExpr.child(aggIdx);
+ assert agg.resultType() != null;
+
GridSqlElement mapAgg, rdcAgg;
// Create stubbed map alias to fill it with correct expression later.
@@ -513,7 +543,8 @@ public class GridSqlQuerySplitter {
switch (agg.type()) {
case AVG: // SUM( AVG(CAST(x AS DOUBLE))*COUNT(x) )/SUM( COUNT(x) ).
//-- COUNT(x) map
- GridSqlElement cntMapAgg = aggregate(agg.distinct(), COUNT).addChild(agg.child());
+ GridSqlElement cntMapAgg = aggregate(agg.distinct(), COUNT)
+ .resultType(GridSqlType.BIGINT).addChild(agg.child());
// Add generated alias to COUNT(x).
// Using size as index since COUNT will be added as the last select element to the map query.
@@ -524,8 +555,8 @@ public class GridSqlQuerySplitter {
mapSelect.add(cntMapAgg);
//-- AVG(CAST(x AS DOUBLE)) map
- mapAgg = aggregate(agg.distinct(), AVG).addChild( // Add function argument.
- function(CAST).setCastType("DOUBLE").addChild(agg.child()));
+ mapAgg = aggregate(agg.distinct(), AVG).resultType(GridSqlType.DOUBLE).addChild(
+ function(CAST).resultType(GridSqlType.DOUBLE).addChild(agg.child()));
//-- SUM( AVG(x)*COUNT(x) )/SUM( COUNT(x) ) reduce
GridSqlElement sumUpRdc = aggregate(false, SUM).addChild(
@@ -542,20 +573,20 @@ public class GridSqlQuerySplitter {
case SUM: // SUM( SUM(x) )
case MAX: // MAX( MAX(x) )
case MIN: // MIN( MIN(x) )
- mapAgg = aggregate(agg.distinct(), agg.type()).addChild(agg.child());
+ mapAgg = aggregate(agg.distinct(), agg.type()).resultType(agg.resultType()).addChild(agg.child());
rdcAgg = aggregate(agg.distinct(), agg.type()).addChild(column(mapAggAlias.alias()));
break;
case COUNT_ALL: // CAST(SUM( COUNT(*) ) AS BIGINT)
case COUNT: // CAST(SUM( COUNT(x) ) AS BIGINT)
- mapAgg = aggregate(agg.distinct(), agg.type());
+ mapAgg = aggregate(agg.distinct(), agg.type()).resultType(GridSqlType.BIGINT);
if (agg.type() == COUNT)
mapAgg.addChild(agg.child());
rdcAgg = aggregate(false, SUM).addChild(column(mapAggAlias.alias()));
- rdcAgg = function(CAST).setCastType("BIGINT").addChild(rdcAgg);
+ rdcAgg = function(CAST).resultType(GridSqlType.BIGINT).addChild(rdcAgg);
break;
@@ -564,9 +595,11 @@ public class GridSqlQuerySplitter {
}
assert !(mapAgg instanceof GridSqlAlias);
+ assert mapAgg.resultType() != null;
// Fill the map alias with aggregate.
mapAggAlias.child(0, mapAgg);
+ mapAggAlias.resultType(mapAgg.resultType());
// Replace in original expression aggregate with reduce aggregate.
parentExpr.child(aggIdx, rdcAgg);
@@ -595,7 +628,11 @@ public class GridSqlQuerySplitter {
* @return Alias.
*/
private static GridSqlAlias alias(String alias, GridSqlElement child) {
- return new GridSqlAlias(alias, child);
+ GridSqlAlias res = new GridSqlAlias(alias, child);
+
+ res.resultType(child.resultType());
+
+ return res;
}
/**
@@ -615,12 +652,4 @@ public class GridSqlQuerySplitter {
private static GridSqlFunction function(GridSqlFunctionType type) {
return new GridSqlFunction(type);
}
-
- /**
- * @param name Table name.
- * @return Table.
- */
- private static GridSqlTable table(String name) {
- return new GridSqlTable(null, name);
- }
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d7dd4a02/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlSelect.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlSelect.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlSelect.java
index fb2643e..6705c48 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlSelect.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlSelect.java
@@ -26,10 +26,10 @@ import java.util.*;
*/
public class GridSqlSelect extends GridSqlQuery {
/** */
- private List<GridSqlElement> allExprs = new ArrayList<>();
+ private List<GridSqlElement> cols = new ArrayList<>();
/** */
- private List<GridSqlElement> select = new ArrayList<>();
+ private int visibleCols;
/** */
private int[] grpCols;
@@ -45,19 +45,19 @@ public class GridSqlSelect extends GridSqlQuery {
/** {@inheritDoc} */
@Override public int visibleColumns() {
- return select.size();
+ return visibleCols;
}
/**
* @return Number of columns is select including invisible ones.
*/
public int allColumns() {
- return allExprs.size();
+ return cols.size();
}
/** {@inheritDoc} */
- @Override protected GridSqlElement expression(int col) {
- return allExprs.get(col);
+ @Override protected GridSqlElement column(int col) {
+ return cols.get(col);
}
/** {@inheritDoc} */
@@ -67,7 +67,7 @@ public class GridSqlSelect extends GridSqlQuery {
if (distinct)
buff.append(" DISTINCT");
- for (GridSqlElement expression : select) {
+ for (GridSqlElement expression : columns(true)) {
buff.appendExceptFirst(",");
buff.append('\n');
buff.append(expression.getSQL());
@@ -86,14 +86,14 @@ public class GridSqlSelect extends GridSqlQuery {
for (int grpCol : grpCols) {
buff.appendExceptFirst(", ");
- addAlias(buff, allExprs.get(grpCol));
+ addAlias(buff, cols.get(grpCol));
}
}
if (havingCol >= 0) {
buff.append("\nHAVING ");
- addAlias(buff, allExprs.get(havingCol));
+ addAlias(buff, cols.get(havingCol));
}
getSortLimitSQL(buff);
@@ -114,52 +114,59 @@ public class GridSqlSelect extends GridSqlQuery {
/**
* @param visibleOnly If only visible expressions needed.
- * @return Select phrase expressions.
+ * @return Select clause expressions.
*/
- public Iterable<GridSqlElement> select(boolean visibleOnly) {
- return visibleOnly ? select : allExprs;
+ public Iterable<GridSqlElement> columns(boolean visibleOnly) {
+ assert visibleCols <= cols.size();
+
+ return visibleOnly && visibleCols != cols.size() ?
+ cols.subList(0, visibleCols) : cols;
}
/**
- * Clears select list.
+ * Clears select expressions list.
+ * @return {@code this}.
*/
- public void clearSelect() {
- select = new ArrayList<>();
- allExprs = new ArrayList<>();
+ public GridSqlSelect clearColumns() {
+ visibleCols = 0;
+ cols = new ArrayList<>();
+
+ return this;
}
/**
* @param expression Expression.
* @param visible Expression is visible in select phrase.
+ * @return {@code this}.
*/
- public void addSelectExpression(GridSqlElement expression, boolean visible) {
+ public GridSqlSelect addColumn(GridSqlElement expression, boolean visible) {
if (expression == null)
throw new NullPointerException();
if (visible) {
- if (select.size() != allExprs.size())
+ if (visibleCols != cols.size())
throw new IllegalStateException("Already started adding invisible columns.");
- select.add(expression);
+ visibleCols++;
}
- else if (select.isEmpty())
- throw new IllegalStateException("No visible columns.");
- allExprs.add(expression);
+ cols.add(expression);
+
+ return this;
}
/**
* @param colIdx Column index.
* @param expression Expression.
+ * @return {@code this}.
*/
- public void setSelectExpression(int colIdx, GridSqlElement expression) {
+ public GridSqlSelect setColumn(int colIdx, GridSqlElement expression) {
if (expression == null)
throw new NullPointerException();
- if (colIdx < select.size()) // Assuming that all the needed expressions were already added.
- select.set(colIdx, expression);
+ cols.set(colIdx, expression);
- allExprs.set(colIdx, expression);
+ return this;
}
/**
@@ -171,9 +178,12 @@ public class GridSqlSelect extends GridSqlQuery {
/**
* @param grpCols Group columns.
+ * @return {@code this}.
*/
- public void groupColumns(int[] grpCols) {
+ public GridSqlSelect groupColumns(int[] grpCols) {
this.grpCols = grpCols;
+
+ return this;
}
/**
@@ -202,9 +212,12 @@ public class GridSqlSelect extends GridSqlQuery {
/**
* @param where New where.
+ * @return {@code this}.
*/
- public void where(GridSqlElement where) {
+ public GridSqlSelect where(GridSqlElement where) {
this.where = where;
+
+ return this;
}
/**
@@ -226,16 +239,19 @@ public class GridSqlSelect extends GridSqlQuery {
* @return Having.
*/
public GridSqlElement having() {
- return havingCol >= 0 ? allExprs.get(havingCol) : null;
+ return havingCol >= 0 ? column(havingCol) : null;
}
/**
* @param col Index of HAVING column.
+ * @return {@code this}.
*/
- public void havingColumn(int col) {
+ public GridSqlSelect havingColumn(int col) {
assert col >= -1 : col;
havingCol = col;
+
+ return this;
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d7dd4a02/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlType.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlType.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlType.java
index 1dbcd46..aeee562 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlType.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlType.java
@@ -17,10 +17,27 @@
package org.apache.ignite.internal.processors.query.h2.sql;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.h2.value.*;
+
/**
* SQL Data type based on H2.
*/
-public class GridSqlType {
+public final class GridSqlType {
+ /** */
+ public static final GridSqlType UNKNOWN = new GridSqlType(Value.UNKNOWN, 0, 0, 0, null);
+
+ /** */
+ public static final GridSqlType BIGINT = new GridSqlType(Value.LONG, 0, ValueLong.PRECISION,
+ ValueLong.DISPLAY_SIZE, "BIGINT");
+
+ /** */
+ public static final GridSqlType DOUBLE = new GridSqlType(Value.DOUBLE, 0, ValueDouble.PRECISION,
+ ValueDouble.DISPLAY_SIZE, "DOUBLE");
+
+ /** */
+ public static final GridSqlType UUID = new GridSqlType(Value.UUID, 0, Integer.MAX_VALUE, 36, "UUID");
+
/** H2 type. */
private final int type;
@@ -91,4 +108,9 @@ public class GridSqlType {
public String sql() {
return sql;
}
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridSqlType.class, this);
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d7dd4a02/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlUnion.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlUnion.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlUnion.java
index 721c288..2900470 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlUnion.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlUnion.java
@@ -41,7 +41,7 @@ public class GridSqlUnion extends GridSqlQuery {
}
/** {@inheritDoc} */
- @Override protected GridSqlElement expression(int col) {
+ @Override protected GridSqlElement column(int col) {
throw new IllegalStateException();
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d7dd4a02/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
index 5510e9e..03500e6 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
@@ -29,6 +29,7 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.*;
import org.apache.ignite.internal.processors.cache.query.*;
import org.apache.ignite.internal.processors.query.*;
import org.apache.ignite.internal.processors.query.h2.*;
+import org.apache.ignite.internal.processors.query.h2.sql.*;
import org.apache.ignite.internal.processors.query.h2.twostep.messages.*;
import org.apache.ignite.internal.util.*;
import org.apache.ignite.internal.util.typedef.*;
@@ -36,16 +37,11 @@ import org.apache.ignite.internal.util.typedef.internal.*;
import org.apache.ignite.lang.*;
import org.apache.ignite.marshaller.*;
import org.apache.ignite.plugin.extensions.communication.*;
-import org.h2.command.*;
import org.h2.command.ddl.*;
-import org.h2.command.dml.*;
import org.h2.engine.*;
-import org.h2.expression.*;
-import org.h2.index.*;
import org.h2.jdbc.*;
import org.h2.result.*;
import org.h2.table.*;
-import org.h2.tools.*;
import org.h2.util.*;
import org.h2.value.*;
import org.jetbrains.annotations.*;
@@ -55,9 +51,9 @@ import javax.cache.*;
import java.lang.reflect.*;
import java.sql.*;
import java.util.*;
-import java.util.Set;
import java.util.concurrent.*;
import java.util.concurrent.atomic.*;
+import java.util.concurrent.locks.*;
import static org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion.*;
@@ -84,7 +80,10 @@ public class GridReduceQueryExecutor {
private final ConcurrentMap<Long, QueryRun> runs = new ConcurrentHashMap8<>();
/** */
- private static ThreadLocal<GridMergeTable> curFunTbl = new ThreadLocal<>();
+ private volatile List<GridThreadLocalTable> fakeTbls = Collections.emptyList();
+
+ /** */
+ private final Lock fakeTblsLock = new ReentrantLock();
/** */
private static final Constructor<JdbcResultSet> CONSTRUCTOR;
@@ -475,11 +474,13 @@ public class GridReduceQueryExecutor {
nodes = Collections.singleton(F.rand(nodes));
}
+ int tblIdx = 0;
+
for (GridCacheSqlQuery mapQry : qry.mapQueries()) {
GridMergeTable tbl;
try {
- tbl = createFunctionTable(r.conn, mapQry, qry.explain()); // createTable(r.conn, mapQry); TODO
+ tbl = createMergeTable(r.conn, mapQry, qry.explain());
}
catch (IgniteCheckedException e) {
throw new IgniteException(e);
@@ -492,7 +493,7 @@ public class GridReduceQueryExecutor {
r.tbls.add(tbl);
- curFunTbl.set(tbl);
+ fakeTable(r.conn, tblIdx++).setInnerTable(tbl);
}
r.latch = new CountDownLatch(r.tbls.size() * nodes.size());
@@ -512,7 +513,7 @@ public class GridReduceQueryExecutor {
mapQrys = new ArrayList<>(qry.mapQueries().size());
for (GridCacheSqlQuery mapQry : qry.mapQueries())
- mapQrys.add(new GridCacheSqlQuery(mapQry.alias(), "EXPLAIN " + mapQry.query(), mapQry.parameters()));
+ mapQrys.add(new GridCacheSqlQuery("EXPLAIN " + mapQry.query(), mapQry.parameters()));
}
if (nodes.size() != 1 || !F.first(nodes).isLocal()) { // Marshall params for remotes.
@@ -565,8 +566,6 @@ public class GridReduceQueryExecutor {
for (GridMergeTable tbl : r.tbls) {
if (!tbl.getScanIndex(null).fetchedAll()) // We have to explicitly cancel queries on remote nodes.
send(nodes, new GridQueryCancelRequest(qryReqId), null);
-
-// dropTable(r.conn, tbl.getName()); TODO
}
if (retry) {
@@ -600,7 +599,8 @@ public class GridReduceQueryExecutor {
if (!runs.remove(qryReqId, r))
U.warn(log, "Query run was already removed: " + qryReqId);
- curFunTbl.remove();
+ for (int i = 0, mapQrys = qry.mapQueries().size(); i < mapQrys; i++)
+ fakeTable(null, i).setInnerTable(null); // Drop all merge tables.
}
}
}
@@ -626,6 +626,54 @@ public class GridReduceQueryExecutor {
}
/**
+ * @param idx Table index.
+ * @return Table name.
+ */
+ private static String table(int idx) {
+ return GridSqlQuerySplitter.table(idx).getSQL();
+ }
+
+ /**
+ * Gets or creates new fake table for index.
+ *
+ * @param idx Index of table.
+ * @return Table.
+ */
+ private GridThreadLocalTable fakeTable(Connection c, int idx) {
+ List<GridThreadLocalTable> tbls = fakeTbls;
+
+ assert tbls.size() >= idx;
+
+ if (tbls.size() == idx) { // If table for such index does not exist, create one.
+ fakeTblsLock.lock();
+
+ try {
+ if ((tbls = fakeTbls).size() == idx) { // Double check inside of lock.
+ try (Statement stmt = c.createStatement()) {
+ stmt.executeUpdate("CREATE TABLE " + table(idx) +
+ "(fake BOOL) ENGINE \"" + GridThreadLocalTable.Engine.class.getName() + '"');
+ }
+ catch (SQLException e) {
+ throw new IllegalStateException(e);
+ }
+
+ List<GridThreadLocalTable> newTbls = new ArrayList<>(tbls.size() + 1);
+
+ newTbls.addAll(tbls);
+ newTbls.add(GridThreadLocalTable.Engine.getCreated());
+
+ fakeTbls = tbls = newTbls;
+ }
+ }
+ finally {
+ fakeTblsLock.unlock();
+ }
+ }
+
+ return tbls.get(idx);
+ }
+
+ /**
* Calculates data nodes for replicated caches on unstable topology.
*
* @param cctx Cache context for main space.
@@ -858,16 +906,18 @@ public class GridReduceQueryExecutor {
throws IgniteCheckedException {
List<List<?>> lists = new ArrayList<>();
- for (GridCacheSqlQuery mapQry : qry.mapQueries()) {
- ResultSet rs = h2.executeSqlQueryWithTimer(space, c, "SELECT PLAN FROM " + mapQry.alias(), null);
+ for (int i = 0, mapQrys = qry.mapQueries().size(); i < mapQrys; i++) {
+ ResultSet rs = h2.executeSqlQueryWithTimer(space, c, "SELECT PLAN FROM " + table(i), null);
lists.add(F.asList(getPlan(rs)));
}
+ int tblIdx = 0;
+
for (GridCacheSqlQuery mapQry : qry.mapQueries()) {
- GridMergeTable tbl = createFunctionTable(c, mapQry, false);
+ GridMergeTable tbl = createMergeTable(c, mapQry, false);
- curFunTbl.set(tbl); // Now it will be only a single table.
+ fakeTable(c, tblIdx++).setInnerTable(tbl);
}
GridCacheSqlQuery rdc = qry.reduceQuery();
@@ -961,118 +1011,12 @@ public class GridReduceQueryExecutor {
/**
* @param conn Connection.
- * @param tblName Table name.
- * @throws SQLException If failed.
- */
- private void dropTable(Connection conn, String tblName) throws SQLException {
- try (Statement s = conn.createStatement()) {
- s.execute("DROP TABLE " + tblName);
- }
- }
-
- /**
- * @return Merged result set.
- */
- public static ResultSet mergeTableFunction(JdbcConnection c) throws Exception {
- GridMergeTable tbl = curFunTbl.get();
-
- Session ses = (Session)c.getSession();
-
- String url = c.getMetaData().getURL();
-
- // URL is either "jdbc:default:connection" or "jdbc:columnlist:connection"
- final Cursor cursor = url.charAt(5) == 'c' ? null : tbl.getScanIndex(ses).find(ses, null, null);
-
- final Column[] cols = tbl.getColumns();
-
- SimpleResultSet rs = new SimpleResultSet(cursor == null ? null : new SimpleRowSource() {
- @Override public Object[] readRow() throws SQLException {
- if (!cursor.next())
- return null;
-
- Row r = cursor.get();
-
- Object[] row = new Object[cols.length];
-
- for (int i = 0; i < row.length; i++)
- row[i] = r.getValue(i).getObject();
-
- return row;
- }
-
- @Override public void close() {
- // No-op.
- }
-
- @Override public void reset() throws SQLException {
- throw new SQLException("Unsupported.");
- }
- }) {
- @Override public byte[] getBytes(int colIdx) throws SQLException {
- assert cursor != null;
-
- return cursor.get().getValue(colIdx - 1).getBytes();
- }
-
- @Override public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
- throw new UnsupportedOperationException();
- }
-
- @Override public <T> T getObject(String columnLabel, Class<T> type) throws SQLException {
- throw new UnsupportedOperationException();
- }
- };
-
- for (Column col : cols)
- rs.addColumn(col.getName(), DataType.convertTypeToSQLType(col.getType()),
- MathUtils.convertLongToInt(col.getPrecision()), col.getScale());
-
- return rs;
- }
-
- /**
- * @param asQuery Query.
- * @return List of columns.
- */
- private static ArrayList<Column> generateColumnsFromQuery(org.h2.command.dml.Query asQuery) {
- int columnCount = asQuery.getColumnCount();
- ArrayList<Expression> expressions = asQuery.getExpressions();
- ArrayList<Column> cols = new ArrayList<>();
- for (int i = 0; i < columnCount; i++) {
- Expression expr = expressions.get(i);
- int type = expr.getType();
- String name = expr.getAlias();
- long precision = expr.getPrecision();
- int displaySize = expr.getDisplaySize();
- DataType dt = DataType.getDataType(type);
- if (precision > 0 && (dt.defaultPrecision == 0 ||
- (dt.defaultPrecision > precision && dt.defaultPrecision < Byte.MAX_VALUE))) {
- // dont' set precision to MAX_VALUE if this is the default
- precision = dt.defaultPrecision;
- }
- int scale = expr.getScale();
- if (scale > 0 && (dt.defaultScale == 0 ||
- (dt.defaultScale > scale && dt.defaultScale < precision))) {
- scale = dt.defaultScale;
- }
- if (scale > precision) {
- precision = scale;
- }
- Column col = new Column(name, type, precision, scale, displaySize);
- cols.add(col);
- }
-
- return cols;
- }
-
- /**
- * @param conn Connection.
* @param qry Query.
* @param explain Explain.
* @return Table.
* @throws IgniteCheckedException
*/
- private GridMergeTable createFunctionTable(JdbcConnection conn, GridCacheSqlQuery qry, boolean explain)
+ private GridMergeTable createMergeTable(JdbcConnection conn, GridCacheSqlQuery qry, boolean explain)
throws IgniteCheckedException {
try {
Session ses = (Session)conn.getSession();
@@ -1084,17 +1028,24 @@ public class GridReduceQueryExecutor {
data.create = true;
if (!explain) {
- Prepared prepare = ses.prepare(qry.query(), false);
+ LinkedHashMap<String,?> colsMap = qry.columns();
+
+ assert colsMap != null;
+
+ ArrayList<Column> cols = new ArrayList<>(colsMap.size());
+
+ for (Map.Entry<String,?> e : colsMap.entrySet()) {
+ String alias = e.getKey();
+ GridSqlType t = (GridSqlType)e.getValue();
- List<org.h2.expression.Parameter> parsedParams = prepare.getParameters();
+ assert !F.isEmpty(alias);
- for (int i = Math.min(parsedParams.size(), qry.parameters().length); --i >= 0; ) {
- Object val = qry.parameters()[i];
+ Column c = new Column(alias, t.type(), t.precision(), t.scale(), t.displaySize());
- parsedParams.get(i).setValue(DataType.convertToValue(ses, val, Value.UNKNOWN));
+ cols.add(c);
}
- data.columns = generateColumnsFromQuery((Query)prepare);
+ data.columns = cols;
}
else
data.columns = planColumns();
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d7dd4a02/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
new file mode 100644
index 0000000..c468371
--- /dev/null
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridThreadLocalTable.java
@@ -0,0 +1,262 @@
+/*
+ * 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.h2.api.*;
+import org.h2.command.ddl.*;
+import org.h2.engine.*;
+import org.h2.index.*;
+import org.h2.result.*;
+import org.h2.schema.*;
+import org.h2.table.*;
+import org.h2.value.*;
+
+import java.util.*;
+
+/**
+ * Thread local table wrapper for another table instance.
+ */
+public class GridThreadLocalTable extends Table {
+ /** Delegate table */
+ private final ThreadLocal<Table> tbl = new ThreadLocal<>();
+
+ /**
+ * @param schema Schema.
+ * @param id ID.
+ * @param name Table name.
+ * @param persistIndexes Persist indexes.
+ * @param persistData Persist data.
+ */
+ public GridThreadLocalTable(Schema schema, int id, String name, boolean persistIndexes, boolean persistData) {
+ super(schema, id, name, persistIndexes, persistData);
+ }
+
+ /**
+ * @param t Table or {@code null} to reset existing.
+ */
+ public void setInnerTable(Table t) {
+ if (t == null)
+ tbl.remove();
+ else
+ tbl.set(t);
+ }
+
+ /** {@inheritDoc} */
+ @Override public Index getPrimaryKey() {
+ return tbl.get().getPrimaryKey();
+ }
+
+ /** {@inheritDoc} */
+ @Override public Column getRowIdColumn() {
+ return tbl.get().getRowIdColumn();
+ }
+
+ /** {@inheritDoc} */
+ @Override public PlanItem getBestPlanItem(Session session, int[] masks, TableFilter filter, SortOrder sortOrder) {
+ return tbl.get().getBestPlanItem(session, masks, filter, sortOrder);
+ }
+
+ /** {@inheritDoc} */
+ @Override public Value getDefaultValue(Session session, Column column) {
+ return tbl.get().getDefaultValue(session, column);
+ }
+
+ /** {@inheritDoc} */
+ @Override public SearchRow getTemplateSimpleRow(boolean singleColumn) {
+ return tbl.get().getTemplateSimpleRow(singleColumn);
+ }
+
+ /** {@inheritDoc} */
+ @Override public Row getTemplateRow() {
+ return tbl.get().getTemplateRow();
+ }
+
+ /** {@inheritDoc} */
+ @Override public Column getColumn(String columnName) {
+ return tbl.get().getColumn(columnName);
+ }
+
+ /** {@inheritDoc} */
+ @Override public Column getColumn(int index) {
+ return tbl.get().getColumn(index);
+ }
+
+ /** {@inheritDoc} */
+ @Override public Index getIndexForColumn(Column column) {
+ return tbl.get().getIndexForColumn(column);
+ }
+
+ /** {@inheritDoc} */
+ @Override public Column[] getColumns() {
+ return tbl.get().getColumns();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void setColumns(Column[] columns) {
+ throw new IllegalStateException("Cols: " + Arrays.asList(columns));
+ }
+
+ /** {@inheritDoc} */
+ @Override public void lock(Session session, boolean exclusive, boolean force) {
+ tbl.get().lock(session, exclusive, force);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void close(Session session) {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override public void unlock(Session s) {
+ tbl.get().unlock(s);
+ }
+
+ /** {@inheritDoc} */
+ @Override public Index addIndex(Session session, String indexName, int indexId, IndexColumn[] cols,
+ IndexType indexType, boolean create, String indexComment) {
+ return tbl.get().addIndex(session, indexName, indexId, cols, indexType, create, indexComment);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void removeRow(Session session, Row row) {
+ tbl.get().removeRow(session, row);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void truncate(Session session) {
+ tbl.get().truncate(session);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void addRow(Session session, Row row) {
+ tbl.get().addRow(session, row);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void checkSupportAlter() {
+ tbl.get().checkSupportAlter();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getTableType() {
+ return tbl.get().getTableType();
+ }
+
+ /** {@inheritDoc} */
+ @Override public Index getUniqueIndex() {
+ return tbl.get().getUniqueIndex();
+ }
+
+ /** {@inheritDoc} */
+ @Override public Index getScanIndex(Session session) {
+ return tbl.get().getScanIndex(session);
+ }
+
+ /** {@inheritDoc} */
+ @Override public ArrayList<Index> getIndexes() {
+ return tbl.get().getIndexes();
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean isLockedExclusively() {
+ return tbl.get().isLockedExclusively();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getMaxDataModificationId() {
+ return tbl.get().getMaxDataModificationId();
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean isDeterministic() {
+ return tbl.get().isDeterministic();
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean canGetRowCount() {
+ return tbl.get().canGetRowCount();
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean canDrop() {
+ return tbl.get().canDrop();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getRowCount(Session session) {
+ return tbl.get().getRowCount(session);
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getRowCountApproximation() {
+ return tbl.get().getRowCountApproximation();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getDiskSpaceUsed() {
+ return tbl.get().getDiskSpaceUsed();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getCreateSQL() {
+ return "";
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getDropSQL() {
+ return tbl.get().getDropSQL();
+ }
+
+ /** {@inheritDoc} */
+ @Override public void checkRename() {
+ tbl.get().checkRename();
+ }
+
+ /**
+ * Engine.
+ */
+ public static class Engine implements TableEngine {
+ /** */
+ private static ThreadLocal<GridThreadLocalTable> createdTbl = new ThreadLocal<>();
+
+ /**
+ * @return Created table.
+ */
+ public static GridThreadLocalTable getCreated() {
+ GridThreadLocalTable tbl = createdTbl.get();
+
+ assert tbl != null;
+
+ createdTbl.remove();
+
+ return tbl;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Table createTable(CreateTableData d) {
+ assert createdTbl.get() == null;
+
+ GridThreadLocalTable tbl = new GridThreadLocalTable(d.schema, d.id, d.tableName, d.persistIndexes,
+ d.persistData);
+
+ createdTbl.set(tbl);
+
+ return tbl;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d7dd4a02/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java
index ccb3115..18bfd57 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java
@@ -316,7 +316,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA
if (cacheMode() == PARTITIONED) {
assertEquals(2, res.size());
- assertTrue(((String)res.get(1).get(0)).contains(GridSqlQuerySplitter.TABLE_FUNC_NAME));
+ assertTrue(((String)res.get(1).get(0)).contains(GridSqlQuerySplitter.table(0).getSQL()));
}
else
assertEquals(1, res.size());
[15/17] incubator-ignite git commit: # ignite-1209
Posted by ak...@apache.org.
# ignite-1209
Signed-off-by: Yakov Zhdanov <yz...@gridgain.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/d9acbd1d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/d9acbd1d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/d9acbd1d
Branch: refs/heads/ignite-843
Commit: d9acbd1da16efac59d3cc44c18c16af2db5f50f2
Parents: ebcdb4b
Author: ashutak <as...@gridgain.com>
Authored: Thu Aug 6 18:21:08 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Aug 6 18:29:44 2015 +0300
----------------------------------------------------------------------
scripts/git-apply-patch.sh | 94 -------------------------------------
scripts/git-patch-functions.sh | 56 ++--------------------
2 files changed, 4 insertions(+), 146 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d9acbd1d/scripts/git-apply-patch.sh
----------------------------------------------------------------------
diff --git a/scripts/git-apply-patch.sh b/scripts/git-apply-patch.sh
deleted file mode 100755
index 757cd26..0000000
--- a/scripts/git-apply-patch.sh
+++ /dev/null
@@ -1,94 +0,0 @@
-#!/bin/bash
-#
-# 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.
-#
-
-#
-# Git patch-file applier.
-#
-echo 'Usage: scripts/git-apply-patch.sh <ignite-task> [-ih|--ignitehome <path>] [-idb|--ignitedefbranch <branch-name>] [-ph|--patchhome <path>]'
-echo "It should be called from IGNITE_HOME directory."
-echo "Patch will be applied to DEFAULT_BRANCH from PATCHES_HOME."
-echo "Note: you can use ${IGNITE_HOME}/scripts/git-patch-prop-local.sh to set your own local properties (to rewrite settings at git-patch-prop-local.sh). "
-echo
-
-#
-# Init home and import properties and functions.
-#
-if [ -z ${IGNITE_HOME} ] # Script can be called from not IGNITE_HOME if IGNITE_HOME was set.
- then IGNITE_HOME=$PWD
-fi
-
-. ${IGNITE_HOME}/scripts/git-patch-prop.sh # Import properties.
-. ${IGNITE_HOME}/scripts/git-patch-functions.sh # Import patch functions.
-
-if [ -f ${IGNITE_HOME}/scripts/git-patch-prop-local.sh ] # Whether a local user properties file exists.
- then . ${IGNITE_HOME}/scripts/git-patch-prop-local.sh # Import user properties (it will rewrite global properties).
-fi
-
-#
-# Ignite task.
-#
-IGNITE_TASK=$1
-
-#
-# Read command line params.
-#
-while [[ $# > 1 ]]
-do
- key="$1"
-
- case $key in
- -ih|--ignitehome)
- IGNITE_HOME="$2"
- shift
- ;;
-
- -idb|--ignitedefbranch)
- IGNITE_DEFAULT_BRANCH="$2"
- shift
- ;;
-
- -ph|--patchhome)
- PATCHES_HOME="$2"
- shift
- ;;
- *)
-
- echo "Unknown parameter: ${key}"
- ;;
- esac
- shift
-done
-
-echo "IGNITE_HOME : ${IGNITE_HOME}"
-echo "Default branch : ${IGNITE_DEFAULT_BRANCH}"
-echo "Ignite task : ${IGNITE_TASK}"
-echo
-echo "PATCHES_HOME : ${PATCHES_HOME}"
-echo
-
-#
-# Main script logic.
-#
-
-currentAndDefaultBranchesShouldBeEqual ${IGNITE_HOME} ${IGNITE_DEFAULT_BRANCH}
-
-requireCleanWorkTree ${IGNITE_HOME}
-
-IGNITE_PATCH_FILE=${PATCHES_HOME}/${IGNITE_DEFAULT_BRANCH}_${IGNITE_TASK}.patch
-
-applyPatch ${IGNITE_HOME} ${IGNITE_DEFAULT_BRANCH} ${IGNITE_PATCH_FILE}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d9acbd1d/scripts/git-patch-functions.sh
----------------------------------------------------------------------
diff --git a/scripts/git-patch-functions.sh b/scripts/git-patch-functions.sh
index 3cc1bb0..cade691 100644
--- a/scripts/git-patch-functions.sh
+++ b/scripts/git-patch-functions.sh
@@ -50,13 +50,16 @@ formatPatch () {
cd ${GIT_HOME}
git checkout ${DEFAULT_BRANCH}
+
+ DEF_BRANCH_REV="$(git rev-parse --short HEAD)"
+
git checkout -b tmppatch
# Merge to make only one commit.
git merge --squash ${PATCHED_BRANCH}
git commit -a -m "# ${PATCHED_BRANCH}"
- PATCH_FILE=${PATCHES_HOME}'/'${DEFAULT_BRANCH}_${PATCHED_BRANCH}${PATCH_SUFFIX}
+ PATCH_FILE=${PATCHES_HOME}'/'${DEFAULT_BRANCH}_${DEF_BRANCH_REV}_${PATCHED_BRANCH}${PATCH_SUFFIX}
git format-patch ${DEFAULT_BRANCH} --stdout > ${PATCH_FILE}
echo "Patch file created."
@@ -125,55 +128,4 @@ requireCleanWorkTree () {
fi
}
-#
-# Applies patch. Applies patch file created by formatPatch method.
-#
-# Params:
-# - Git home.
-# - Default branch.
-# - File with patch.
-#
-applyPatch () {
- GIT_HOME=$1
- DEFAULT_BRANCH=$2
- PATCH_FILE=$3
-
- cd ${GIT_HOME}
-
- if [ ! -f ${PATCH_FILE} ]
- then
- echo $0", ERROR:"
- echo "Expected patch file not found: $PATCH_FILE."
-
- exit 1
- fi
-
- echo "Patch $PATCH_FILE will be applied to $DEFAULT_BRANCH branch."
-
- git am ${PATCH_FILE}
-}
-
-#
-# Checks that given Default branch and Current branch are equal.
-# Exit with code 1 in error case.
-#
-# Params:
-# - Git home.
-# - Default branch.
-#
-currentAndDefaultBranchesShouldBeEqual () {
- GIT_HOME=$1
- DEFAULT_BRANCH=$2
-
- cd ${GIT_HOME}
-
- CURRENT_BRANCH=$( determineCurrentBranch ${GIT_HOME} )
-
- if [ "$CURRENT_BRANCH" != "$DEFAULT_BRANCH" ]
- then
- echo $0", ERROR:"
- echo "You are not on an expected branch. Your current branch at $GIT_HOME is $CURRENT_BRANCH, should be $DEFAULT_BRANCH."
- exit 1
- fi
-}