You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/05/05 09:45:12 UTC
[01/50] [abbrv] ignite git commit: ignite-2.0 - Fixed javadoc
Repository: ignite
Updated Branches:
refs/heads/ignite-5009 3055da8b8 -> 61021b109
ignite-2.0 - Fixed javadoc
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ab2a5b90
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ab2a5b90
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ab2a5b90
Branch: refs/heads/ignite-5009
Commit: ab2a5b903b814d917065f3902169dbded8da334d
Parents: 14f4b33
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Fri Apr 28 10:38:58 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Fri Apr 28 10:38:58 2017 +0300
----------------------------------------------------------------------
modules/core/src/main/java/org/apache/ignite/igfs/IgfsMetrics.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ab2a5b90/modules/core/src/main/java/org/apache/ignite/igfs/IgfsMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/igfs/IgfsMetrics.java b/modules/core/src/main/java/org/apache/ignite/igfs/IgfsMetrics.java
index 28225fc..7bd27fe 100644
--- a/modules/core/src/main/java/org/apache/ignite/igfs/IgfsMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/igfs/IgfsMetrics.java
@@ -33,7 +33,7 @@ public interface IgfsMetrics {
/**
* Gets maximum amount of data that can be stored on local node. This metrics is related to
- * to the {@link org.apache.ignite.configuration.MemoryPolicyConfiguration#getSize()} of the IGFS data cache.
+ * to the {@link org.apache.ignite.configuration.MemoryPolicyConfiguration#getMaxSize()} of the IGFS data cache.
*
* @return Maximum IGFS local space size.
*/
[34/50] [abbrv] ignite git commit: Moved JDBC driver property info to
top-level.
Posted by sb...@apache.org.
Moved JDBC driver property info to top-level.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d70ebff6
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d70ebff6
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d70ebff6
Branch: refs/heads/ignite-5009
Commit: d70ebff6c8d3f6626ca928ab5b89f2f34eba7584
Parents: 7d0cc2c
Author: devozerov <vo...@gridgain.com>
Authored: Thu May 4 12:57:58 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Thu May 4 12:57:58 2017 +0300
----------------------------------------------------------------------
.../org/apache/ignite/IgniteJdbcDriver.java | 69 ++++++++------------
.../internal/jdbc/JdbcDriverPropertyInfo.java | 37 +++++++++++
2 files changed, 63 insertions(+), 43 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d70ebff6/modules/core/src/main/java/org/apache/ignite/IgniteJdbcDriver.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteJdbcDriver.java b/modules/core/src/main/java/org/apache/ignite/IgniteJdbcDriver.java
index 0ee41c0..df4929c 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteJdbcDriver.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteJdbcDriver.java
@@ -29,6 +29,7 @@ import java.util.Properties;
import java.util.logging.Logger;
import org.apache.ignite.cache.affinity.AffinityKey;
import org.apache.ignite.internal.jdbc.JdbcConnection;
+import org.apache.ignite.internal.jdbc.JdbcDriverPropertyInfo;
import org.apache.ignite.logger.java.JavaLogger;
/**
@@ -408,67 +409,67 @@ public class IgniteJdbcDriver implements Driver {
throw new SQLException("URL is invalid: " + url);
List<DriverPropertyInfo> props = Arrays.<DriverPropertyInfo>asList(
- new PropertyInfo("Hostname", info.getProperty(PROP_HOST), ""),
- new PropertyInfo("Port number", info.getProperty(PROP_PORT), ""),
- new PropertyInfo("Cache name", info.getProperty(PROP_CACHE), ""),
- new PropertyInfo("Node ID", info.getProperty(PROP_NODE_ID), ""),
- new PropertyInfo("Local", info.getProperty(PROP_LOCAL), ""),
- new PropertyInfo("Collocated", info.getProperty(PROP_COLLOCATED), ""),
- new PropertyInfo("Distributed Joins", info.getProperty(PROP_DISTRIBUTED_JOINS), ""),
- new PropertyInfo("Transactions Allowed", info.getProperty(PROP_TX_ALLOWED), "")
+ new JdbcDriverPropertyInfo("Hostname", info.getProperty(PROP_HOST), ""),
+ new JdbcDriverPropertyInfo("Port number", info.getProperty(PROP_PORT), ""),
+ new JdbcDriverPropertyInfo("Cache name", info.getProperty(PROP_CACHE), ""),
+ new JdbcDriverPropertyInfo("Node ID", info.getProperty(PROP_NODE_ID), ""),
+ new JdbcDriverPropertyInfo("Local", info.getProperty(PROP_LOCAL), ""),
+ new JdbcDriverPropertyInfo("Collocated", info.getProperty(PROP_COLLOCATED), ""),
+ new JdbcDriverPropertyInfo("Distributed Joins", info.getProperty(PROP_DISTRIBUTED_JOINS), ""),
+ new JdbcDriverPropertyInfo("Transactions Allowed", info.getProperty(PROP_TX_ALLOWED), "")
);
if (info.getProperty(PROP_CFG) != null)
- props.add(new PropertyInfo("Configuration path", info.getProperty(PROP_CFG), ""));
+ props.add(new JdbcDriverPropertyInfo("Configuration path", info.getProperty(PROP_CFG), ""));
else
props.addAll(Arrays.<DriverPropertyInfo>asList(
- new PropertyInfo("ignite.client.protocol",
+ new JdbcDriverPropertyInfo("ignite.client.protocol",
info.getProperty("ignite.client.protocol", "TCP"),
"Communication protocol (TCP or HTTP)."),
- new PropertyInfo("ignite.client.connectTimeout",
+ new JdbcDriverPropertyInfo("ignite.client.connectTimeout",
info.getProperty("ignite.client.connectTimeout", "0"),
"Socket connection timeout."),
- new PropertyInfo("ignite.client.tcp.noDelay",
+ new JdbcDriverPropertyInfo("ignite.client.tcp.noDelay",
info.getProperty("ignite.client.tcp.noDelay", "true"),
"Flag indicating whether TCP_NODELAY flag should be enabled for outgoing connections."),
- new PropertyInfo("ignite.client.ssl.enabled",
+ new JdbcDriverPropertyInfo("ignite.client.ssl.enabled",
info.getProperty("ignite.client.ssl.enabled", "false"),
"Flag indicating that SSL is needed for connection."),
- new PropertyInfo("ignite.client.ssl.protocol",
+ new JdbcDriverPropertyInfo("ignite.client.ssl.protocol",
info.getProperty("ignite.client.ssl.protocol", "TLS"),
"SSL protocol."),
- new PropertyInfo("ignite.client.ssl.key.algorithm",
+ new JdbcDriverPropertyInfo("ignite.client.ssl.key.algorithm",
info.getProperty("ignite.client.ssl.key.algorithm", "SunX509"),
"Key manager algorithm."),
- new PropertyInfo("ignite.client.ssl.keystore.location",
+ new JdbcDriverPropertyInfo("ignite.client.ssl.keystore.location",
info.getProperty("ignite.client.ssl.keystore.location", ""),
"Key store to be used by client to connect with Ignite topology."),
- new PropertyInfo("ignite.client.ssl.keystore.password",
+ new JdbcDriverPropertyInfo("ignite.client.ssl.keystore.password",
info.getProperty("ignite.client.ssl.keystore.password", ""),
"Key store password."),
- new PropertyInfo("ignite.client.ssl.keystore.type",
+ new JdbcDriverPropertyInfo("ignite.client.ssl.keystore.type",
info.getProperty("ignite.client.ssl.keystore.type", "jks"),
"Key store type."),
- new PropertyInfo("ignite.client.ssl.truststore.location",
+ new JdbcDriverPropertyInfo("ignite.client.ssl.truststore.location",
info.getProperty("ignite.client.ssl.truststore.location", ""),
"Trust store to be used by client to connect with Ignite topology."),
- new PropertyInfo("ignite.client.ssl.keystore.password",
+ new JdbcDriverPropertyInfo("ignite.client.ssl.keystore.password",
info.getProperty("ignite.client.ssl.truststore.password", ""),
"Trust store password."),
- new PropertyInfo("ignite.client.ssl.truststore.type",
+ new JdbcDriverPropertyInfo("ignite.client.ssl.truststore.type",
info.getProperty("ignite.client.ssl.truststore.type", "jks"),
"Trust store type."),
- new PropertyInfo("ignite.client.credentials",
+ new JdbcDriverPropertyInfo("ignite.client.credentials",
info.getProperty("ignite.client.credentials", ""),
"Client credentials used in authentication process."),
- new PropertyInfo("ignite.client.cache.top",
+ new JdbcDriverPropertyInfo("ignite.client.cache.top",
info.getProperty("ignite.client.cache.top", "false"),
"Flag indicating that topology is cached internally. Cache will be refreshed in the " +
"background with interval defined by topologyRefreshFrequency property (see below)."),
- new PropertyInfo("ignite.client.topology.refresh",
+ new JdbcDriverPropertyInfo("ignite.client.topology.refresh",
info.getProperty("ignite.client.topology.refresh", "2000"),
"Topology cache refresh frequency (ms)."),
- new PropertyInfo("ignite.client.idleTimeout",
+ new JdbcDriverPropertyInfo("ignite.client.idleTimeout",
info.getProperty("ignite.client.idleTimeout", "30000"),
"Maximum amount of time that connection can be idle before it is closed (ms).")
)
@@ -607,22 +608,4 @@ public class IgniteJdbcDriver implements Driver {
return true;
}
-
- /**
- * Extension of {@link DriverPropertyInfo} that adds
- * convenient constructors.
- */
- private static class PropertyInfo extends DriverPropertyInfo {
-
- /**
- * @param name Name.
- * @param val Value.
- * @param desc Description.
- */
- private PropertyInfo(String name, String val, String desc) {
- super(name, val);
-
- description = desc;
- }
- }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d70ebff6/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcDriverPropertyInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcDriverPropertyInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcDriverPropertyInfo.java
new file mode 100644
index 0000000..3b58736
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcDriverPropertyInfo.java
@@ -0,0 +1,37 @@
+/*
+ * 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.jdbc;
+
+import java.sql.DriverPropertyInfo;
+
+/**
+ * Extension of {@link DriverPropertyInfo} that adds
+ * convenient constructors.
+ */
+public class JdbcDriverPropertyInfo extends DriverPropertyInfo {
+ /**
+ * @param name Name.
+ * @param val Value.
+ * @param desc Description.
+ */
+ public JdbcDriverPropertyInfo(String name, String val, String desc) {
+ super(name, val);
+
+ description = desc;
+ }
+}
[50/50] [abbrv] ignite git commit: Merge remote-tracking branch
'remotes/origin/master' into ignite-5009
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into ignite-5009
# Conflicts:
# modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/61021b10
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/61021b10
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/61021b10
Branch: refs/heads/ignite-5009
Commit: 61021b109ccef68568a5efc43eb9e0948909985c
Parents: 658aadc
Author: sboikov <sb...@gridgain.com>
Authored: Fri May 5 12:44:59 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri May 5 12:44:59 2017 +0300
----------------------------------------------------------------------
.../ignite/internal/processors/cache/GridCacheAdapter.java | 8 --------
.../ignite/internal/processors/cache/GridCacheContext.java | 2 +-
.../internal/processors/cache/IgniteCacheExpiryPolicy.java | 5 -----
.../distributed/dht/atomic/GridDhtAtomicCacheEntry.java | 1 -
.../dht/colocated/GridDhtColocatedCacheEntry.java | 1 -
.../processors/cache/IgniteCacheNoSyncForGetTest.java | 5 +++--
.../cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java | 2 +-
7 files changed, 5 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/61021b10/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 60faaff..60842f9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -5622,10 +5622,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
return CU.toTtl(expiryPlc.getExpiryForAccess());
}
- @Override public boolean hasAccessTtl() {
- return CU.toTtl(expiryPlc.getExpiryForAccess()) != CU.TTL_NOT_CHANGED;
- }
-
@Override public long forCreate() {
return CU.toTtl(expiryPlc.getExpiryForCreation());
}
@@ -5654,10 +5650,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
return accessTtl;
}
- @Override public boolean hasAccessTtl() {
- return accessTtl != CU.TTL_NOT_CHANGED;
- }
-
/** {@inheritDoc} */
@Override public long forUpdate() {
return CU.TTL_NOT_CHANGED;
http://git-wip-us.apache.org/repos/asf/ignite/blob/61021b10/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
index d970684..1b3b57b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
@@ -2043,7 +2043,7 @@ public class GridCacheContext<K, V> implements Externalizable {
* @return {@code True} if it is possible directly read offheap instead of using {@link GridCacheEntryEx#innerGet}.
*/
public boolean readNoEntry(IgniteCacheExpiryPolicy expiryPlc, boolean readers) {
- return !readers && (expiryPlc == null || !expiryPlc.hasAccessTtl());
+ return !readers && expiryPlc == null;
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/61021b10/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheExpiryPolicy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheExpiryPolicy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheExpiryPolicy.java
index 96f1c6f..f82c5f0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheExpiryPolicy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheExpiryPolicy.java
@@ -46,11 +46,6 @@ public interface IgniteCacheExpiryPolicy {
public long forAccess();
/**
- * @return {@code True} if expiry policy change ttl on entry read.
- */
- public boolean hasAccessTtl();
-
- /**
* Callback for ttl update on entry access.
*
* @param key Entry key.
http://git-wip-us.apache.org/repos/asf/ignite/blob/61021b10/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCacheEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCacheEntry.java
index d3aca1f..b0c9a64 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCacheEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCacheEntry.java
@@ -18,7 +18,6 @@
package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.cache.CacheObject;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheEntry;
http://git-wip-us.apache.org/repos/asf/ignite/blob/61021b10/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCacheEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCacheEntry.java
index f2ff2d3..f7cc5a7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCacheEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCacheEntry.java
@@ -18,7 +18,6 @@
package org.apache.ignite.internal.processors.cache.distributed.dht.colocated;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.cache.CacheObject;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheEntry;
http://git-wip-us.apache.org/repos/asf/ignite/blob/61021b10/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNoSyncForGetTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNoSyncForGetTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNoSyncForGetTest.java
index 4e2c534..13490c6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNoSyncForGetTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNoSyncForGetTest.java
@@ -115,9 +115,10 @@ public class IgniteCacheNoSyncForGetTest extends GridCommonAbstractTest {
*/
private void getTest(CacheAtomicityMode atomicityMode) throws Exception {
boolean getAll[] = {true, false};
- boolean cfgExpiryPlc[] = {true, false};
- boolean withExpiryPlc[] = {true, false};
+ boolean cfgExpiryPlc[] = {false};
+ boolean withExpiryPlc[] = {false};
boolean heapCache[] = {true, false};
+
for (boolean getAll0 : getAll) {
for (boolean expiryPlc0 : cfgExpiryPlc) {
for (boolean withExpiryPlc0 : withExpiryPlc) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/61021b10/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java
index 6186352..2b79367 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java
@@ -1009,7 +1009,7 @@ public abstract class IgniteCacheExpiryPolicyAbstractTest extends IgniteCacheAbs
if (cacheMode() != PARTITIONED)
return;
- factory = CreatedExpiryPolicy.factoryOf(new Duration(TimeUnit.SECONDS,2));
+ factory = CreatedExpiryPolicy.factoryOf(new Duration(TimeUnit.SECONDS, 2));
nearCache = true;
[26/50] [abbrv] ignite git commit: IGNITE-5135 .NET: Improve remote
error propagation
Posted by sb...@apache.org.
IGNITE-5135 .NET: Improve remote error propagation
This closes #1899
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/97c2a3ce
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/97c2a3ce
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/97c2a3ce
Branch: refs/heads/ignite-5009
Commit: 97c2a3ce0f1d0a6f30e288bee8102cb107f46ee6
Parents: ed72663
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Wed May 3 16:45:52 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Wed May 3 16:45:52 2017 +0300
----------------------------------------------------------------------
.../Compute/BinarizableClosureTaskTest.cs | 10 +-
.../Compute/ComputeApiTest.cs | 26 +++++
.../Compute/FailoverTaskSelfTest.cs | 46 +++-----
.../Compute/IgniteExceptionTaskSelfTest.cs | 105 ++++++++++---------
.../Compute/SerializableClosureTaskTest.cs | 30 +++---
.../Log/CustomLoggerTest.cs | 3 +-
.../Compute/ComputeTaskAdapter.cs | 4 +-
.../Closure/ComputeAbstractClosureTask.cs | 3 +-
.../Apache.Ignite.Core/Impl/Compute/Compute.cs | 17 +++
.../Impl/Compute/ComputeJobHolder.cs | 3 +-
.../Impl/Compute/ComputeTaskHolder.cs | 8 +-
11 files changed, 149 insertions(+), 106 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/97c2a3ce/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/BinarizableClosureTaskTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/BinarizableClosureTaskTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/BinarizableClosureTaskTest.cs
index 051917b..e8952bf 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/BinarizableClosureTaskTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/BinarizableClosureTaskTest.cs
@@ -56,9 +56,9 @@ namespace Apache.Ignite.Core.Tests.Compute
{
Assert.IsTrue(res != null);
- BinarizableResult res0 = res as BinarizableResult;
+ var res0 = res as BinarizableResult;
- Assert.IsTrue(res0 != null);
+ Assert.IsNotNull(res0);
Assert.AreEqual(1, res0.Res);
}
@@ -72,9 +72,11 @@ namespace Apache.Ignite.Core.Tests.Compute
if (aggregate != null)
err = aggregate.InnerException;
- BinarizableException err0 = err as BinarizableException;
+ Assert.IsNotNull(err);
- Assert.IsTrue(err0 != null);
+ var err0 = err.InnerException as BinarizableException;
+
+ Assert.IsNotNull(err0);
Assert.AreEqual(ErrMsg, err0.Msg);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/97c2a3ce/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
index 02eb266..e403d93 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
@@ -1265,6 +1265,22 @@ namespace Apache.Ignite.Core.Tests.Compute
Assert.Throws<BinaryObjectException>(
() => _grid1.GetCompute().Execute<NetSimpleJobArgument, NetSimpleJobResult, NetSimpleTaskResult>(
typeof (NetSimpleTask), new NetSimpleJobArgument(-1)));
+
+ // Local.
+ var ex = Assert.Throws<IgniteException>(() =>
+ _grid1.GetCluster().ForLocal().GetCompute().Broadcast(new ExceptionalComputeAction()));
+
+ Assert.AreEqual("Compute job has failed on local node, examine InnerException for details.", ex.Message);
+ Assert.IsNotNull(ex.InnerException);
+ Assert.AreEqual(ExceptionalComputeAction.ErrorText, ex.InnerException.Message);
+
+ // Remote.
+ ex = Assert.Throws<IgniteException>(() =>
+ _grid1.GetCluster().ForRemotes().GetCompute().Broadcast(new ExceptionalComputeAction()));
+
+ Assert.AreEqual("Compute job has failed on remote node, examine InnerException for details.", ex.Message);
+ Assert.IsNotNull(ex.InnerException);
+ Assert.AreEqual(ExceptionalComputeAction.ErrorText, ex.InnerException.Message);
}
/// <summary>
@@ -1465,6 +1481,16 @@ namespace Apache.Ignite.Core.Tests.Compute
}
}
+ class ExceptionalComputeAction : IComputeAction
+ {
+ public const string ErrorText = "Expected user exception";
+
+ public void Invoke()
+ {
+ throw new OverflowException(ErrorText);
+ }
+ }
+
interface IUserInterface<out T>
{
T Invoke();
http://git-wip-us.apache.org/repos/asf/ignite/blob/97c2a3ce/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/FailoverTaskSelfTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/FailoverTaskSelfTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/FailoverTaskSelfTest.cs
index 9eb87c0..3193e46 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/FailoverTaskSelfTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/FailoverTaskSelfTest.cs
@@ -19,6 +19,7 @@ namespace Apache.Ignite.Core.Tests.Compute
{
using System;
using System.Collections.Generic;
+ using System.Linq;
using Apache.Ignite.Core.Cluster;
using Apache.Ignite.Core.Compute;
using Apache.Ignite.Core.Resource;
@@ -112,45 +113,28 @@ namespace Apache.Ignite.Core.Tests.Compute
/// <summary>
/// Test task.
/// </summary>
- public class TestTask : ComputeTaskAdapter<Tuple<bool, bool>, int, int>
+ private class TestTask : ComputeTaskAdapter<Tuple<bool, bool>, int, int>
{
/** <inheritDoc /> */
- override public IDictionary<IComputeJob<int>, IClusterNode> Map(IList<IClusterNode> subgrid, Tuple<bool, bool> arg)
+ public override IDictionary<IComputeJob<int>, IClusterNode> Map(IList<IClusterNode> subgrid,
+ Tuple<bool, bool> arg)
{
Assert.AreEqual(2, subgrid.Count);
- Tuple<bool, bool> t = arg;
+ var serializable = arg.Item1;
+ var local = arg.Item2;
- bool serializable = t.Item1;
- bool local = t.Item2;
+ var job = serializable
+ ? (IComputeJob<int>) new TestSerializableJob()
+ : new TestBinarizableJob();
- IDictionary<IComputeJob<int>, IClusterNode> jobs = new Dictionary<IComputeJob<int>, IClusterNode>();
+ var node = subgrid.Single(x => x.IsLocal == local);
- IComputeJob<int> job;
-
- if (serializable)
- job = new TestSerializableJob();
- else
- job = new TestBinarizableJob();
-
- foreach (IClusterNode node in subgrid) {
- bool add = local ? node.IsLocal : !node.IsLocal;
-
- if (add)
- {
- jobs.Add(job, node);
-
- break;
- }
- }
-
- Assert.AreEqual(1, jobs.Count);
-
- return jobs;
+ return new Dictionary<IComputeJob<int>, IClusterNode> {{job, node}};
}
/** <inheritDoc /> */
- override public int Reduce(IList<IComputeJobResult<int>> results)
+ public override int Reduce(IList<IComputeJobResult<int>> results)
{
Assert.AreEqual(1, results.Count);
@@ -162,7 +146,7 @@ namespace Apache.Ignite.Core.Tests.Compute
///
/// </summary>
[Serializable]
- class TestClosure : IComputeFunc<int>
+ private class TestClosure : IComputeFunc<int>
{
[InstanceResource]
private readonly IIgnite _grid = null;
@@ -178,7 +162,7 @@ namespace Apache.Ignite.Core.Tests.Compute
///
/// </summary>
[Serializable]
- class TestSerializableJob : IComputeJob<int>
+ private class TestSerializableJob : IComputeJob<int>
{
[InstanceResource]
private readonly IIgnite _grid = null;
@@ -199,7 +183,7 @@ namespace Apache.Ignite.Core.Tests.Compute
/// <summary>
///
/// </summary>
- class TestBinarizableJob : IComputeJob<int>
+ private class TestBinarizableJob : IComputeJob<int>
{
[InstanceResource]
private readonly IIgnite _grid = null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/97c2a3ce/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/IgniteExceptionTaskSelfTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/IgniteExceptionTaskSelfTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/IgniteExceptionTaskSelfTest.cs
index 21cd263..2f9f6b4 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/IgniteExceptionTaskSelfTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/IgniteExceptionTaskSelfTest.cs
@@ -34,10 +34,10 @@ namespace Apache.Ignite.Core.Tests.Compute
public class IgniteExceptionTaskSelfTest : AbstractTaskTest
{
/** Error mode. */
- public static ErrorMode Mode;
+ private static ErrorMode _mode;
/** Observed job errors. */
- public static readonly ICollection<Exception> JobErrs = new List<Exception>();
+ private static readonly ICollection<Exception> JobErrs = new List<Exception>();
/// <summary>
/// Constructor.
@@ -56,7 +56,7 @@ namespace Apache.Ignite.Core.Tests.Compute
[Test]
public void TestMapError()
{
- Mode = ErrorMode.MapErr;
+ _mode = ErrorMode.MapErr;
GoodException e = ExecuteWithError() as GoodException;
@@ -71,7 +71,7 @@ namespace Apache.Ignite.Core.Tests.Compute
[Test]
public void TestMapNotMarshalableError()
{
- Mode = ErrorMode.MapErrNotMarshalable;
+ _mode = ErrorMode.MapErrNotMarshalable;
BadException e = ExecuteWithError() as BadException;
@@ -86,7 +86,7 @@ namespace Apache.Ignite.Core.Tests.Compute
[Test]
public void TestMapNotMarshalableJob()
{
- Mode = ErrorMode.MapJobNotMarshalable;
+ _mode = ErrorMode.MapJobNotMarshalable;
Assert.IsInstanceOf<BinaryObjectException>(ExecuteWithError());
}
@@ -97,15 +97,16 @@ namespace Apache.Ignite.Core.Tests.Compute
[Test]
public void TestLocalJobError()
{
- Mode = ErrorMode.LocJobErr;
+ _mode = ErrorMode.LocJobErr;
int res = Execute();
Assert.AreEqual(1, res);
Assert.AreEqual(4, JobErrs.Count);
- Assert.IsNotNull(JobErrs.First() as GoodException);
- Assert.AreEqual(ErrorMode.LocJobErr, ((GoodException) JobErrs.First()).Mode);
+ var goodEx = JobErrs.First().InnerException as GoodException;
+ Assert.IsNotNull(goodEx);
+ Assert.AreEqual(ErrorMode.LocJobErr, goodEx.Mode);
}
/// <summary>
@@ -114,14 +115,14 @@ namespace Apache.Ignite.Core.Tests.Compute
[Test]
public void TestLocalJobErrorNotMarshalable()
{
- Mode = ErrorMode.LocJobErrNotMarshalable;
+ _mode = ErrorMode.LocJobErrNotMarshalable;
int res = Execute();
Assert.AreEqual(1, res);
Assert.AreEqual(4, JobErrs.Count);
- Assert.IsNotNull(JobErrs.First() as BadException); // Local job exception is not marshalled.
+ Assert.IsInstanceOf<BadException>(JobErrs.First().InnerException); // Local job exception is not marshalled.
}
/// <summary>
@@ -130,7 +131,7 @@ namespace Apache.Ignite.Core.Tests.Compute
[Test]
public void TestLocalJobResultNotMarshalable()
{
- Mode = ErrorMode.LocJobResNotMarshalable;
+ _mode = ErrorMode.LocJobResNotMarshalable;
int res = Execute();
@@ -145,7 +146,7 @@ namespace Apache.Ignite.Core.Tests.Compute
[Test]
public void TestRemoteJobError()
{
- Mode = ErrorMode.RmtJobErr;
+ _mode = ErrorMode.RmtJobErr;
int res = Execute();
@@ -153,9 +154,10 @@ namespace Apache.Ignite.Core.Tests.Compute
Assert.AreEqual(4, JobErrs.Count);
- Assert.IsNotNull(JobErrs.ElementAt(0) as GoodException);
+ var goodEx = JobErrs.First().InnerException as GoodException;
+ Assert.IsNotNull(goodEx);
- Assert.AreEqual(ErrorMode.RmtJobErr, ((GoodException) JobErrs.ElementAt(0)).Mode);
+ Assert.AreEqual(ErrorMode.RmtJobErr, goodEx.Mode);
}
/// <summary>
@@ -164,7 +166,7 @@ namespace Apache.Ignite.Core.Tests.Compute
[Test]
public void TestRemoteJobErrorNotMarshalable()
{
- Mode = ErrorMode.RmtJobErrNotMarshalable;
+ _mode = ErrorMode.RmtJobErrNotMarshalable;
Assert.Throws<SerializationException>(() => Execute());
}
@@ -175,7 +177,7 @@ namespace Apache.Ignite.Core.Tests.Compute
[Test]
public void TestRemoteJobResultNotMarshalable()
{
- Mode = ErrorMode.RmtJobResNotMarshalable;
+ _mode = ErrorMode.RmtJobResNotMarshalable;
int res = Execute();
@@ -192,7 +194,7 @@ namespace Apache.Ignite.Core.Tests.Compute
[Test]
public void TestLocalResultError()
{
- Mode = ErrorMode.LocResErr;
+ _mode = ErrorMode.LocResErr;
GoodException e = ExecuteWithError() as GoodException;
@@ -207,7 +209,7 @@ namespace Apache.Ignite.Core.Tests.Compute
[Test]
public void TestLocalResultErrorNotMarshalable()
{
- Mode = ErrorMode.LocResErrNotMarshalable;
+ _mode = ErrorMode.LocResErrNotMarshalable;
BadException e = ExecuteWithError() as BadException;
@@ -222,7 +224,7 @@ namespace Apache.Ignite.Core.Tests.Compute
[Test]
public void TestRemoteResultError()
{
- Mode = ErrorMode.RmtResErr;
+ _mode = ErrorMode.RmtResErr;
GoodException e = ExecuteWithError() as GoodException;
@@ -237,7 +239,7 @@ namespace Apache.Ignite.Core.Tests.Compute
[Test]
public void TestRemoteResultErrorNotMarshalable()
{
- Mode = ErrorMode.RmtResErrNotMarshalable;
+ _mode = ErrorMode.RmtResErrNotMarshalable;
BadException e = ExecuteWithError() as BadException;
@@ -252,7 +254,7 @@ namespace Apache.Ignite.Core.Tests.Compute
[Test]
public void TestReduceError()
{
- Mode = ErrorMode.ReduceErr;
+ _mode = ErrorMode.ReduceErr;
GoodException e = ExecuteWithError() as GoodException;
@@ -267,7 +269,7 @@ namespace Apache.Ignite.Core.Tests.Compute
[Test]
public void TestReduceErrorNotMarshalable()
{
- Mode = ErrorMode.ReduceErrNotMarshalable;
+ _mode = ErrorMode.ReduceErrNotMarshalable;
BadException e = ExecuteWithError() as BadException;
@@ -282,7 +284,7 @@ namespace Apache.Ignite.Core.Tests.Compute
[Test]
public void TestReduceResultNotMarshalable()
{
- Mode = ErrorMode.ReduceResNotMarshalable;
+ _mode = ErrorMode.ReduceResNotMarshalable;
int res = Execute();
@@ -326,7 +328,7 @@ namespace Apache.Ignite.Core.Tests.Compute
/// <summary>
/// Error modes.
/// </summary>
- public enum ErrorMode
+ private enum ErrorMode
{
/** Error during map step. */
MapErr,
@@ -392,7 +394,7 @@ namespace Apache.Ignite.Core.Tests.Compute
/** <inheritDoc /> */
public IDictionary<IComputeJob<object>, IClusterNode> Map(IList<IClusterNode> subgrid, object arg)
{
- switch (Mode)
+ switch (_mode)
{
case ErrorMode.MapErr:
throw new GoodException(ErrorMode.MapErr);
@@ -424,16 +426,19 @@ namespace Apache.Ignite.Core.Tests.Compute
public ComputeJobResultPolicy OnResult(IComputeJobResult<object> res, IList<IComputeJobResult<object>> rcvd)
{
if (res.Exception != null)
+ {
JobErrs.Add(res.Exception);
+ }
else
{
object res0 = res.Data;
- bool rmt = res0 is GoodJobResult ? ((GoodJobResult)res0).Rmt : ((BadJobResult)res0).Rmt;
+ var result = res0 as GoodJobResult;
+ bool rmt = result != null ? result.Rmt : ((BadJobResult) res0).Rmt;
if (rmt)
{
- switch (Mode)
+ switch (_mode)
{
case ErrorMode.RmtResErr:
throw new GoodException(ErrorMode.RmtResErr);
@@ -444,7 +449,7 @@ namespace Apache.Ignite.Core.Tests.Compute
}
else
{
- switch (Mode)
+ switch (_mode)
{
case ErrorMode.LocResErr:
throw new GoodException(ErrorMode.LocResErr);
@@ -463,7 +468,7 @@ namespace Apache.Ignite.Core.Tests.Compute
/** <inheritDoc /> */
public object Reduce(IList<IComputeJobResult<object>> results)
{
- switch (Mode)
+ switch (_mode)
{
case ErrorMode.ReduceErr:
throw new GoodException(ErrorMode.ReduceErr);
@@ -483,10 +488,10 @@ namespace Apache.Ignite.Core.Tests.Compute
///
/// </summary>
[Serializable]
- public class GoodJob : IComputeJob<object>
+ private class GoodJob : IComputeJob<object>, ISerializable
{
/** Whether the job is remote. */
- private bool _rmt;
+ private readonly bool _rmt;
/// <summary>
///
@@ -502,7 +507,7 @@ namespace Apache.Ignite.Core.Tests.Compute
/// </summary>
/// <param name="info"></param>
/// <param name="context"></param>
- public GoodJob(SerializationInfo info, StreamingContext context)
+ protected GoodJob(SerializationInfo info, StreamingContext context)
{
_rmt = info.GetBoolean("rmt");
}
@@ -518,7 +523,7 @@ namespace Apache.Ignite.Core.Tests.Compute
{
if (_rmt)
{
- switch (Mode)
+ switch (_mode)
{
case ErrorMode.RmtJobErr:
throw new GoodException(ErrorMode.RmtJobErr);
@@ -532,7 +537,7 @@ namespace Apache.Ignite.Core.Tests.Compute
}
else
{
- switch (Mode)
+ switch (_mode)
{
case ErrorMode.LocJobErr:
throw new GoodException(ErrorMode.LocJobErr);
@@ -558,7 +563,7 @@ namespace Apache.Ignite.Core.Tests.Compute
/// <summary>
///
/// </summary>
- public class BadJob : IComputeJob<object>, IBinarizable
+ private class BadJob : IComputeJob<object>, IBinarizable
{
[InstanceResource]
@@ -591,10 +596,10 @@ namespace Apache.Ignite.Core.Tests.Compute
///
/// </summary>
[Serializable]
- public class GoodJobResult
+ private class GoodJobResult : ISerializable
{
/** */
- public bool Rmt;
+ public readonly bool Rmt;
/// <summary>
///
@@ -610,7 +615,7 @@ namespace Apache.Ignite.Core.Tests.Compute
/// </summary>
/// <param name="info"></param>
/// <param name="context"></param>
- public GoodJobResult(SerializationInfo info, StreamingContext context)
+ protected GoodJobResult(SerializationInfo info, StreamingContext context)
{
Rmt = info.GetBoolean("rmt");
}
@@ -625,10 +630,10 @@ namespace Apache.Ignite.Core.Tests.Compute
/// <summary>
///
/// </summary>
- public class BadJobResult : IBinarizable
+ private class BadJobResult : IBinarizable
{
/** */
- public bool Rmt;
+ public readonly bool Rmt;
/// <summary>
///
@@ -656,10 +661,10 @@ namespace Apache.Ignite.Core.Tests.Compute
///
/// </summary>
[Serializable]
- public class GoodTaskResult
+ private class GoodTaskResult : ISerializable
{
/** */
- public int Res;
+ public readonly int Res;
/// <summary>
///
@@ -675,7 +680,7 @@ namespace Apache.Ignite.Core.Tests.Compute
/// </summary>
/// <param name="info"></param>
/// <param name="context"></param>
- public GoodTaskResult(SerializationInfo info, StreamingContext context)
+ protected GoodTaskResult(SerializationInfo info, StreamingContext context)
{
Res = info.GetInt32("res");
}
@@ -690,10 +695,10 @@ namespace Apache.Ignite.Core.Tests.Compute
/// <summary>
///
/// </summary>
- public class BadTaskResult
+ private class BadTaskResult
{
/** */
- public int Res;
+ public readonly int Res;
/// <summary>
///
@@ -709,10 +714,10 @@ namespace Apache.Ignite.Core.Tests.Compute
/// Marshalable exception.
/// </summary>
[Serializable]
- public class GoodException : Exception
+ private class GoodException : Exception
{
/** */
- public ErrorMode Mode;
+ public readonly ErrorMode Mode;
/// <summary>
///
@@ -728,7 +733,7 @@ namespace Apache.Ignite.Core.Tests.Compute
/// </summary>
/// <param name="info"></param>
/// <param name="context"></param>
- public GoodException(SerializationInfo info, StreamingContext context)
+ protected GoodException(SerializationInfo info, StreamingContext context)
{
Mode = (ErrorMode)info.GetInt32("mode");
}
@@ -745,10 +750,10 @@ namespace Apache.Ignite.Core.Tests.Compute
/// <summary>
/// Not marshalable exception.
/// </summary>
- public class BadException : Exception
+ private class BadException : Exception
{
/** */
- public ErrorMode Mode;
+ public readonly ErrorMode Mode;
/// <summary>
///
http://git-wip-us.apache.org/repos/asf/ignite/blob/97c2a3ce/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/SerializableClosureTaskTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/SerializableClosureTaskTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/SerializableClosureTaskTest.cs
index 9f1ae68..ecb4aa5 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/SerializableClosureTaskTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/SerializableClosureTaskTest.cs
@@ -54,11 +54,11 @@ namespace Apache.Ignite.Core.Tests.Compute
/** <inheritDoc /> */
protected override void CheckResult(object res)
{
- Assert.IsTrue(res != null);
+ Assert.IsNotNull(res);
- SerializableResult res0 = res as SerializableResult;
+ var res0 = res as SerializableResult;
- Assert.IsTrue(res0 != null);
+ Assert.IsNotNull(res0);
Assert.AreEqual(1, res0.Res);
}
@@ -72,9 +72,10 @@ namespace Apache.Ignite.Core.Tests.Compute
if (aggregate != null)
err = aggregate.InnerException;
- SerializableException err0 = err as SerializableException;
+ Assert.IsNotNull(err);
+ SerializableException err0 = err.InnerException as SerializableException;
- Assert.IsTrue(err0 != null);
+ Assert.IsNotNull(err0);
Assert.AreEqual(ErrMsg, err0.Msg);
}
@@ -85,12 +86,12 @@ namespace Apache.Ignite.Core.Tests.Compute
private class SerializableOutFunc : IComputeFunc<object>
{
/** Error. */
- private bool _err;
+ private readonly bool _err;
/// <summary>
///
/// </summary>
- public SerializableOutFunc()
+ private SerializableOutFunc()
{
// No-op.
}
@@ -109,6 +110,7 @@ namespace Apache.Ignite.Core.Tests.Compute
{
if (_err)
throw new SerializableException(ErrMsg);
+
return new SerializableResult(1);
}
}
@@ -120,12 +122,12 @@ namespace Apache.Ignite.Core.Tests.Compute
private class SerializableFunc : IComputeFunc<object, object>
{
/** Error. */
- private bool _err;
+ private readonly bool _err;
/// <summary>
///
/// </summary>
- public SerializableFunc()
+ private SerializableFunc()
{
// No-op.
}
@@ -157,12 +159,12 @@ namespace Apache.Ignite.Core.Tests.Compute
private class SerializableException : Exception
{
/** */
- public string Msg;
+ public readonly string Msg;
/// <summary>
///
/// </summary>
- public SerializableException()
+ private SerializableException()
{
// No-op.
}
@@ -180,7 +182,7 @@ namespace Apache.Ignite.Core.Tests.Compute
/// </summary>
/// <param name="info"></param>
/// <param name="context"></param>
- public SerializableException(SerializationInfo info, StreamingContext context) : base(info, context)
+ protected SerializableException(SerializationInfo info, StreamingContext context) : base(info, context)
{
Msg = info.GetString("msg");
}
@@ -200,12 +202,12 @@ namespace Apache.Ignite.Core.Tests.Compute
[Serializable]
private class SerializableResult
{
- public int Res;
+ public readonly int Res;
/// <summary>
///
/// </summary>
- public SerializableResult()
+ private SerializableResult()
{
// No-op.
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/97c2a3ce/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Log/CustomLoggerTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Log/CustomLoggerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Log/CustomLoggerTest.cs
index 567ca2f..7d4c945 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Log/CustomLoggerTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Log/CustomLoggerTest.cs
@@ -130,7 +130,8 @@ namespace Apache.Ignite.Core.Tests.Log
{
var compute = ignite.GetCluster().ForRemotes().GetCompute();
- Assert.Throws<ArithmeticException>(() => compute.Call(new FailFunc()));
+ var ex = Assert.Throws<IgniteException>(() => compute.Call(new FailFunc()));
+ Assert.IsInstanceOf<ArithmeticException>(ex.InnerException);
// Log updates may not arrive immediately
TestUtils.WaitForCondition(() => TestLogger.Entries.Any(x => x.Exception != null), 3000);
http://git-wip-us.apache.org/repos/asf/ignite/blob/97c2a3ce/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeTaskAdapter.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeTaskAdapter.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeTaskAdapter.cs
index 79f32a6..a344b51 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeTaskAdapter.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeTaskAdapter.cs
@@ -22,6 +22,7 @@ namespace Apache.Ignite.Core.Compute
using System.Diagnostics.CodeAnalysis;
using Apache.Ignite.Core.Cluster;
using Apache.Ignite.Core.Common;
+ using Apache.Ignite.Core.Impl.Compute;
/// <summary>
/// Convenience adapter for <see cref="IComputeTask{TArg,TJobRes,TTaskRes}"/> interface
@@ -51,8 +52,7 @@ namespace Apache.Ignite.Core.Compute
if (err != null)
{
- if (err is ComputeExecutionRejectedException || err is ClusterTopologyException ||
- err is ComputeJobFailoverException)
+ if (Compute.IsFailoverException(err))
return ComputeJobResultPolicy.Failover;
throw new IgniteException("Remote job threw user exception (override or implement " +
http://git-wip-us.apache.org/repos/asf/ignite/blob/97c2a3ce/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeAbstractClosureTask.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeAbstractClosureTask.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeAbstractClosureTask.cs
index c967c7b..6d6e6a2 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeAbstractClosureTask.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeAbstractClosureTask.cs
@@ -68,8 +68,7 @@ namespace Apache.Ignite.Core.Impl.Compute.Closure
if (err != null)
{
- if (err is ComputeExecutionRejectedException || err is ClusterTopologyException ||
- err is ComputeJobFailoverException)
+ if (Compute.IsFailoverException(err))
return ComputeJobResultPolicy.Failover;
throw err;
http://git-wip-us.apache.org/repos/asf/ignite/blob/97c2a3ce/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Compute.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Compute.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Compute.cs
index efe5905..b54d6a9 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Compute.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Compute.cs
@@ -461,5 +461,22 @@ namespace Apache.Ignite.Core.Impl.Compute
return null;
}
+
+ /// <summary>
+ /// Determines whether specified exception should result in a job failover.
+ /// </summary>
+ internal static bool IsFailoverException(Exception err)
+ {
+ while (err != null)
+ {
+ if (err is ComputeExecutionRejectedException || err is ClusterTopologyException ||
+ err is ComputeJobFailoverException)
+ return true;
+
+ err = err.InnerException;
+ }
+
+ return false;
+ }
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/97c2a3ce/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJobHolder.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJobHolder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJobHolder.cs
index 6389730..314814d 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJobHolder.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJobHolder.cs
@@ -83,7 +83,8 @@ namespace Apache.Ignite.Core.Impl.Compute
_jobRes = new ComputeJobResultImpl(
success ? res : null,
- success ? null : res as Exception,
+ success ? null : new IgniteException("Compute job has failed on local node, " +
+ "examine InnerException for details.", (Exception) res),
_job,
_ignite.GetLocalNode().Id,
cancel
http://git-wip-us.apache.org/repos/asf/ignite/blob/97c2a3ce/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeTaskHolder.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeTaskHolder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeTaskHolder.cs
index a6d7cb4..489fe44 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeTaskHolder.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeTaskHolder.cs
@@ -327,7 +327,13 @@ namespace Apache.Ignite.Core.Impl.Compute
var data = BinaryUtils.ReadInvocationResult(reader, out err);
// 2. Process the result.
- return (int) JobResult0(new ComputeJobResultImpl(data, (Exception) err, job.Job, nodeId.Value, cancelled));
+ var exception = (Exception) err;
+ exception = exception == null
+ ? null
+ : new IgniteException("Compute job has failed on remote node, " +
+ "examine InnerException for details.", exception);
+
+ return (int) JobResult0(new ComputeJobResultImpl(data, exception, job.Job, nodeId.Value, cancelled));
}
catch (Exception e)
{
[06/50] [abbrv] ignite git commit: IGNITE-4082 Define filter names in
app.js instead of filter definitions.
Posted by sb...@apache.org.
IGNITE-4082 Define filter names in app.js instead of filter definitions.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7297e1dc
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7297e1dc
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7297e1dc
Branch: refs/heads/ignite-5009
Commit: 7297e1dcac183e81336a588a17fc1a706b8075d7
Parents: 25f0f75
Author: Ilya Borisov <kl...@gmail.com>
Authored: Fri Apr 28 17:09:02 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Apr 28 17:09:02 2017 +0700
----------------------------------------------------------------------
modules/web-console/frontend/app/app.js | 8 ++++----
modules/web-console/frontend/app/filters/byName.filter.js | 4 ++--
.../frontend/app/filters/domainsValidation.filter.js | 4 ++--
modules/web-console/frontend/app/filters/duration.filter.js | 4 ++--
modules/web-console/frontend/app/filters/hasPojo.filter.js | 4 ++--
5 files changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7297e1dc/modules/web-console/frontend/app/app.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/app.js b/modules/web-console/frontend/app/app.js
index a8460e9..1f87196 100644
--- a/modules/web-console/frontend/app/app.js
+++ b/modules/web-console/frontend/app/app.js
@@ -226,11 +226,11 @@ angular
.controller(...igfs)
.controller(...profile)
// Filters.
-.filter(...byName)
+.filter('byName', byName)
.filter('defaultName', defaultName)
-.filter(...domainsValidation)
-.filter(...duration)
-.filter(...hasPojo)
+.filter('domainsValidation', domainsValidation)
+.filter('duration', duration)
+.filter('hasPojo', hasPojo)
.filter('uiGridSubcategories', uiGridSubcategories)
.config(['$translateProvider', '$stateProvider', '$locationProvider', '$urlRouterProvider', ($translateProvider, $stateProvider, $locationProvider, $urlRouterProvider) => {
$translateProvider.translations('en', i18n);
http://git-wip-us.apache.org/repos/asf/ignite/blob/7297e1dc/modules/web-console/frontend/app/filters/byName.filter.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/filters/byName.filter.js b/modules/web-console/frontend/app/filters/byName.filter.js
index 3b0746f..2769189 100644
--- a/modules/web-console/frontend/app/filters/byName.filter.js
+++ b/modules/web-console/frontend/app/filters/byName.filter.js
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-export default ['byName', [() => (arr, search) => {
+export default [() => (arr, search) => {
if (!(arr && arr.length) || !search)
return arr;
return _.filter(arr, ({ name }) => name.indexOf(search) >= 0);
-}]];
+}];
http://git-wip-us.apache.org/repos/asf/ignite/blob/7297e1dc/modules/web-console/frontend/app/filters/domainsValidation.filter.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/filters/domainsValidation.filter.js b/modules/web-console/frontend/app/filters/domainsValidation.filter.js
index 1a38392..eec0ff1 100644
--- a/modules/web-console/frontend/app/filters/domainsValidation.filter.js
+++ b/modules/web-console/frontend/app/filters/domainsValidation.filter.js
@@ -16,7 +16,7 @@
*/
// Filter domain models with key fields configuration.
-export default ['domainsValidation', ['IgniteLegacyUtils', (LegacyUtils) => (domains, valid, invalid) => {
+export default ['IgniteLegacyUtils', (LegacyUtils) => (domains, valid, invalid) => {
if (valid && invalid)
return domains;
@@ -30,4 +30,4 @@ export default ['domainsValidation', ['IgniteLegacyUtils', (LegacyUtils) => (dom
});
return out;
-}]];
+}];
http://git-wip-us.apache.org/repos/asf/ignite/blob/7297e1dc/modules/web-console/frontend/app/filters/duration.filter.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/filters/duration.filter.js b/modules/web-console/frontend/app/filters/duration.filter.js
index 0d7afe6..770bca3 100644
--- a/modules/web-console/frontend/app/filters/duration.filter.js
+++ b/modules/web-console/frontend/app/filters/duration.filter.js
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-export default ['duration', [() => {
+export default [() => {
/**
* @param {Number} t Time in ms.
*/
@@ -38,4 +38,4 @@ export default ['duration', [() => {
return a(d, 'd') + a(h, 'h') + a(m, 'm') + a(s, 's') + (t < cm ? ms + 'ms' : '');
};
-}]];
+}];
http://git-wip-us.apache.org/repos/asf/ignite/blob/7297e1dc/modules/web-console/frontend/app/filters/hasPojo.filter.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/filters/hasPojo.filter.js b/modules/web-console/frontend/app/filters/hasPojo.filter.js
index ee50051..57530db 100644
--- a/modules/web-console/frontend/app/filters/hasPojo.filter.js
+++ b/modules/web-console/frontend/app/filters/hasPojo.filter.js
@@ -16,6 +16,6 @@
*/
// Filter that return 'true' if caches has at least one domain with 'generatePojo' flag.
-export default ['hasPojo', [() => ({caches} = []) =>
+export default [() => ({caches} = []) =>
_.find(caches, (cache) => cache.domains && cache.domains.length &&
- cache.domains.find((domain) => domain.generatePojo))]];
+ cache.domains.find((domain) => domain.generatePojo))];
[29/50] [abbrv] ignite git commit: IGNITE-5012 Implement ordinary
least squares (OLS) linear regression.
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/934f6ac2/modules/ml/src/main/java/org/apache/ignite/ml/regressions/OLSMultipleLinearRegression.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/regressions/OLSMultipleLinearRegression.java b/modules/ml/src/main/java/org/apache/ignite/ml/regressions/OLSMultipleLinearRegression.java
new file mode 100644
index 0000000..c53a77e
--- /dev/null
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/regressions/OLSMultipleLinearRegression.java
@@ -0,0 +1,272 @@
+/*
+ * 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.ml.regressions;
+
+import org.apache.ignite.ml.math.Matrix;
+import org.apache.ignite.ml.math.Vector;
+import org.apache.ignite.ml.math.decompositions.QRDecomposition;
+import org.apache.ignite.ml.math.exceptions.MathIllegalArgumentException;
+import org.apache.ignite.ml.math.exceptions.SingularMatrixException;
+import org.apache.ignite.ml.math.functions.Functions;
+import org.apache.ignite.ml.math.util.MatrixUtil;
+
+/**
+ * This class is based on the corresponding class from Apache Common Math lib.
+ * <p>Implements ordinary least squares (OLS) to estimate the parameters of a
+ * multiple linear regression model.</p>
+ *
+ * <p>The regression coefficients, <code>b</code>, satisfy the normal equations:
+ * <pre><code> X<sup>T</sup> X b = X<sup>T</sup> y </code></pre></p>
+ *
+ * <p>To solve the normal equations, this implementation uses QR decomposition
+ * of the <code>X</code> matrix. (See {@link QRDecomposition} for details on the
+ * decomposition algorithm.) The <code>X</code> matrix, also known as the <i>design matrix,</i>
+ * has rows corresponding to sample observations and columns corresponding to independent
+ * variables. When the model is estimated using an intercept term (i.e. when
+ * {@link #isNoIntercept() isNoIntercept} is false as it is by default), the <code>X</code>
+ * matrix includes an initial column identically equal to 1. We solve the normal equations
+ * as follows:
+ * <pre><code> X<sup>T</sup>X b = X<sup>T</sup> y
+ * (QR)<sup>T</sup> (QR) b = (QR)<sup>T</sup>y
+ * R<sup>T</sup> (Q<sup>T</sup>Q) R b = R<sup>T</sup> Q<sup>T</sup> y
+ * R<sup>T</sup> R b = R<sup>T</sup> Q<sup>T</sup> y
+ * (R<sup>T</sup>)<sup>-1</sup> R<sup>T</sup> R b = (R<sup>T</sup>)<sup>-1</sup> R<sup>T</sup> Q<sup>T</sup> y
+ * R b = Q<sup>T</sup> y </code></pre></p>
+ *
+ * <p>Given <code>Q</code> and <code>R</code>, the last equation is solved by back-substitution.</p>
+ */
+public class OLSMultipleLinearRegression extends AbstractMultipleLinearRegression {
+ /** Cached QR decomposition of X matrix */
+ private QRDecomposition qr = null;
+
+ /** Singularity threshold for QR decomposition */
+ private final double threshold;
+
+ /**
+ * Create an empty OLSMultipleLinearRegression instance.
+ */
+ public OLSMultipleLinearRegression() {
+ this(0d);
+ }
+
+ /**
+ * Create an empty OLSMultipleLinearRegression instance, using the given
+ * singularity threshold for the QR decomposition.
+ *
+ * @param threshold the singularity threshold
+ */
+ public OLSMultipleLinearRegression(final double threshold) {
+ this.threshold = threshold;
+ }
+
+ /**
+ * Loads model x and y sample data, overriding any previous sample.
+ *
+ * Computes and caches QR decomposition of the X matrix.
+ *
+ * @param y the {@code n}-sized vector representing the y sample
+ * @param x the {@code n x k} matrix representing the x sample
+ * @throws MathIllegalArgumentException if the x and y array data are not compatible for the regression
+ */
+ public void newSampleData(Vector y, Matrix x) throws MathIllegalArgumentException {
+ validateSampleData(x, y);
+ newYSampleData(y);
+ newXSampleData(x);
+ }
+
+ /**
+ * {@inheritDoc}
+ * <p>This implementation computes and caches the QR decomposition of the X matrix.</p>
+ */
+ @Override public void newSampleData(double[] data, int nobs, int nvars, Matrix like) {
+ super.newSampleData(data, nobs, nvars, like);
+ qr = new QRDecomposition(getX(), threshold);
+ }
+
+ /**
+ * <p>Compute the "hat" matrix.
+ * </p>
+ * <p>The hat matrix is defined in terms of the design matrix X
+ * by X(X<sup>T</sup>X)<sup>-1</sup>X<sup>T</sup>
+ * </p>
+ * <p>The implementation here uses the QR decomposition to compute the
+ * hat matrix as Q I<sub>p</sub>Q<sup>T</sup> where I<sub>p</sub> is the
+ * p-dimensional identity matrix augmented by 0's. This computational
+ * formula is from "The Hat Matrix in Regression and ANOVA",
+ * David C. Hoaglin and Roy E. Welsch,
+ * <i>The American Statistician</i>, Vol. 32, No. 1 (Feb., 1978), pp. 17-22.
+ * </p>
+ * <p>Data for the model must have been successfully loaded using one of
+ * the {@code newSampleData} methods before invoking this method; otherwise
+ * a {@code NullPointerException} will be thrown.</p>
+ *
+ * @return the hat matrix
+ * @throws NullPointerException unless method {@code newSampleData} has been called beforehand.
+ */
+ public Matrix calculateHat() {
+ // Create augmented identity matrix
+ // No try-catch or advertised NotStrictlyPositiveException - NPE above if n < 3
+ Matrix q = qr.getQ();
+ Matrix augI = MatrixUtil.like(q, q.columnSize(), q.columnSize());
+
+ int n = augI.columnSize();
+ int p = qr.getR().columnSize();
+
+ for (int i = 0; i < n; i++)
+ for (int j = 0; j < n; j++)
+ if (i == j && i < p)
+ augI.setX(i, j, 1d);
+ else
+ augI.setX(i, j, 0d);
+
+ // Compute and return Hat matrix
+ // No DME advertised - args valid if we get here
+ return q.times(augI).times(q.transpose());
+ }
+
+ /**
+ * <p>Returns the sum of squared deviations of Y from its mean.</p>
+ *
+ * <p>If the model has no intercept term, <code>0</code> is used for the
+ * mean of Y - i.e., what is returned is the sum of the squared Y values.</p>
+ *
+ * <p>The value returned by this method is the SSTO value used in
+ * the {@link #calculateRSquared() R-squared} computation.</p>
+ *
+ * @return SSTO - the total sum of squares
+ * @throws NullPointerException if the sample has not been set
+ * @see #isNoIntercept()
+ */
+ public double calculateTotalSumOfSquares() {
+ if (isNoIntercept())
+ return getY().foldMap(Functions.PLUS, Functions.SQUARE, 0.0);
+ else {
+ // TODO: think about incremental update formula.
+ final double mean = getY().sum() / getY().size();
+ return getY().foldMap(Functions.PLUS, x -> (mean - x) * (mean - x), 0.0);
+ }
+ }
+
+ /**
+ * Returns the sum of squared residuals.
+ *
+ * @return residual sum of squares
+ * @throws SingularMatrixException if the design matrix is singular
+ * @throws NullPointerException if the data for the model have not been loaded
+ */
+ public double calculateResidualSumOfSquares() {
+ final Vector residuals = calculateResiduals();
+ // No advertised DME, args are valid
+ return residuals.dot(residuals);
+ }
+
+ /**
+ * Returns the R-Squared statistic, defined by the formula <pre>
+ * R<sup>2</sup> = 1 - SSR / SSTO
+ * </pre>
+ * where SSR is the {@link #calculateResidualSumOfSquares() sum of squared residuals}
+ * and SSTO is the {@link #calculateTotalSumOfSquares() total sum of squares}
+ *
+ * <p>If there is no variance in y, i.e., SSTO = 0, NaN is returned.</p>
+ *
+ * @return R-square statistic
+ * @throws NullPointerException if the sample has not been set
+ * @throws SingularMatrixException if the design matrix is singular
+ */
+ public double calculateRSquared() {
+ return 1 - calculateResidualSumOfSquares() / calculateTotalSumOfSquares();
+ }
+
+ /**
+ * <p>Returns the adjusted R-squared statistic, defined by the formula <pre>
+ * R<sup>2</sup><sub>adj</sub> = 1 - [SSR (n - 1)] / [SSTO (n - p)]
+ * </pre>
+ * where SSR is the {@link #calculateResidualSumOfSquares() sum of squared residuals},
+ * SSTO is the {@link #calculateTotalSumOfSquares() total sum of squares}, n is the number
+ * of observations and p is the number of parameters estimated (including the intercept).</p>
+ *
+ * <p>If the regression is estimated without an intercept term, what is returned is <pre>
+ * <code> 1 - (1 - {@link #calculateRSquared()}) * (n / (n - p)) </code>
+ * </pre></p>
+ *
+ * <p>If there is no variance in y, i.e., SSTO = 0, NaN is returned.</p>
+ *
+ * @return adjusted R-Squared statistic
+ * @throws NullPointerException if the sample has not been set
+ * @throws SingularMatrixException if the design matrix is singular
+ * @see #isNoIntercept()
+ */
+ public double calculateAdjustedRSquared() {
+ final double n = getX().rowSize();
+ if (isNoIntercept())
+ return 1 - (1 - calculateRSquared()) * (n / (n - getX().columnSize()));
+ else
+ return 1 - (calculateResidualSumOfSquares() * (n - 1)) /
+ (calculateTotalSumOfSquares() * (n - getX().columnSize()));
+ }
+
+ /**
+ * {@inheritDoc}
+ * <p>This implementation computes and caches the QR decomposition of the X matrix
+ * once it is successfully loaded.</p>
+ */
+ @Override protected void newXSampleData(Matrix x) {
+ super.newXSampleData(x);
+ qr = new QRDecomposition(getX());
+ }
+
+ /**
+ * Calculates the regression coefficients using OLS.
+ *
+ * <p>Data for the model must have been successfully loaded using one of
+ * the {@code newSampleData} methods before invoking this method; otherwise
+ * a {@code NullPointerException} will be thrown.</p>
+ *
+ * @return beta
+ * @throws SingularMatrixException if the design matrix is singular
+ * @throws NullPointerException if the data for the model have not been loaded
+ */
+ @Override protected Vector calculateBeta() {
+ return qr.solve(getY());
+ }
+
+ /**
+ * <p>Calculates the variance-covariance matrix of the regression parameters.
+ * </p>
+ * <p>Var(b) = (X<sup>T</sup>X)<sup>-1</sup>
+ * </p>
+ * <p>Uses QR decomposition to reduce (X<sup>T</sup>X)<sup>-1</sup>
+ * to (R<sup>T</sup>R)<sup>-1</sup>, with only the top p rows of
+ * R included, where p = the length of the beta vector.</p>
+ *
+ * <p>Data for the model must have been successfully loaded using one of
+ * the {@code newSampleData} methods before invoking this method; otherwise
+ * a {@code NullPointerException} will be thrown.</p>
+ *
+ * @return The beta variance-covariance matrix
+ * @throws SingularMatrixException if the design matrix is singular
+ * @throws NullPointerException if the data for the model have not been loaded
+ */
+ @Override protected Matrix calculateBetaVariance() {
+ int p = getX().columnSize();
+
+ Matrix rAug = MatrixUtil.copy(qr.getR().viewPart(0, p, 0, p));
+ Matrix rInv = rAug.inverse();
+
+ return rInv.times(rInv.transpose());
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/934f6ac2/modules/ml/src/main/java/org/apache/ignite/ml/regressions/RegressionsErrorMessages.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/regressions/RegressionsErrorMessages.java b/modules/ml/src/main/java/org/apache/ignite/ml/regressions/RegressionsErrorMessages.java
new file mode 100644
index 0000000..883adca
--- /dev/null
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/regressions/RegressionsErrorMessages.java
@@ -0,0 +1,28 @@
+/*
+ * 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.ml.regressions;
+
+/**
+ * This class contains various messages used in regressions,
+ */
+public class RegressionsErrorMessages {
+ /** Constant for string indicating that sample has insufficient observed points. */
+ static final String INSUFFICIENT_OBSERVED_POINTS_IN_SAMPLE = "Insufficient observed points in sample.";
+ /** */
+ static final String NOT_ENOUGH_DATA_FOR_NUMBER_OF_PREDICTORS = "Not enough data (%d rows) for this many predictors (%d predictors)";
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/934f6ac2/modules/ml/src/main/java/org/apache/ignite/ml/regressions/package-info.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/regressions/package-info.java b/modules/ml/src/main/java/org/apache/ignite/ml/regressions/package-info.java
new file mode 100644
index 0000000..f0d6304
--- /dev/null
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/regressions/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 description. -->
+ * Contains various regressions.
+ */
+package org.apache.ignite.ml.regressions;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/934f6ac2/modules/ml/src/test/java/org/apache/ignite/ml/TestUtils.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/TestUtils.java b/modules/ml/src/test/java/org/apache/ignite/ml/TestUtils.java
new file mode 100644
index 0000000..9c3b4c9
--- /dev/null
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/TestUtils.java
@@ -0,0 +1,248 @@
+/*
+ * 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.ml;
+
+import java.util.stream.IntStream;
+import org.apache.ignite.ml.math.Matrix;
+import org.apache.ignite.ml.math.Precision;
+import org.apache.ignite.ml.math.Vector;
+import org.junit.Assert;
+
+/** */
+public class TestUtils {
+ /**
+ * Collection of static methods used in math unit tests.
+ */
+ private TestUtils() {
+ super();
+ }
+
+ /**
+ * Verifies that expected and actual are within delta, or are both NaN or
+ * infinities of the same sign.
+ *
+ * @param exp Expected value.
+ * @param actual Actual value.
+ * @param delta Maximum allowed delta between {@code exp} and {@code actual}.
+ */
+ public static void assertEquals(double exp, double actual, double delta) {
+ Assert.assertEquals(null, exp, actual, delta);
+ }
+
+ /**
+ * Verifies that expected and actual are within delta, or are both NaN or
+ * infinities of the same sign.
+ */
+ public static void assertEquals(String msg, double exp, double actual, double delta) {
+ // Check for NaN.
+ if (Double.isNaN(exp))
+ Assert.assertTrue("" + actual + " is not NaN.", Double.isNaN(actual));
+ else
+ Assert.assertEquals(msg, exp, actual, delta);
+ }
+
+ /**
+ * Verifies that two double arrays have equal entries, up to tolerance.
+ */
+ public static void assertEquals(double exp[], double observed[], double tolerance) {
+ assertEquals("Array comparison failure", exp, observed, tolerance);
+ }
+
+ /**
+ * Asserts that all entries of the specified vectors are equal to within a
+ * positive {@code delta}.
+ *
+ * @param msg The identifying message for the assertion error (can be {@code null}).
+ * @param exp Expected value.
+ * @param actual Actual value.
+ * @param delta The maximum difference between the entries of the expected and actual vectors for which both entries
+ * are still considered equal.
+ */
+ public static void assertEquals(final String msg,
+ final double[] exp, final Vector actual, final double delta) {
+ final String msgAndSep = msg.equals("") ? "" : msg + ", ";
+
+ Assert.assertEquals(msgAndSep + "dimension", exp.length, actual.size());
+
+ for (int i = 0; i < exp.length; i++)
+ Assert.assertEquals(msgAndSep + "entry #" + i, exp[i], actual.getX(i), delta);
+ }
+
+ /**
+ * Asserts that all entries of the specified vectors are equal to within a
+ * positive {@code delta}.
+ *
+ * @param msg The identifying message for the assertion error (can be {@code null}).
+ * @param exp Expected value.
+ * @param actual Actual value.
+ * @param delta The maximum difference between the entries of the expected and actual vectors for which both entries
+ * are still considered equal.
+ */
+ public static void assertEquals(final String msg,
+ final Vector exp, final Vector actual, final double delta) {
+ final String msgAndSep = msg.equals("") ? "" : msg + ", ";
+
+ Assert.assertEquals(msgAndSep + "dimension", exp.size(), actual.size());
+
+ final int dim = exp.size();
+ for (int i = 0; i < dim; i++)
+ Assert.assertEquals(msgAndSep + "entry #" + i, exp.getX(i), actual.getX(i), delta);
+ }
+
+ /**
+ * Verifies that two matrices are close (1-norm).
+ *
+ * @param msg The identifying message for the assertion error.
+ * @param exp Expected matrix.
+ * @param actual Actual matrix.
+ * @param tolerance Comparison tolerance value.
+ */
+ public static void assertEquals(String msg, Matrix exp, Matrix actual, double tolerance) {
+ Assert.assertNotNull(msg + "\nObserved should not be null", actual);
+
+ if (exp.columnSize() != actual.columnSize() || exp.rowSize() != actual.rowSize()) {
+ String msgBuff = msg + "\nObserved has incorrect dimensions." +
+ "\nobserved is " + actual.rowSize() +
+ " x " + actual.columnSize() +
+ "\nexpected " + exp.rowSize() +
+ " x " + exp.columnSize();
+
+ Assert.fail(msgBuff);
+ }
+
+ Matrix delta = exp.minus(actual);
+
+ if (TestUtils.maximumAbsoluteRowSum(delta) >= tolerance) {
+ String msgBuff = msg + "\nExpected: " + exp +
+ "\nObserved: " + actual +
+ "\nexpected - observed: " + delta;
+
+ Assert.fail(msgBuff);
+ }
+ }
+
+ /**
+ * Verifies that two matrices are equal.
+ *
+ * @param exp Expected matrix.
+ * @param actual Actual matrix.
+ */
+ public static void assertEquals(Matrix exp, Matrix actual) {
+ Assert.assertNotNull("Observed should not be null", actual);
+
+ if (exp.columnSize() != actual.columnSize() || exp.rowSize() != actual.rowSize()) {
+ String msgBuff = "Observed has incorrect dimensions." +
+ "\nobserved is " + actual.rowSize() +
+ " x " + actual.columnSize() +
+ "\nexpected " + exp.rowSize() +
+ " x " + exp.columnSize();
+
+ Assert.fail(msgBuff);
+ }
+
+ for (int i = 0; i < exp.rowSize(); ++i)
+ for (int j = 0; j < exp.columnSize(); ++j) {
+ double eij = exp.getX(i, j);
+ double aij = actual.getX(i, j);
+
+ // TODO: Check precision here.
+ Assert.assertEquals(eij, aij, 0.0);
+ }
+ }
+
+ /**
+ * Verifies that two double arrays are close (sup norm).
+ *
+ * @param msg The identifying message for the assertion error.
+ * @param exp Expected array.
+ * @param actual Actual array.
+ * @param tolerance Comparison tolerance value.
+ */
+ public static void assertEquals(String msg, double[] exp, double[] actual, double tolerance) {
+ StringBuilder out = new StringBuilder(msg);
+
+ if (exp.length != actual.length) {
+ out.append("\n Arrays not same length. \n");
+ out.append("expected has length ");
+ out.append(exp.length);
+ out.append(" observed length = ");
+ out.append(actual.length);
+ Assert.fail(out.toString());
+ }
+
+ boolean failure = false;
+
+ for (int i = 0; i < exp.length; i++)
+ if (!Precision.equalsIncludingNaN(exp[i], actual[i], tolerance)) {
+ failure = true;
+ out.append("\n Elements at index ");
+ out.append(i);
+ out.append(" differ. ");
+ out.append(" expected = ");
+ out.append(exp[i]);
+ out.append(" observed = ");
+ out.append(actual[i]);
+ }
+
+ if (failure)
+ Assert.fail(out.toString());
+ }
+
+ /**
+ * Verifies that two float arrays are close (sup norm).
+ *
+ * @param msg The identifying message for the assertion error.
+ * @param exp Expected array.
+ * @param actual Actual array.
+ * @param tolerance Comparison tolerance value.
+ */
+ public static void assertEquals(String msg, float[] exp, float[] actual, float tolerance) {
+ StringBuilder out = new StringBuilder(msg);
+
+ if (exp.length != actual.length) {
+ out.append("\n Arrays not same length. \n");
+ out.append("expected has length ");
+ out.append(exp.length);
+ out.append(" observed length = ");
+ out.append(actual.length);
+ Assert.fail(out.toString());
+ }
+
+ boolean failure = false;
+
+ for (int i = 0; i < exp.length; i++)
+ if (!Precision.equalsIncludingNaN(exp[i], actual[i], tolerance)) {
+ failure = true;
+ out.append("\n Elements at index ");
+ out.append(i);
+ out.append(" differ. ");
+ out.append(" expected = ");
+ out.append(exp[i]);
+ out.append(" observed = ");
+ out.append(actual[i]);
+ }
+
+ if (failure)
+ Assert.fail(out.toString());
+ }
+
+ /** */
+ public static double maximumAbsoluteRowSum(Matrix mtx) {
+ return IntStream.range(0, mtx.rowSize()).mapToObj(mtx::viewRow).map(v -> Math.abs(v.sum())).reduce(Math::max).get();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/934f6ac2/modules/ml/src/test/java/org/apache/ignite/ml/math/ExternalizeTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/math/ExternalizeTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/math/ExternalizeTest.java
index 32a8ec1..b99d85e 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/math/ExternalizeTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/math/ExternalizeTest.java
@@ -34,6 +34,7 @@ import static org.junit.Assert.fail;
*/
public abstract class ExternalizeTest<T extends Externalizable & Destroyable> {
/** */
+ @SuppressWarnings("unchecked")
protected void externalizeTest(T initObj) {
T objRestored = null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/934f6ac2/modules/ml/src/test/java/org/apache/ignite/ml/math/MathImplLocalTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/math/MathImplLocalTestSuite.java b/modules/ml/src/test/java/org/apache/ignite/ml/math/MathImplLocalTestSuite.java
index be9c33a..9137bed 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/math/MathImplLocalTestSuite.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/math/MathImplLocalTestSuite.java
@@ -59,6 +59,7 @@ import org.apache.ignite.ml.math.impls.vector.VectorIterableTest;
import org.apache.ignite.ml.math.impls.vector.VectorNormTest;
import org.apache.ignite.ml.math.impls.vector.VectorToMatrixTest;
import org.apache.ignite.ml.math.impls.vector.VectorViewTest;
+import org.apache.ignite.ml.regressions.OLSMultipleLinearRegressionTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@@ -111,12 +112,14 @@ import org.junit.runners.Suite;
DiagonalMatrixTest.class,
MatrixAttributeTest.class,
TransposedMatrixViewTest.class,
- // Decomposes
+ // Decompositions.
LUDecompositionTest.class,
EigenDecompositionTest.class,
CholeskyDecompositionTest.class,
QRDecompositionTest.class,
- SingularValueDecompositionTest.class
+ SingularValueDecompositionTest.class,
+ // Regressions.
+ OLSMultipleLinearRegressionTest.class
})
public class MathImplLocalTestSuite {
// No-op.
http://git-wip-us.apache.org/repos/asf/ignite/blob/934f6ac2/modules/ml/src/test/java/org/apache/ignite/ml/math/decompositions/CholeskyDecompositionTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/math/decompositions/CholeskyDecompositionTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/math/decompositions/CholeskyDecompositionTest.java
index be03cb1..cc726a8 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/math/decompositions/CholeskyDecompositionTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/math/decompositions/CholeskyDecompositionTest.java
@@ -25,6 +25,7 @@ import org.apache.ignite.ml.math.exceptions.NonSymmetricMatrixException;
import org.apache.ignite.ml.math.impls.matrix.DenseLocalOnHeapMatrix;
import org.apache.ignite.ml.math.impls.matrix.PivotedMatrixView;
import org.apache.ignite.ml.math.impls.vector.DenseLocalOnHeapVector;
+import org.apache.ignite.ml.math.util.MatrixUtil;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
@@ -43,10 +44,11 @@ public class CholeskyDecompositionTest {
}
/**
- * Test for {@link DecompositionSupport} features.
+ * Test for {@link MatrixUtil} features (more specifically, we test matrix which does not have
+ * a native like/copy methods support).
*/
@Test
- public void decompositionSupportTest() {
+ public void matrixUtilTest() {
basicTest(new PivotedMatrixView(new DenseLocalOnHeapMatrix(new double[][] {
{2.0d, -1.0d, 0.0d},
{-1.0d, 2.0d, -1.0d},
http://git-wip-us.apache.org/repos/asf/ignite/blob/934f6ac2/modules/ml/src/test/java/org/apache/ignite/ml/math/decompositions/LUDecompositionTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/math/decompositions/LUDecompositionTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/math/decompositions/LUDecompositionTest.java
index fc76c39..8e8b920 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/math/decompositions/LUDecompositionTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/math/decompositions/LUDecompositionTest.java
@@ -24,6 +24,7 @@ import org.apache.ignite.ml.math.exceptions.SingularMatrixException;
import org.apache.ignite.ml.math.impls.matrix.DenseLocalOnHeapMatrix;
import org.apache.ignite.ml.math.impls.matrix.PivotedMatrixView;
import org.apache.ignite.ml.math.impls.vector.DenseLocalOnHeapVector;
+import org.apache.ignite.ml.math.util.MatrixUtil;
import org.junit.Before;
import org.junit.Test;
@@ -136,10 +137,11 @@ public class LUDecompositionTest {
}
/**
- * Test for {@link DecompositionSupport} features.
+ * Test for {@link MatrixUtil} features (more specifically, we test matrix which does not have
+ * a native like/copy methods support).
*/
@Test
- public void decompositionSupportTest() {
+ public void matrixUtilTest() {
LUDecomposition dec = new LUDecomposition(new PivotedMatrixView(testMatrix));
Matrix luDecompositionL = dec.getL();
http://git-wip-us.apache.org/repos/asf/ignite/blob/934f6ac2/modules/ml/src/test/java/org/apache/ignite/ml/math/decompositions/QRDecompositionTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/math/decompositions/QRDecompositionTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/math/decompositions/QRDecompositionTest.java
index 589d5d1..a3b083f 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/math/decompositions/QRDecompositionTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/math/decompositions/QRDecompositionTest.java
@@ -20,6 +20,7 @@ package org.apache.ignite.ml.math.decompositions;
import org.apache.ignite.ml.math.Matrix;
import org.apache.ignite.ml.math.impls.matrix.DenseLocalOnHeapMatrix;
import org.apache.ignite.ml.math.impls.matrix.PivotedMatrixView;
+import org.apache.ignite.ml.math.util.MatrixUtil;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
@@ -39,10 +40,11 @@ public class QRDecompositionTest {
}
/**
- * Test for {@link DecompositionSupport} features.
+ * Test for {@link MatrixUtil} features (more specifically, we test matrix which does not have
+ * a native like/copy methods support).
*/
@Test
- public void decompositionSupportTest() {
+ public void matrixUtilTest() {
basicTest(new PivotedMatrixView(new DenseLocalOnHeapMatrix(new double[][] {
{2.0d, -1.0d, 0.0d},
{-1.0d, 2.0d, -1.0d},
http://git-wip-us.apache.org/repos/asf/ignite/blob/934f6ac2/modules/ml/src/test/java/org/apache/ignite/ml/math/decompositions/SingularValueDecompositionTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/math/decompositions/SingularValueDecompositionTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/math/decompositions/SingularValueDecompositionTest.java
index f9843ae..00e83d8 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/math/decompositions/SingularValueDecompositionTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/math/decompositions/SingularValueDecompositionTest.java
@@ -20,6 +20,7 @@ package org.apache.ignite.ml.math.decompositions;
import org.apache.ignite.ml.math.Matrix;
import org.apache.ignite.ml.math.impls.matrix.DenseLocalOnHeapMatrix;
import org.apache.ignite.ml.math.impls.matrix.PivotedMatrixView;
+import org.apache.ignite.ml.math.util.MatrixUtil;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
@@ -39,10 +40,11 @@ public class SingularValueDecompositionTest {
}
/**
- * Test for {@link DecompositionSupport} features.
+ * Test for {@link MatrixUtil} features (more specifically, we test matrix which does not have
+ * a native like/copy methods support).
*/
@Test
- public void decompositionSupportTest() {
+ public void matrixUtilTest() {
basicTest(new PivotedMatrixView(new DenseLocalOnHeapMatrix(new double[][] {
{2.0d, -1.0d, 0.0d},
{-1.0d, 2.0d, -1.0d},
http://git-wip-us.apache.org/repos/asf/ignite/blob/934f6ac2/modules/ml/src/test/java/org/apache/ignite/ml/regressions/AbstractMultipleLinearRegressionTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/regressions/AbstractMultipleLinearRegressionTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/regressions/AbstractMultipleLinearRegressionTest.java
new file mode 100644
index 0000000..6ad56a5
--- /dev/null
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/regressions/AbstractMultipleLinearRegressionTest.java
@@ -0,0 +1,164 @@
+/*
+ * 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.ml.regressions;
+
+import org.apache.ignite.ml.math.Matrix;
+import org.apache.ignite.ml.math.Vector;
+import org.apache.ignite.ml.math.exceptions.MathIllegalArgumentException;
+import org.apache.ignite.ml.math.exceptions.NullArgumentException;
+import org.apache.ignite.ml.math.impls.matrix.DenseLocalOnHeapMatrix;
+import org.apache.ignite.ml.math.impls.vector.DenseLocalOnHeapVector;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * This class is based on the corresponding class from Apache Common Math lib.
+ * Abstract base class for implementations of {@link MultipleLinearRegression}.
+ */
+public abstract class AbstractMultipleLinearRegressionTest {
+ /** */
+ protected AbstractMultipleLinearRegression regression;
+
+ /** */
+ @Before
+ public void setUp() {
+ regression = createRegression();
+ }
+
+ /** */
+ protected abstract AbstractMultipleLinearRegression createRegression();
+
+ /** */
+ protected abstract int getNumberOfRegressors();
+
+ /** */
+ protected abstract int getSampleSize();
+
+ /** */
+ @Test
+ public void canEstimateRegressionParameters() {
+ double[] beta = regression.estimateRegressionParameters();
+ Assert.assertEquals(getNumberOfRegressors(), beta.length);
+ }
+
+ /** */
+ @Test
+ public void canEstimateResiduals() {
+ double[] e = regression.estimateResiduals();
+ Assert.assertEquals(getSampleSize(), e.length);
+ }
+
+ /** */
+ @Test
+ public void canEstimateRegressionParametersVariance() {
+ Matrix var = regression.estimateRegressionParametersVariance();
+ Assert.assertEquals(getNumberOfRegressors(), var.rowSize());
+ }
+
+ /** */
+ @Test
+ public void canEstimateRegressandVariance() {
+ if (getSampleSize() > getNumberOfRegressors()) {
+ double variance = regression.estimateRegressandVariance();
+ Assert.assertTrue(variance > 0.0);
+ }
+ }
+
+ /**
+ * Verifies that newSampleData methods consistently insert unitary columns
+ * in design matrix. Confirms the fix for MATH-411.
+ */
+ @Test
+ public void testNewSample() {
+ double[] design = new double[] {
+ 1, 19, 22, 33,
+ 2, 20, 30, 40,
+ 3, 25, 35, 45,
+ 4, 27, 37, 47
+ };
+
+ double[] y = new double[] {1, 2, 3, 4};
+
+ double[][] x = new double[][] {
+ {19, 22, 33},
+ {20, 30, 40},
+ {25, 35, 45},
+ {27, 37, 47}
+ };
+
+ AbstractMultipleLinearRegression regression = createRegression();
+ regression.newSampleData(design, 4, 3, new DenseLocalOnHeapMatrix());
+
+ Matrix flatX = regression.getX().copy();
+ Vector flatY = regression.getY().copy();
+
+ regression.newXSampleData(new DenseLocalOnHeapMatrix(x));
+ regression.newYSampleData(new DenseLocalOnHeapVector(y));
+
+ Assert.assertEquals(flatX, regression.getX());
+ Assert.assertEquals(flatY, regression.getY());
+
+ // No intercept
+ regression.setNoIntercept(true);
+ regression.newSampleData(design, 4, 3, new DenseLocalOnHeapMatrix());
+
+ flatX = regression.getX().copy();
+ flatY = regression.getY().copy();
+
+ regression.newXSampleData(new DenseLocalOnHeapMatrix(x));
+ regression.newYSampleData(new DenseLocalOnHeapVector(y));
+
+ Assert.assertEquals(flatX, regression.getX());
+ Assert.assertEquals(flatY, regression.getY());
+ }
+
+ /** */
+ @Test(expected = NullArgumentException.class)
+ public void testNewSampleNullData() {
+ double[] data = null;
+ createRegression().newSampleData(data, 2, 3, new DenseLocalOnHeapMatrix());
+ }
+
+ /** */
+ @Test(expected = MathIllegalArgumentException.class)
+ public void testNewSampleInvalidData() {
+ double[] data = new double[] {1, 2, 3, 4};
+ createRegression().newSampleData(data, 2, 3, new DenseLocalOnHeapMatrix());
+ }
+
+ /** */
+ @Test(expected = MathIllegalArgumentException.class)
+ public void testNewSampleInsufficientData() {
+ double[] data = new double[] {1, 2, 3, 4};
+ createRegression().newSampleData(data, 1, 3, new DenseLocalOnHeapMatrix());
+ }
+
+ /** */
+ @Test(expected = NullArgumentException.class)
+ public void testXSampleDataNull() {
+ createRegression().newXSampleData(null);
+ }
+
+ /** */
+ @Test(expected = NullArgumentException.class)
+ public void testYSampleDataNull() {
+ createRegression().newYSampleData(null);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/934f6ac2/modules/ml/src/test/java/org/apache/ignite/ml/regressions/OLSMultipleLinearRegressionTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/regressions/OLSMultipleLinearRegressionTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/regressions/OLSMultipleLinearRegressionTest.java
new file mode 100644
index 0000000..8180c55
--- /dev/null
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/regressions/OLSMultipleLinearRegressionTest.java
@@ -0,0 +1,812 @@
+/*
+ * 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.ml.regressions;
+
+import org.apache.ignite.ml.TestUtils;
+import org.apache.ignite.ml.math.Matrix;
+import org.apache.ignite.ml.math.Vector;
+import org.apache.ignite.ml.math.exceptions.MathIllegalArgumentException;
+import org.apache.ignite.ml.math.exceptions.NullArgumentException;
+import org.apache.ignite.ml.math.exceptions.SingularMatrixException;
+import org.apache.ignite.ml.math.impls.matrix.DenseLocalOnHeapMatrix;
+import org.apache.ignite.ml.math.impls.vector.DenseLocalOnHeapVector;
+import org.apache.ignite.ml.math.util.MatrixUtil;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests for {@link OLSMultipleLinearRegression}.
+ */
+public class OLSMultipleLinearRegressionTest extends AbstractMultipleLinearRegressionTest {
+ /** */
+ private double[] y;
+
+ /** */
+ private double[][] x;
+
+ /** */
+ @Before
+ @Override public void setUp() {
+ y = new double[] {11.0, 12.0, 13.0, 14.0, 15.0, 16.0};
+ x = new double[6][];
+ x[0] = new double[] {0, 0, 0, 0, 0};
+ x[1] = new double[] {2.0, 0, 0, 0, 0};
+ x[2] = new double[] {0, 3.0, 0, 0, 0};
+ x[3] = new double[] {0, 0, 4.0, 0, 0};
+ x[4] = new double[] {0, 0, 0, 5.0, 0};
+ x[5] = new double[] {0, 0, 0, 0, 6.0};
+ super.setUp();
+ }
+
+ /** */
+ @Override protected OLSMultipleLinearRegression createRegression() {
+ OLSMultipleLinearRegression regression = new OLSMultipleLinearRegression();
+ regression.newSampleData(new DenseLocalOnHeapVector(y), new DenseLocalOnHeapMatrix(x));
+ return regression;
+ }
+
+ /** */
+ @Override protected int getNumberOfRegressors() {
+ return x[0].length + 1;
+ }
+
+ /** */
+ @Override protected int getSampleSize() {
+ return y.length;
+ }
+
+ /** */
+ @Test(expected = MathIllegalArgumentException.class)
+ public void cannotAddSampleDataWithSizeMismatch() {
+ double[] y = new double[] {1.0, 2.0};
+ double[][] x = new double[1][];
+ x[0] = new double[] {1.0, 0};
+ createRegression().newSampleData(new DenseLocalOnHeapVector(y), new DenseLocalOnHeapMatrix(x));
+ }
+
+ /** */
+ @Test
+ public void testPerfectFit() {
+ double[] betaHat = regression.estimateRegressionParameters();
+ TestUtils.assertEquals(new double[] {11.0, 1.0 / 2.0, 2.0 / 3.0, 3.0 / 4.0, 4.0 / 5.0, 5.0 / 6.0},
+ betaHat,
+ 1e-13);
+ double[] residuals = regression.estimateResiduals();
+ TestUtils.assertEquals(new double[] {0d, 0d, 0d, 0d, 0d, 0d}, residuals,
+ 1e-13);
+ Matrix errors = regression.estimateRegressionParametersVariance();
+ final double[] s = {1.0, -1.0 / 2.0, -1.0 / 3.0, -1.0 / 4.0, -1.0 / 5.0, -1.0 / 6.0};
+ Matrix refVar = new DenseLocalOnHeapMatrix(s.length, s.length);
+ for (int i = 0; i < refVar.rowSize(); i++)
+ for (int j = 0; j < refVar.columnSize(); j++) {
+ if (i == 0) {
+ refVar.setX(i, j, s[j]);
+ continue;
+ }
+ double x = s[i] * s[j];
+ refVar.setX(i, j, (i == j) ? 2 * x : x);
+ }
+ Assert.assertEquals(0.0,
+ TestUtils.maximumAbsoluteRowSum(errors.minus(refVar)),
+ 5.0e-16 * TestUtils.maximumAbsoluteRowSum(refVar));
+ Assert.assertEquals(1, ((OLSMultipleLinearRegression)regression).calculateRSquared(), 1E-12);
+ }
+
+ /**
+ * Test Longley dataset against certified values provided by NIST.
+ * Data Source: J. Longley (1967) "An Appraisal of Least Squares
+ * Programs for the Electronic Computer from the Point of View of the User"
+ * Journal of the American Statistical Association, vol. 62. September,
+ * pp. 819-841.
+ *
+ * Certified values (and data) are from NIST:
+ * http://www.itl.nist.gov/div898/strd/lls/data/LINKS/DATA/Longley.dat
+ */
+ @Test
+ public void testLongly() {
+ // Y values are first, then independent vars
+ // Each row is one observation
+ double[] design = new double[] {
+ 60323, 83.0, 234289, 2356, 1590, 107608, 1947,
+ 61122, 88.5, 259426, 2325, 1456, 108632, 1948,
+ 60171, 88.2, 258054, 3682, 1616, 109773, 1949,
+ 61187, 89.5, 284599, 3351, 1650, 110929, 1950,
+ 63221, 96.2, 328975, 2099, 3099, 112075, 1951,
+ 63639, 98.1, 346999, 1932, 3594, 113270, 1952,
+ 64989, 99.0, 365385, 1870, 3547, 115094, 1953,
+ 63761, 100.0, 363112, 3578, 3350, 116219, 1954,
+ 66019, 101.2, 397469, 2904, 3048, 117388, 1955,
+ 67857, 104.6, 419180, 2822, 2857, 118734, 1956,
+ 68169, 108.4, 442769, 2936, 2798, 120445, 1957,
+ 66513, 110.8, 444546, 4681, 2637, 121950, 1958,
+ 68655, 112.6, 482704, 3813, 2552, 123366, 1959,
+ 69564, 114.2, 502601, 3931, 2514, 125368, 1960,
+ 69331, 115.7, 518173, 4806, 2572, 127852, 1961,
+ 70551, 116.9, 554894, 4007, 2827, 130081, 1962
+ };
+
+ final int nobs = 16;
+ final int nvars = 6;
+
+ // Estimate the model
+ OLSMultipleLinearRegression mdl = new OLSMultipleLinearRegression();
+ mdl.newSampleData(design, nobs, nvars, new DenseLocalOnHeapMatrix());
+
+ // Check expected beta values from NIST
+ double[] betaHat = mdl.estimateRegressionParameters();
+ TestUtils.assertEquals(betaHat,
+ new double[] {
+ -3482258.63459582, 15.0618722713733,
+ -0.358191792925910E-01, -2.02022980381683,
+ -1.03322686717359, -0.511041056535807E-01,
+ 1829.15146461355}, 2E-6); //
+
+ // Check expected residuals from R
+ double[] residuals = mdl.estimateResiduals();
+ TestUtils.assertEquals(residuals, new double[] {
+ 267.340029759711, -94.0139423988359, 46.28716775752924,
+ -410.114621930906, 309.7145907602313, -249.3112153297231,
+ -164.0489563956039, -13.18035686637081, 14.30477260005235,
+ 455.394094551857, -17.26892711483297, -39.0550425226967,
+ -155.5499735953195, -85.6713080421283, 341.9315139607727,
+ -206.7578251937366},
+ 1E-7);
+
+ // Check standard errors from NIST
+ double[] errors = mdl.estimateRegressionParametersStandardErrors();
+ TestUtils.assertEquals(new double[] {
+ 890420.383607373,
+ 84.9149257747669,
+ 0.334910077722432E-01,
+ 0.488399681651699,
+ 0.214274163161675,
+ 0.226073200069370,
+ 455.478499142212}, errors, 1E-6);
+
+ // Check regression standard error against R
+ Assert.assertEquals(304.8540735619638, mdl.estimateRegressionStandardError(), 1E-10);
+
+ // Check R-Square statistics against R
+ Assert.assertEquals(0.995479004577296, mdl.calculateRSquared(), 1E-12);
+ Assert.assertEquals(0.992465007628826, mdl.calculateAdjustedRSquared(), 1E-12);
+
+ // TODO: uncomment
+ // checkVarianceConsistency(model);
+
+ // Estimate model without intercept
+ mdl.setNoIntercept(true);
+ mdl.newSampleData(design, nobs, nvars, new DenseLocalOnHeapMatrix());
+
+ // Check expected beta values from R
+ betaHat = mdl.estimateRegressionParameters();
+ TestUtils.assertEquals(betaHat,
+ new double[] {
+ -52.99357013868291, 0.07107319907358,
+ -0.42346585566399, -0.57256866841929,
+ -0.41420358884978, 48.41786562001326}, 1E-8);
+
+ // Check standard errors from R
+ errors = mdl.estimateRegressionParametersStandardErrors();
+ TestUtils.assertEquals(new double[] {
+ 129.54486693117232, 0.03016640003786,
+ 0.41773654056612, 0.27899087467676, 0.32128496193363,
+ 17.68948737819961}, errors, 1E-11);
+
+ // Check expected residuals from R
+ residuals = mdl.estimateResiduals();
+ TestUtils.assertEquals(residuals, new double[] {
+ 279.90274927293092, -130.32465380836874, 90.73228661967445, -401.31252201634948,
+ -440.46768772620027, -543.54512853774793, 201.32111639536299, 215.90889365977932,
+ 73.09368242049943, 913.21694494481869, 424.82484953610174, -8.56475876776709,
+ -361.32974610842876, 27.34560497213464, 151.28955976355002, -492.49937355336846},
+ 1E-8);
+
+ // Check regression standard error against R
+ Assert.assertEquals(475.1655079819517, mdl.estimateRegressionStandardError(), 1E-10);
+
+ // Check R-Square statistics against R
+ Assert.assertEquals(0.9999670130706, mdl.calculateRSquared(), 1E-12);
+ Assert.assertEquals(0.999947220913, mdl.calculateAdjustedRSquared(), 1E-12);
+
+ }
+
+ /**
+ * Test R Swiss fertility dataset against R.
+ * Data Source: R datasets package
+ */
+ @Test
+ public void testSwissFertility() {
+ double[] design = new double[] {
+ 80.2, 17.0, 15, 12, 9.96,
+ 83.1, 45.1, 6, 9, 84.84,
+ 92.5, 39.7, 5, 5, 93.40,
+ 85.8, 36.5, 12, 7, 33.77,
+ 76.9, 43.5, 17, 15, 5.16,
+ 76.1, 35.3, 9, 7, 90.57,
+ 83.8, 70.2, 16, 7, 92.85,
+ 92.4, 67.8, 14, 8, 97.16,
+ 82.4, 53.3, 12, 7, 97.67,
+ 82.9, 45.2, 16, 13, 91.38,
+ 87.1, 64.5, 14, 6, 98.61,
+ 64.1, 62.0, 21, 12, 8.52,
+ 66.9, 67.5, 14, 7, 2.27,
+ 68.9, 60.7, 19, 12, 4.43,
+ 61.7, 69.3, 22, 5, 2.82,
+ 68.3, 72.6, 18, 2, 24.20,
+ 71.7, 34.0, 17, 8, 3.30,
+ 55.7, 19.4, 26, 28, 12.11,
+ 54.3, 15.2, 31, 20, 2.15,
+ 65.1, 73.0, 19, 9, 2.84,
+ 65.5, 59.8, 22, 10, 5.23,
+ 65.0, 55.1, 14, 3, 4.52,
+ 56.6, 50.9, 22, 12, 15.14,
+ 57.4, 54.1, 20, 6, 4.20,
+ 72.5, 71.2, 12, 1, 2.40,
+ 74.2, 58.1, 14, 8, 5.23,
+ 72.0, 63.5, 6, 3, 2.56,
+ 60.5, 60.8, 16, 10, 7.72,
+ 58.3, 26.8, 25, 19, 18.46,
+ 65.4, 49.5, 15, 8, 6.10,
+ 75.5, 85.9, 3, 2, 99.71,
+ 69.3, 84.9, 7, 6, 99.68,
+ 77.3, 89.7, 5, 2, 100.00,
+ 70.5, 78.2, 12, 6, 98.96,
+ 79.4, 64.9, 7, 3, 98.22,
+ 65.0, 75.9, 9, 9, 99.06,
+ 92.2, 84.6, 3, 3, 99.46,
+ 79.3, 63.1, 13, 13, 96.83,
+ 70.4, 38.4, 26, 12, 5.62,
+ 65.7, 7.7, 29, 11, 13.79,
+ 72.7, 16.7, 22, 13, 11.22,
+ 64.4, 17.6, 35, 32, 16.92,
+ 77.6, 37.6, 15, 7, 4.97,
+ 67.6, 18.7, 25, 7, 8.65,
+ 35.0, 1.2, 37, 53, 42.34,
+ 44.7, 46.6, 16, 29, 50.43,
+ 42.8, 27.7, 22, 29, 58.33
+ };
+
+ final int nobs = 47;
+ final int nvars = 4;
+
+ // Estimate the model
+ OLSMultipleLinearRegression mdl = new OLSMultipleLinearRegression();
+ mdl.newSampleData(design, nobs, nvars, new DenseLocalOnHeapMatrix());
+
+ // Check expected beta values from R
+ double[] betaHat = mdl.estimateRegressionParameters();
+ TestUtils.assertEquals(betaHat,
+ new double[] {
+ 91.05542390271397,
+ -0.22064551045715,
+ -0.26058239824328,
+ -0.96161238456030,
+ 0.12441843147162}, 1E-12);
+
+ // Check expected residuals from R
+ double[] residuals = mdl.estimateResiduals();
+ TestUtils.assertEquals(residuals, new double[] {
+ 7.1044267859730512, 1.6580347433531366,
+ 4.6944952770029644, 8.4548022690166160, 13.6547432343186212,
+ -9.3586864458500774, 7.5822446330520386, 15.5568995563859289,
+ 0.8113090736598980, 7.1186762732484308, 7.4251378771228724,
+ 2.6761316873234109, 0.8351584810309354, 7.1769991119615177,
+ -3.8746753206299553, -3.1337779476387251, -0.1412575244091504,
+ 1.1186809170469780, -6.3588097346816594, 3.4039270429434074,
+ 2.3374058329820175, -7.9272368576900503, -7.8361010968497959,
+ -11.2597369269357070, 0.9445333697827101, 6.6544245101380328,
+ -0.9146136301118665, -4.3152449403848570, -4.3536932047009183,
+ -3.8907885169304661, -6.3027643926302188, -7.8308982189289091,
+ -3.1792280015332750, -6.7167298771158226, -4.8469946718041754,
+ -10.6335664353633685, 11.1031134362036958, 6.0084032641811733,
+ 5.4326230830188482, -7.2375578629692230, 2.1671550814448222,
+ 15.0147574652763112, 4.8625103516321015, -7.1597256413907706,
+ -0.4515205619767598, -10.2916870903837587, -15.7812984571900063},
+ 1E-12);
+
+ // Check standard errors from R
+ double[] errors = mdl.estimateRegressionParametersStandardErrors();
+ TestUtils.assertEquals(new double[] {
+ 6.94881329475087,
+ 0.07360008972340,
+ 0.27410957467466,
+ 0.19454551679325,
+ 0.03726654773803}, errors, 1E-10);
+
+ // Check regression standard error against R
+ Assert.assertEquals(7.73642194433223, mdl.estimateRegressionStandardError(), 1E-12);
+
+ // Check R-Square statistics against R
+ Assert.assertEquals(0.649789742860228, mdl.calculateRSquared(), 1E-12);
+ Assert.assertEquals(0.6164363850373927, mdl.calculateAdjustedRSquared(), 1E-12);
+
+ // TODO: uncomment
+ // checkVarianceConsistency(model);
+
+ // Estimate the model with no intercept
+ mdl = new OLSMultipleLinearRegression();
+ mdl.setNoIntercept(true);
+ mdl.newSampleData(design, nobs, nvars, new DenseLocalOnHeapMatrix());
+
+ // Check expected beta values from R
+ betaHat = mdl.estimateRegressionParameters();
+ TestUtils.assertEquals(betaHat,
+ new double[] {
+ 0.52191832900513,
+ 2.36588087917963,
+ -0.94770353802795,
+ 0.30851985863609}, 1E-12);
+
+ // Check expected residuals from R
+ residuals = mdl.estimateResiduals();
+ TestUtils.assertEquals(residuals, new double[] {
+ 44.138759883538249, 27.720705122356215, 35.873200836126799,
+ 34.574619581211977, 26.600168342080213, 15.074636243026923, -12.704904871199814,
+ 1.497443824078134, 2.691972687079431, 5.582798774291231, -4.422986561283165,
+ -9.198581600334345, 4.481765170730647, 2.273520207553216, -22.649827853221336,
+ -17.747900013943308, 20.298314638496436, 6.861405135329779, -8.684712790954924,
+ -10.298639278062371, -9.896618896845819, 4.568568616351242, -15.313570491727944,
+ -13.762961360873966, 7.156100301980509, 16.722282219843990, 26.716200609071898,
+ -1.991466398777079, -2.523342564719335, 9.776486693095093, -5.297535127628603,
+ -16.639070567471094, -10.302057295211819, -23.549487860816846, 1.506624392156384,
+ -17.939174438345930, 13.105792202765040, -1.943329906928462, -1.516005841666695,
+ -0.759066561832886, 20.793137744128977, -2.485236153005426, 27.588238710486976,
+ 2.658333257106881, -15.998337823623046, -5.550742066720694, -14.219077806826615},
+ 1E-12);
+
+ // Check standard errors from R
+ errors = mdl.estimateRegressionParametersStandardErrors();
+ TestUtils.assertEquals(new double[] {
+ 0.10470063765677, 0.41684100584290,
+ 0.43370143099691, 0.07694953606522}, errors, 1E-10);
+
+ // Check regression standard error against R
+ Assert.assertEquals(17.24710630547, mdl.estimateRegressionStandardError(), 1E-10);
+
+ // Check R-Square statistics against R
+ Assert.assertEquals(0.946350722085, mdl.calculateRSquared(), 1E-12);
+ Assert.assertEquals(0.9413600915813, mdl.calculateAdjustedRSquared(), 1E-12);
+ }
+
+ /**
+ * Test hat matrix computation
+ */
+ @Test
+ public void testHat() {
+
+ /*
+ * This example is from "The Hat Matrix in Regression and ANOVA",
+ * David C. Hoaglin and Roy E. Welsch,
+ * The American Statistician, Vol. 32, No. 1 (Feb., 1978), pp. 17-22.
+ *
+ */
+ double[] design = new double[] {
+ 11.14, .499, 11.1,
+ 12.74, .558, 8.9,
+ 13.13, .604, 8.8,
+ 11.51, .441, 8.9,
+ 12.38, .550, 8.8,
+ 12.60, .528, 9.9,
+ 11.13, .418, 10.7,
+ 11.7, .480, 10.5,
+ 11.02, .406, 10.5,
+ 11.41, .467, 10.7
+ };
+
+ int nobs = 10;
+ int nvars = 2;
+
+ // Estimate the model
+ OLSMultipleLinearRegression mdl = new OLSMultipleLinearRegression();
+ mdl.newSampleData(design, nobs, nvars, new DenseLocalOnHeapMatrix());
+
+ Matrix hat = mdl.calculateHat();
+
+ // Reference data is upper half of symmetric hat matrix
+ double[] refData = new double[] {
+ .418, -.002, .079, -.274, -.046, .181, .128, .222, .050, .242,
+ .242, .292, .136, .243, .128, -.041, .033, -.035, .004,
+ .417, -.019, .273, .187, -.126, .044, -.153, .004,
+ .604, .197, -.038, .168, -.022, .275, -.028,
+ .252, .111, -.030, .019, -.010, -.010,
+ .148, .042, .117, .012, .111,
+ .262, .145, .277, .174,
+ .154, .120, .168,
+ .315, .148,
+ .187
+ };
+
+ // Check against reference data and verify symmetry
+ int k = 0;
+ for (int i = 0; i < 10; i++) {
+ for (int j = i; j < 10; j++) {
+ Assert.assertEquals(refData[k], hat.getX(i, j), 10e-3);
+ Assert.assertEquals(hat.getX(i, j), hat.getX(j, i), 10e-12);
+ k++;
+ }
+ }
+
+ /*
+ * Verify that residuals computed using the hat matrix are close to
+ * what we get from direct computation, i.e. r = (I - H) y
+ */
+ double[] residuals = mdl.estimateResiduals();
+ Matrix id = MatrixUtil.identityLike(hat, 10);
+ double[] hatResiduals = id.minus(hat).times(mdl.getY()).getStorage().data();
+ TestUtils.assertEquals(residuals, hatResiduals, 10e-12);
+ }
+
+ /**
+ * test calculateYVariance
+ */
+ @Test
+ public void testYVariance() {
+ // assumes: y = new double[]{11.0, 12.0, 13.0, 14.0, 15.0, 16.0};
+ OLSMultipleLinearRegression mdl = new OLSMultipleLinearRegression();
+ mdl.newSampleData(new DenseLocalOnHeapVector(y), new DenseLocalOnHeapMatrix(x));
+ TestUtils.assertEquals(mdl.calculateYVariance(), 3.5, 0);
+ }
+
+ /**
+ * Verifies that setting X and Y separately has the same effect as newSample(X,Y).
+ */
+ @Test
+ public void testNewSample2() {
+ double[] y = new double[] {1, 2, 3, 4};
+ double[][] x = new double[][] {
+ {19, 22, 33},
+ {20, 30, 40},
+ {25, 35, 45},
+ {27, 37, 47}
+ };
+ OLSMultipleLinearRegression regression = new OLSMultipleLinearRegression();
+ regression.newSampleData(new DenseLocalOnHeapVector(y), new DenseLocalOnHeapMatrix(x));
+ Matrix combinedX = regression.getX().copy();
+ Vector combinedY = regression.getY().copy();
+ regression.newXSampleData(new DenseLocalOnHeapMatrix(x));
+ regression.newYSampleData(new DenseLocalOnHeapVector(y));
+ Assert.assertEquals(combinedX, regression.getX());
+ Assert.assertEquals(combinedY, regression.getY());
+
+ // No intercept
+ regression.setNoIntercept(true);
+ regression.newSampleData(new DenseLocalOnHeapVector(y), new DenseLocalOnHeapMatrix(x));
+ combinedX = regression.getX().copy();
+ combinedY = regression.getY().copy();
+ regression.newXSampleData(new DenseLocalOnHeapMatrix(x));
+ regression.newYSampleData(new DenseLocalOnHeapVector(y));
+ Assert.assertEquals(combinedX, regression.getX());
+ Assert.assertEquals(combinedY, regression.getY());
+ }
+
+ /** */
+ @Test(expected = NullArgumentException.class)
+ public void testNewSampleDataYNull() {
+ createRegression().newSampleData(null, new DenseLocalOnHeapMatrix(new double[][] {{1}}));
+ }
+
+ /** */
+ @Test(expected = NullArgumentException.class)
+ public void testNewSampleDataXNull() {
+ createRegression().newSampleData(new DenseLocalOnHeapVector(new double[] {}), null);
+ }
+
+ /**
+ * This is a test based on the Wampler1 data set
+ * http://www.itl.nist.gov/div898/strd/lls/data/Wampler1.shtml
+ */
+ @Test
+ public void testWampler1() {
+ double[] data = new double[] {
+ 1, 0,
+ 6, 1,
+ 63, 2,
+ 364, 3,
+ 1365, 4,
+ 3906, 5,
+ 9331, 6,
+ 19608, 7,
+ 37449, 8,
+ 66430, 9,
+ 111111, 10,
+ 177156, 11,
+ 271453, 12,
+ 402234, 13,
+ 579195, 14,
+ 813616, 15,
+ 1118481, 16,
+ 1508598, 17,
+ 2000719, 18,
+ 2613660, 19,
+ 3368421, 20};
+ OLSMultipleLinearRegression mdl = new OLSMultipleLinearRegression();
+
+ final int nvars = 5;
+ final int nobs = 21;
+ double[] tmp = new double[(nvars + 1) * nobs];
+ int off = 0;
+ int off2 = 0;
+ for (int i = 0; i < nobs; i++) {
+ tmp[off2] = data[off];
+ tmp[off2 + 1] = data[off + 1];
+ tmp[off2 + 2] = tmp[off2 + 1] * tmp[off2 + 1];
+ tmp[off2 + 3] = tmp[off2 + 1] * tmp[off2 + 2];
+ tmp[off2 + 4] = tmp[off2 + 1] * tmp[off2 + 3];
+ tmp[off2 + 5] = tmp[off2 + 1] * tmp[off2 + 4];
+ off2 += (nvars + 1);
+ off += 2;
+ }
+ mdl.newSampleData(tmp, nobs, nvars, new DenseLocalOnHeapMatrix());
+ double[] betaHat = mdl.estimateRegressionParameters();
+ TestUtils.assertEquals(betaHat,
+ new double[] {
+ 1.0,
+ 1.0, 1.0,
+ 1.0, 1.0,
+ 1.0}, 1E-8);
+
+ double[] se = mdl.estimateRegressionParametersStandardErrors();
+ TestUtils.assertEquals(se,
+ new double[] {
+ 0.0,
+ 0.0, 0.0,
+ 0.0, 0.0,
+ 0.0}, 1E-8);
+
+ TestUtils.assertEquals(1.0, mdl.calculateRSquared(), 1.0e-10);
+ TestUtils.assertEquals(0, mdl.estimateErrorVariance(), 1.0e-7);
+ TestUtils.assertEquals(0.00, mdl.calculateResidualSumOfSquares(), 1.0e-6);
+ }
+
+ /**
+ * This is a test based on the Wampler2 data set
+ * http://www.itl.nist.gov/div898/strd/lls/data/Wampler2.shtml
+ */
+ @Test
+ public void testWampler2() {
+ double[] data = new double[] {
+ 1.00000, 0,
+ 1.11111, 1,
+ 1.24992, 2,
+ 1.42753, 3,
+ 1.65984, 4,
+ 1.96875, 5,
+ 2.38336, 6,
+ 2.94117, 7,
+ 3.68928, 8,
+ 4.68559, 9,
+ 6.00000, 10,
+ 7.71561, 11,
+ 9.92992, 12,
+ 12.75603, 13,
+ 16.32384, 14,
+ 20.78125, 15,
+ 26.29536, 16,
+ 33.05367, 17,
+ 41.26528, 18,
+ 51.16209, 19,
+ 63.00000, 20};
+ OLSMultipleLinearRegression mdl = new OLSMultipleLinearRegression();
+
+ final int nvars = 5;
+ final int nobs = 21;
+ double[] tmp = new double[(nvars + 1) * nobs];
+ int off = 0;
+ int off2 = 0;
+ for (int i = 0; i < nobs; i++) {
+ tmp[off2] = data[off];
+ tmp[off2 + 1] = data[off + 1];
+ tmp[off2 + 2] = tmp[off2 + 1] * tmp[off2 + 1];
+ tmp[off2 + 3] = tmp[off2 + 1] * tmp[off2 + 2];
+ tmp[off2 + 4] = tmp[off2 + 1] * tmp[off2 + 3];
+ tmp[off2 + 5] = tmp[off2 + 1] * tmp[off2 + 4];
+ off2 += (nvars + 1);
+ off += 2;
+ }
+ mdl.newSampleData(tmp, nobs, nvars, new DenseLocalOnHeapMatrix());
+ double[] betaHat = mdl.estimateRegressionParameters();
+ TestUtils.assertEquals(betaHat,
+ new double[] {
+ 1.0,
+ 1.0e-1,
+ 1.0e-2,
+ 1.0e-3, 1.0e-4,
+ 1.0e-5}, 1E-8);
+
+ double[] se = mdl.estimateRegressionParametersStandardErrors();
+ TestUtils.assertEquals(se,
+ new double[] {
+ 0.0,
+ 0.0, 0.0,
+ 0.0, 0.0,
+ 0.0}, 1E-8);
+ TestUtils.assertEquals(1.0, mdl.calculateRSquared(), 1.0e-10);
+ TestUtils.assertEquals(0, mdl.estimateErrorVariance(), 1.0e-7);
+ TestUtils.assertEquals(0.00, mdl.calculateResidualSumOfSquares(), 1.0e-6);
+ }
+
+ /**
+ * This is a test based on the Wampler3 data set
+ * http://www.itl.nist.gov/div898/strd/lls/data/Wampler3.shtml
+ */
+ @Test
+ public void testWampler3() {
+ double[] data = new double[] {
+ 760, 0,
+ -2042, 1,
+ 2111, 2,
+ -1684, 3,
+ 3888, 4,
+ 1858, 5,
+ 11379, 6,
+ 17560, 7,
+ 39287, 8,
+ 64382, 9,
+ 113159, 10,
+ 175108, 11,
+ 273291, 12,
+ 400186, 13,
+ 581243, 14,
+ 811568, 15,
+ 1121004, 16,
+ 1506550, 17,
+ 2002767, 18,
+ 2611612, 19,
+ 3369180, 20};
+
+ OLSMultipleLinearRegression mdl = new OLSMultipleLinearRegression();
+ final int nvars = 5;
+ final int nobs = 21;
+ double[] tmp = new double[(nvars + 1) * nobs];
+ int off = 0;
+ int off2 = 0;
+ for (int i = 0; i < nobs; i++) {
+ tmp[off2] = data[off];
+ tmp[off2 + 1] = data[off + 1];
+ tmp[off2 + 2] = tmp[off2 + 1] * tmp[off2 + 1];
+ tmp[off2 + 3] = tmp[off2 + 1] * tmp[off2 + 2];
+ tmp[off2 + 4] = tmp[off2 + 1] * tmp[off2 + 3];
+ tmp[off2 + 5] = tmp[off2 + 1] * tmp[off2 + 4];
+ off2 += (nvars + 1);
+ off += 2;
+ }
+ mdl.newSampleData(tmp, nobs, nvars, new DenseLocalOnHeapMatrix());
+ double[] betaHat = mdl.estimateRegressionParameters();
+ TestUtils.assertEquals(betaHat,
+ new double[] {
+ 1.0,
+ 1.0,
+ 1.0,
+ 1.0,
+ 1.0,
+ 1.0}, 1E-8);
+
+ double[] se = mdl.estimateRegressionParametersStandardErrors();
+ TestUtils.assertEquals(se,
+ new double[] {
+ 2152.32624678170,
+ 2363.55173469681, 779.343524331583,
+ 101.475507550350, 5.64566512170752,
+ 0.112324854679312}, 1E-8); //
+
+ TestUtils.assertEquals(.999995559025820, mdl.calculateRSquared(), 1.0e-10);
+ TestUtils.assertEquals(5570284.53333333, mdl.estimateErrorVariance(), 1.0e-6);
+ TestUtils.assertEquals(83554268.0000000, mdl.calculateResidualSumOfSquares(), 1.0e-5);
+ }
+
+ /**
+ * This is a test based on the Wampler4 data set
+ * http://www.itl.nist.gov/div898/strd/lls/data/Wampler4.shtml
+ */
+ @Test
+ public void testWampler4() {
+ double[] data = new double[] {
+ 75901, 0,
+ -204794, 1,
+ 204863, 2,
+ -204436, 3,
+ 253665, 4,
+ -200894, 5,
+ 214131, 6,
+ -185192, 7,
+ 221249, 8,
+ -138370, 9,
+ 315911, 10,
+ -27644, 11,
+ 455253, 12,
+ 197434, 13,
+ 783995, 14,
+ 608816, 15,
+ 1370781, 16,
+ 1303798, 17,
+ 2205519, 18,
+ 2408860, 19,
+ 3444321, 20};
+
+ OLSMultipleLinearRegression mdl = new OLSMultipleLinearRegression();
+ final int nvars = 5;
+ final int nobs = 21;
+ double[] tmp = new double[(nvars + 1) * nobs];
+ int off = 0;
+ int off2 = 0;
+ for (int i = 0; i < nobs; i++) {
+ tmp[off2] = data[off];
+ tmp[off2 + 1] = data[off + 1];
+ tmp[off2 + 2] = tmp[off2 + 1] * tmp[off2 + 1];
+ tmp[off2 + 3] = tmp[off2 + 1] * tmp[off2 + 2];
+ tmp[off2 + 4] = tmp[off2 + 1] * tmp[off2 + 3];
+ tmp[off2 + 5] = tmp[off2 + 1] * tmp[off2 + 4];
+ off2 += (nvars + 1);
+ off += 2;
+ }
+ mdl.newSampleData(tmp, nobs, nvars, new DenseLocalOnHeapMatrix());
+ double[] betaHat = mdl.estimateRegressionParameters();
+ TestUtils.assertEquals(betaHat,
+ new double[] {
+ 1.0,
+ 1.0,
+ 1.0,
+ 1.0,
+ 1.0,
+ 1.0}, 1E-6);
+
+ double[] se = mdl.estimateRegressionParametersStandardErrors();
+ TestUtils.assertEquals(se,
+ new double[] {
+ 215232.624678170,
+ 236355.173469681, 77934.3524331583,
+ 10147.5507550350, 564.566512170752,
+ 11.2324854679312}, 1E-8);
+
+ TestUtils.assertEquals(.957478440825662, mdl.calculateRSquared(), 1.0e-10);
+ TestUtils.assertEquals(55702845333.3333, mdl.estimateErrorVariance(), 1.0e-4);
+ TestUtils.assertEquals(835542680000.000, mdl.calculateResidualSumOfSquares(), 1.0e-3);
+ }
+
+ /**
+ * Anything requiring beta calculation should advertise SME.
+ */
+ @Test(expected = SingularMatrixException.class)
+ public void testSingularCalculateBeta() {
+ OLSMultipleLinearRegression mdl = new OLSMultipleLinearRegression(1e-15);
+ mdl.newSampleData(new double[] {1, 2, 3, 1, 2, 3, 1, 2, 3}, 3, 2, new DenseLocalOnHeapMatrix());
+ mdl.calculateBeta();
+ }
+
+ /** */
+ @Test(expected = NullPointerException.class)
+ public void testNoDataNPECalculateBeta() {
+ OLSMultipleLinearRegression mdl = new OLSMultipleLinearRegression();
+ mdl.calculateBeta();
+ }
+
+ /** */
+ @Test(expected = NullPointerException.class)
+ public void testNoDataNPECalculateHat() {
+ OLSMultipleLinearRegression mdl = new OLSMultipleLinearRegression();
+ mdl.calculateHat();
+ }
+
+ /** */
+ @Test(expected = NullPointerException.class)
+ public void testNoDataNPESSTO() {
+ OLSMultipleLinearRegression mdl = new OLSMultipleLinearRegression();
+ mdl.calculateTotalSumOfSquares();
+ }
+}
[49/50] [abbrv] ignite git commit: Merge remote-tracking branch
'remotes/origin/master' into ignite-5009
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into ignite-5009
# Conflicts:
# modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/658aadc5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/658aadc5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/658aadc5
Branch: refs/heads/ignite-5009
Commit: 658aadc5c2ce90370972351559ef189c007c4725
Parents: 3055da8 1af98e9
Author: sboikov <sb...@gridgain.com>
Authored: Fri May 5 12:38:38 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri May 5 12:38:38 2017 +0300
----------------------------------------------------------------------
RELEASE_NOTES.txt | 36 +
assembly/dependencies-fabric.xml | 5 +-
examples/config/example-cache.xml | 1 +
examples/config/example-memory-policies.xml | 22 +-
examples/pom-standalone-lgpl.xml | 2 +-
examples/pom-standalone.xml | 2 +-
examples/pom.xml | 43 +-
examples/rest/http-rest-example.php | 4 +-
.../hibernate/HibernateL2CacheExample.java | 12 +-
.../examples/datagrid/CacheQueryExample.java | 54 +-
.../datagrid/MemoryPoliciesExample.java | 16 +-
.../client/memcache/MemcacheRestExample.java | 2 +-
.../MemcacheRestExampleNodeStartup.java | 1 +
.../streaming/wordcount/QueryWords.java | 3 +-
.../ml/math/matrix/CacheMatrixExample.java | 23 +-
.../ml/math/matrix/ExampleMatrixStorage.java | 3 +-
.../math/matrix/MatrixCustomStorageExample.java | 6 +-
.../examples/ml/math/matrix/MatrixExample.java | 4 +-
.../ml/math/matrix/OffHeapMatrixExample.java | 6 +-
.../matrix/SparseDistributedMatrixExample.java | 8 +-
.../ml/math/matrix/SparseMatrixExample.java | 4 +-
.../examples/ml/math/tracer/TracerExample.java | 2 +-
.../ml/math/vector/CacheVectorExample.java | 19 +-
.../ml/math/vector/ExampleVectorStorage.java | 7 +-
.../ml/math/vector/OffHeapVectorExample.java | 2 +-
.../ml/math/vector/SparseVectorExample.java | 4 -
.../math/vector/VectorCustomStorageExample.java | 4 -
.../examples/ml/math/vector/VectorExample.java | 6 +-
.../examples/IndexingBridgeMethodTest.java | 93 -
.../IgniteExamplesJ8SelfTestSuite.java | 2 -
modules/aop/pom.xml | 2 +-
.../apache/ignite/gridify/AbstractAopTest.java | 4 +-
.../gridify/ExternalNonSpringAopSelfTest.java | 6 +-
modules/apache-license-gen/pom.xml | 2 +-
modules/aws/pom.xml | 2 +-
modules/benchmarks/pom.xml | 2 +-
.../jmh/cache/JmhCacheAbstractBenchmark.java | 7 +-
.../benchmarks/jmh/tree/BPlusTreeBenchmark.java | 15 +-
modules/camel/pom.xml | 2 +-
.../stream/camel/IgniteCamelStreamerTest.java | 10 +-
modules/cassandra/pom.xml | 2 +-
modules/cassandra/serializers/pom.xml | 4 +-
modules/cassandra/store/pom.xml | 4 +-
.../store/cassandra/CassandraCacheStore.java | 16 +-
.../cassandra/common/PropertyMappingHelper.java | 21 +-
.../persistence/KeyPersistenceSettings.java | 18 +-
.../store/cassandra/persistence/PojoField.java | 21 +-
.../cassandra/persistence/PojoKeyField.java | 7 -
.../cassandra/persistence/PojoValueField.java | 6 -
.../persistence/ValuePersistenceSettings.java | 12 +-
.../session/LoadCacheCustomQueryWorker.java | 26 +-
.../ignite/ignite-cassandra-server-template.xml | 3 -
.../tests/ignite-cassandra-client-template.xml | 3 -
.../ignite/tests/IgnitePersistentStoreTest.java | 30 +-
.../org/apache/ignite/tests/pojos/Person.java | 10 +-
.../org/apache/ignite/tests/pojos/Product.java | 7 -
.../apache/ignite/tests/pojos/ProductOrder.java | 8 -
.../tests/persistence/blob/ignite-config.xml | 4 +-
.../tests/persistence/pojo/ignite-config.xml | 4 +-
.../persistence/primitive/ignite-config.xml | 4 +-
.../primitive/ignite-remote-server-config.xml | 4 +-
modules/clients/pom.xml | 2 +-
.../ClientAbstractMultiThreadedSelfTest.java | 37 +-
.../client/ClientDefaultCacheSelfTest.java | 6 +-
.../ClientAbstractMultiNodeSelfTest.java | 25 +-
.../integration/ClientAbstractSelfTest.java | 9 +-
.../jdbc2/JdbcAbstractDmlStatementSelfTest.java | 16 +-
.../jdbc2/JdbcComplexQuerySelfTest.java | 5 +-
.../internal/jdbc2/JdbcConnectionSelfTest.java | 5 +-
.../jdbc2/JdbcDistributedJoinsQueryTest.java | 6 +-
.../jdbc2/JdbcDynamicIndexAbstractSelfTest.java | 14 +-
.../jdbc2/JdbcInsertStatementSelfTest.java | 4 +-
.../jdbc2/JdbcMergeStatementSelfTest.java | 4 +-
.../internal/jdbc2/JdbcMetadataSelfTest.java | 31 +-
.../internal/jdbc2/JdbcNoDefaultCacheTest.java | 45 +-
.../jdbc2/JdbcPreparedStatementSelfTest.java | 4 +-
.../internal/jdbc2/JdbcResultSetSelfTest.java | 6 +-
.../internal/jdbc2/JdbcStatementSelfTest.java | 4 +-
.../internal/jdbc2/JdbcStreamingSelfTest.java | 14 +-
.../rest/AbstractRestProcessorSelfTest.java | 2 +-
.../JettyRestProcessorAbstractSelfTest.java | 341 +--
.../rest/JettyRestProcessorSignedSelfTest.java | 4 +-
.../rest/RestBinaryProtocolSelfTest.java | 101 +-
.../rest/RestMemcacheProtocolSelfTest.java | 47 +-
.../processors/rest/RestProcessorTest.java | 2 +-
.../rest/TaskCommandHandlerSelfTest.java | 7 +-
.../processors/rest/TestBinaryClient.java | 23 +-
.../tcp/redis/RedisProtocolSelfTest.java | 8 +-
.../jdbc/AbstractJdbcPojoQuerySelfTest.java | 2 +-
.../ignite/jdbc/JdbcConnectionSelfTest.java | 5 +-
.../ignite/jdbc/JdbcMetadataSelfTest.java | 8 +-
.../ignite/jdbc/JdbcNoDefaultCacheTest.java | 3 +-
.../ignite/jdbc/JdbcPojoQuerySelfTest.java | 2 +-
.../jdbc/JdbcPreparedStatementSelfTest.java | 2 +-
.../ignite/jdbc/JdbcResultSetSelfTest.java | 2 +-
.../ignite/jdbc/JdbcStatementSelfTest.java | 2 +-
.../clients/src/test/resources/spring-cache.xml | 10 -
modules/cloud/pom.xml | 2 +-
modules/codegen/pom.xml | 2 +-
modules/core/pom.xml | 2 +-
.../src/main/java/org/apache/ignite/Ignite.java | 14 +-
.../java/org/apache/ignite/IgniteCompute.java | 8 +-
.../org/apache/ignite/IgniteJdbcDriver.java | 69 +-
.../apache/ignite/IgniteSystemProperties.java | 3 +
.../java/org/apache/ignite/MemoryMetrics.java | 89 +-
.../org/apache/ignite/cache/CacheMetrics.java | 8 -
.../org/apache/ignite/cache/QueryEntity.java | 81 +
.../org/apache/ignite/cache/query/Query.java | 48 +
.../ignite/cache/query/SqlFieldsQuery.java | 26 +
.../org/apache/ignite/cache/query/SqlQuery.java | 26 +
.../cache/query/annotations/QuerySqlField.java | 2 +-
.../cache/query/annotations/QueryTextField.java | 4 +-
.../store/jdbc/CacheAbstractJdbcStore.java | 71 +-
.../apache/ignite/cluster/ClusterMetrics.java | 4 +-
.../org/apache/ignite/cluster/ClusterNode.java | 11 +-
.../configuration/CacheConfiguration.java | 132 +-
.../configuration/DataPageEvictionMode.java | 21 +-
.../configuration/IgniteConfiguration.java | 52 +-
.../configuration/MemoryConfiguration.java | 127 +-
.../MemoryPolicyConfiguration.java | 94 +-
.../org/apache/ignite/events/EventType.java | 2 +-
.../org/apache/ignite/igfs/IgfsMetrics.java | 2 +-
.../ignite/internal/IgniteComputeImpl.java | 37 +-
.../org/apache/ignite/internal/IgniteEx.java | 12 +-
.../apache/ignite/internal/IgniteKernal.java | 87 +-
.../internal/cluster/ClusterGroupAdapter.java | 23 +-
.../ignite/internal/cluster/ClusterGroupEx.java | 5 +-
.../internal/jdbc/JdbcDriverPropertyInfo.java | 37 +
.../managers/communication/GridIoManager.java | 2 +-
.../managers/communication/GridIoMessage.java | 5 +-
.../optimized/OptimizedMarshaller.java | 3 +-
.../ignite/internal/mem/DirectMemory.java | 55 -
.../internal/mem/DirectMemoryProvider.java | 19 +-
.../mem/file/MappedFileMemoryProvider.java | 153 +-
.../mem/unsafe/UnsafeMemoryProvider.java | 69 +-
.../pagemem/impl/PageMemoryNoStoreImpl.java | 408 ++--
.../affinity/GridAffinityProcessor.java | 67 +-
.../cache/CacheClusterMetricsMXBeanImpl.java | 5 -
.../cache/CacheLocalMetricsMXBeanImpl.java | 5 -
.../processors/cache/CacheMetricsImpl.java | 5 -
.../processors/cache/CacheMetricsSnapshot.java | 13 -
.../cache/DynamicCacheDescriptor.java | 24 +
.../processors/cache/GridCacheAdapter.java | 19 +-
.../processors/cache/GridCacheProcessor.java | 201 +-
.../cache/GridCacheSharedContext.java | 18 +-
.../processors/cache/GridCacheUtils.java | 30 +-
.../processors/cache/IgniteCacheProxy.java | 14 +
.../cache/binary/BinaryMetadataHolder.java | 7 +
.../cache/binary/BinaryMetadataTransport.java | 34 +-
.../binary/CacheObjectBinaryProcessorImpl.java | 27 +-
.../binary/ClientMetadataRequestFuture.java | 5 +
.../IgniteCacheDatabaseSharedManager.java | 340 +--
.../cache/database/MemoryMetricsImpl.java | 32 +-
.../cache/database/MemoryMetricsMXBeanImpl.java | 108 +
.../cache/database/MemoryMetricsSnapshot.java | 85 +
.../processors/cache/database/MemoryPolicy.java | 7 +-
.../evict/FairFifoPageEvictionTracker.java | 6 +-
.../evict/PageAbstractEvictionTracker.java | 92 +-
.../evict/Random2LruPageEvictionTracker.java | 6 +-
.../evict/RandomLruPageEvictionTracker.java | 6 +-
.../cache/database/tree/BPlusTree.java | 6 +-
.../distributed/dht/GridDhtLocalPartition.java | 3 +-
.../GridDhtAtomicAbstractUpdateRequest.java | 15 +
.../dht/atomic/GridDhtAtomicUpdateRequest.java | 7 +-
.../GridDhtPartitionsAbstractMessage.java | 6 +
.../processors/cache/local/GridLocalCache.java | 3 +-
.../cache/query/GridCacheQueryManager.java | 14 +-
.../cache/transactions/IgniteTxManager.java | 20 +-
.../cache/transactions/TxDeadlock.java | 19 +-
.../cache/transactions/TxLocksResponse.java | 37 +-
.../datastructures/GridCacheLockImpl.java | 6 +
.../processors/igfs/IgfsDataManager.java | 2 +-
.../processors/job/GridJobProcessor.java | 18 +-
.../internal/processors/odbc/IgniteTypes.java | 69 -
.../processors/odbc/OdbcBufferedParser.java | 81 -
.../processors/odbc/OdbcColumnMeta.java | 110 -
.../processors/odbc/OdbcHandshakeRequest.java | 83 -
.../processors/odbc/OdbcHandshakeResult.java | 73 -
.../processors/odbc/OdbcMessageParser.java | 320 ---
.../processors/odbc/OdbcNioListener.java | 75 +-
.../processors/odbc/OdbcNioServerBuffer.java | 114 -
.../internal/processors/odbc/OdbcProcessor.java | 2 +-
.../processors/odbc/OdbcProtocolVersion.java | 125 --
.../processors/odbc/OdbcQueryCloseRequest.java | 49 -
.../processors/odbc/OdbcQueryCloseResult.java | 40 -
.../odbc/OdbcQueryExecuteRequest.java | 78 -
.../processors/odbc/OdbcQueryExecuteResult.java | 54 -
.../processors/odbc/OdbcQueryFetchRequest.java | 61 -
.../processors/odbc/OdbcQueryFetchResult.java | 66 -
.../odbc/OdbcQueryGetColumnsMetaRequest.java | 4 +-
.../odbc/OdbcQueryGetColumnsMetaResult.java | 6 +-
.../odbc/OdbcQueryGetParamsMetaRequest.java | 4 +-
.../odbc/OdbcQueryGetTablesMetaRequest.java | 4 +-
.../internal/processors/odbc/OdbcRequest.java | 61 -
.../processors/odbc/OdbcRequestHandler.java | 532 -----
.../internal/processors/odbc/OdbcResponse.java | 96 -
.../internal/processors/odbc/OdbcUtils.java | 33 +-
.../odbc/SqlListenerBufferedParser.java | 81 +
.../processors/odbc/SqlListenerColumnMeta.java | 110 +
.../odbc/SqlListenerConnectionContext.java | 56 +
.../processors/odbc/SqlListenerDataTypes.java | 69 +
.../odbc/SqlListenerHandshakeRequest.java | 83 +
.../odbc/SqlListenerHandshakeResult.java | 73 +
.../odbc/SqlListenerMessageParser.java | 39 +
.../odbc/SqlListenerNioServerBuffer.java | 114 +
.../odbc/SqlListenerProtocolVersion.java | 88 +
.../odbc/SqlListenerQueryCloseRequest.java | 49 +
.../odbc/SqlListenerQueryCloseResult.java | 40 +
.../odbc/SqlListenerQueryExecuteRequest.java | 78 +
.../odbc/SqlListenerQueryExecuteResult.java | 54 +
.../odbc/SqlListenerQueryFetchRequest.java | 61 +
.../odbc/SqlListenerQueryFetchResult.java | 66 +
.../processors/odbc/SqlListenerRequest.java | 78 +
.../odbc/SqlListenerRequestHandler.java | 31 +
.../processors/odbc/SqlListenerResponse.java | 96 +
.../odbc/escape/OdbcEscapeParseResult.java | 73 -
.../processors/odbc/escape/OdbcEscapeToken.java | 61 -
.../processors/odbc/escape/OdbcEscapeType.java | 112 -
.../processors/odbc/escape/OdbcEscapeUtils.java | 440 ----
.../processors/odbc/odbc/OdbcMessageParser.java | 322 +++
.../odbc/odbc/OdbcRequestHandler.java | 540 +++++
.../odbc/odbc/escape/OdbcEscapeParseResult.java | 73 +
.../odbc/odbc/escape/OdbcEscapeToken.java | 61 +
.../odbc/odbc/escape/OdbcEscapeType.java | 112 +
.../odbc/odbc/escape/OdbcEscapeUtils.java | 441 ++++
.../platform/cache/PlatformCache.java | 1 -
.../utils/PlatformConfigurationUtils.java | 57 +-
.../processors/query/GridQueryIndexing.java | 23 +-
.../processors/query/GridQueryProcessor.java | 4 +-
.../query/GridQueryTypeDescriptor.java | 12 +
.../query/QueryTypeDescriptorImpl.java | 34 +-
.../internal/processors/query/QueryUtils.java | 134 +-
.../handlers/cache/GridCacheCommandHandler.java | 4 +-
.../redis/GridRedisRestCommandHandler.java | 3 +
.../redis/key/GridRedisDelCommandHandler.java | 1 +
.../key/GridRedisExistsCommandHandler.java | 1 +
.../server/GridRedisDbSizeCommandHandler.java | 1 +
.../string/GridRedisAppendCommandHandler.java | 3 +
.../string/GridRedisGetCommandHandler.java | 1 +
.../string/GridRedisGetRangeCommandHandler.java | 1 +
.../string/GridRedisGetSetCommandHandler.java | 1 +
.../string/GridRedisIncrDecrCommandHandler.java | 2 +
.../string/GridRedisMGetCommandHandler.java | 1 +
.../string/GridRedisMSetCommandHandler.java | 1 +
.../string/GridRedisSetCommandHandler.java | 1 +
.../string/GridRedisSetRangeCommandHandler.java | 2 +
.../string/GridRedisStrlenCommandHandler.java | 1 +
.../tcp/GridTcpMemcachedNioListener.java | 5 +-
.../processors/security/SecurityContext.java | 9 +
.../service/GridServiceProcessor.java | 20 +-
.../ignite/internal/util/GridIntIterator.java | 33 +
.../ignite/internal/util/GridIntList.java | 21 +-
.../ignite/internal/util/IgniteUtils.java | 45 +-
.../internal/visor/VisorDataTransferObject.java | 15 +-
.../visor/binary/VisorBinaryMetadata.java | 11 +-
.../VisorBinaryMetadataCollectorTask.java | 16 +-
.../VisorBinaryMetadataCollectorTaskArg.java | 71 +
.../VisorBinaryMetadataCollectorTaskResult.java | 4 +-
.../cache/VisorCacheAffinityConfiguration.java | 8 +-
.../visor/cache/VisorCacheClearTask.java | 19 +-
.../visor/cache/VisorCacheClearTaskArg.java | 72 +
.../visor/cache/VisorCacheConfiguration.java | 165 +-
.../VisorCacheConfigurationCollectorJob.java | 12 +-
.../VisorCacheConfigurationCollectorTask.java | 5 +-
...VisorCacheConfigurationCollectorTaskArg.java | 74 +
.../visor/cache/VisorCacheLoadTask.java | 5 +-
.../visor/cache/VisorCacheLoadTaskArg.java | 2 +-
.../visor/cache/VisorCacheMetadataTask.java | 14 +-
.../visor/cache/VisorCacheMetadataTaskArg.java | 72 +
.../visor/cache/VisorCacheNodesTask.java | 12 +-
.../visor/cache/VisorCacheNodesTaskArg.java | 72 +
.../cache/VisorCacheRebalanceConfiguration.java | 26 +
.../visor/cache/VisorCacheRebalanceTask.java | 13 +-
.../visor/cache/VisorCacheRebalanceTaskArg.java | 73 +
.../visor/cache/VisorCacheResetMetricsTask.java | 14 +-
.../cache/VisorCacheResetMetricsTaskArg.java | 72 +
.../visor/cache/VisorCacheStartArg.java | 100 -
.../visor/cache/VisorCacheStopTask.java | 17 +-
.../visor/cache/VisorCacheStopTaskArg.java | 72 +
.../cache/VisorCacheStoreConfiguration.java | 14 +
.../internal/visor/cache/VisorPartitionMap.java | 24 +-
.../compute/VisorComputeCancelSessionsTask.java | 13 +-
.../VisorComputeCancelSessionsTaskArg.java | 76 +
.../visor/compute/VisorGatewayTask.java | 87 +-
.../internal/visor/debug/VisorThreadInfo.java | 64 +-
.../visor/debug/VisorThreadMonitorInfo.java | 8 +-
.../internal/visor/file/VisorFileBlockArg.java | 114 -
.../visor/igfs/VisorIgfsFormatTask.java | 14 +-
.../visor/igfs/VisorIgfsFormatTaskArg.java | 72 +
.../visor/igfs/VisorIgfsProfilerClearTask.java | 24 +-
.../igfs/VisorIgfsProfilerClearTaskArg.java | 72 +
.../igfs/VisorIgfsProfilerClearTaskResult.java | 6 +-
.../visor/igfs/VisorIgfsProfilerTask.java | 18 +-
.../visor/igfs/VisorIgfsProfilerTaskArg.java | 72 +
.../visor/igfs/VisorIgfsResetMetricsTask.java | 13 +-
.../igfs/VisorIgfsResetMetricsTaskArg.java | 73 +
.../internal/visor/log/VisorLogSearchArg.java | 114 -
.../internal/visor/misc/VisorAckTask.java | 14 +-
.../internal/visor/misc/VisorAckTaskArg.java | 72 +
.../misc/VisorChangeGridActiveStateTask.java | 12 +-
.../misc/VisorChangeGridActiveStateTaskArg.java | 71 +
.../visor/node/VisorBasicConfiguration.java | 224 +-
.../visor/node/VisorBinaryConfiguration.java | 131 ++
.../node/VisorBinaryTypeConfiguration.java | 150 ++
.../visor/node/VisorCacheKeyConfiguration.java | 108 +
.../visor/node/VisorExecutorConfiguration.java | 108 +
.../node/VisorExecutorServiceConfiguration.java | 115 +
.../visor/node/VisorGridConfiguration.java | 110 +
.../visor/node/VisorHadoopConfiguration.java | 145 ++
.../visor/node/VisorIgfsConfiguration.java | 42 +-
.../visor/node/VisorMemoryConfiguration.java | 2 +-
.../node/VisorMemoryPolicyConfiguration.java | 43 +-
.../internal/visor/node/VisorNodePingTask.java | 13 +-
.../visor/node/VisorNodePingTaskArg.java | 73 +
.../visor/node/VisorNodeSuppressedErrors.java | 6 +-
.../node/VisorNodeSuppressedErrorsTask.java | 12 +-
.../node/VisorNodeSuppressedErrorsTaskArg.java | 74 +
.../visor/node/VisorOdbcConfiguration.java | 114 +
.../visor/node/VisorRestConfiguration.java | 207 +-
.../node/VisorSegmentationConfiguration.java | 13 +
.../visor/node/VisorServiceConfiguration.java | 176 ++
.../internal/visor/query/VisorQueryArg.java | 155 --
.../visor/query/VisorQueryCancelTask.java | 12 +-
.../visor/query/VisorQueryCancelTaskArg.java | 71 +
.../visor/query/VisorQueryCleanupTask.java | 10 +-
.../visor/query/VisorQueryCleanupTaskArg.java | 75 +
.../visor/query/VisorQueryConfiguration.java | 12 -
.../VisorQueryDetailMetricsCollectorTask.java | 17 +-
...VisorQueryDetailMetricsCollectorTaskArg.java | 71 +
.../query/VisorQueryResetDetailMetricsTask.java | 6 +-
.../visor/query/VisorQueryResetMetricsTask.java | 18 +-
.../query/VisorQueryResetMetricsTaskArg.java | 72 +
.../query/VisorRunningQueriesCollectorTask.java | 16 +-
.../VisorRunningQueriesCollectorTaskArg.java | 71 +
.../internal/visor/query/VisorScanQueryArg.java | 157 --
.../visor/service/VisorCancelServiceTask.java | 12 +-
.../service/VisorCancelServiceTaskArg.java | 72 +
.../internal/visor/util/VisorTaskUtils.java | 23 +
.../ignite/mxbean/CacheMetricsMXBean.java | 4 -
.../ignite/mxbean/MemoryMetricsMXBean.java | 94 +-
.../security/SecurityBasicPermissionSet.java | 96 +-
.../plugin/security/SecurityPermission.java | 13 +-
.../plugin/security/SecurityPermissionSet.java | 8 +
.../security/SecurityPermissionSetBuilder.java | 36 +-
.../org/apache/ignite/spi/IgniteSpiAdapter.java | 32 +
.../spi/IgniteSpiOperationTimeoutHelper.java | 8 +-
.../jobstealing/JobStealingCollisionSpi.java | 2 +-
.../communication/tcp/TcpCommunicationSpi.java | 6 +-
.../ignite/spi/discovery/tcp/ClientImpl.java | 31 +-
.../ignite/spi/discovery/tcp/ServerImpl.java | 142 +-
.../spi/discovery/tcp/TcpDiscoverySpi.java | 139 +-
.../spi/discovery/tcp/TcpDiscoverySpiMBean.java | 26 +-
.../tcp/internal/TcpDiscoveryNode.java | 33 +-
.../TcpDiscoveryClientHeartbeatMessage.java | 72 -
.../TcpDiscoveryClientMetricsUpdateMessage.java | 72 +
.../messages/TcpDiscoveryHeartbeatMessage.java | 338 ---
.../TcpDiscoveryMetricsUpdateMessage.java | 338 +++
.../spi/indexing/IndexingQueryFilter.java | 2 +-
.../adaptive/AdaptiveLoadBalancingSpi.java | 12 +-
.../resources/META-INF/classnames.properties | 82 +-
.../core/src/main/resources/ignite.properties | 2 +-
.../spring-cache-client-benchmark-1.xml | 3 -
.../spring-cache-client-benchmark-2.xml | 3 -
.../spring-cache-client-benchmark-3.xml | 3 -
.../core/src/test/config/discovery-stress.xml | 2 +-
modules/core/src/test/config/example-cache.xml | 3 -
modules/core/src/test/config/igfs-loopback.xml | 18 -
modules/core/src/test/config/igfs-shmem.xml | 18 -
.../src/test/config/load/cache-benchmark.xml | 4 -
.../test/config/load/cache-client-benchmark.xml | 2 -
.../config/load/dsi-49-server-production.xml | 2 -
.../core/src/test/config/load/dsi-load-base.xml | 3 +-
.../src/test/config/load/dsi-load-client.xml | 2 -
.../src/test/config/load/dsi-load-server.xml | 2 -
.../src/test/config/load/merge-sort-base.xml | 7 +-
.../core/src/test/config/spring-cache-load.xml | 1 +
.../core/src/test/config/spring-cache-swap.xml | 2 +
.../src/test/config/spring-cache-teststore.xml | 2 +
.../core/src/test/config/spring-multicache.xml | 17 -
.../test/config/store/jdbc/ignite-jdbc-type.xml | 6 +
.../config/streamer/spring-streamer-base.xml | 5 +-
.../config/websession/example-cache-base.xml | 3 -
.../GridCacheAffinityBackupsSelfTest.java | 2 +-
.../java/org/apache/ignite/GridTestJob.java | 19 +
.../apache/ignite/GridTestStoreNodeStartup.java | 2 +-
.../java/org/apache/ignite/GridTestTask.java | 18 +-
.../ignite/IgniteCacheAffinitySelfTest.java | 2 +-
.../cache/IgniteWarmupClosureSelfTest.java | 2 +-
.../ignite/cache/LargeEntryUpdateTest.java | 2 +-
.../affinity/AffinityClientNodeSelfTest.java | 14 +-
...ityFunctionBackupFilterAbstractSelfTest.java | 8 +-
...unctionExcludeNeighborsAbstractSelfTest.java | 4 +-
.../affinity/AffinityHistoryCleanupTest.java | 2 +-
.../local/LocalAffinityFunctionTest.java | 2 +-
...cheStoreSessionListenerAbstractSelfTest.java | 6 +-
.../store/GridCacheBalancingStoreSelfTest.java | 8 +-
.../IgniteCacheExpiryStoreLoadSelfTest.java | 2 +-
.../store/StoreResourceInjectionSelfTest.java | 2 +-
.../CacheJdbcPojoStoreAbstractSelfTest.java | 49 +
...CacheJdbcBlobStoreMultithreadedSelfTest.java | 8 +-
.../internal/ClusterNodeMetricsSelfTest.java | 16 +-
.../ignite/internal/GridAffinityMappedTest.java | 11 +-
.../internal/GridAffinityP2PSelfTest.java | 9 +-
.../ignite/internal/GridAffinitySelfTest.java | 9 +-
.../GridCancelledJobsMetricsSelfTest.java | 4 +-
.../ignite/internal/GridDiscoverySelfTest.java | 2 +-
...ridFailFastNodeFailureDetectionSelfTest.java | 4 +-
.../GridJobCollisionCancelSelfTest.java | 2 +-
.../GridJobMasterLeaveAwareSelfTest.java | 8 +-
.../GridProjectionForCachesSelfTest.java | 13 +-
...ectionLocalJobMultipleArgumentsSelfTest.java | 4 +-
.../ignite/internal/GridStartStopSelfTest.java | 8 +-
.../GridTaskFailoverAffinityRunTest.java | 4 +-
.../IgniteClientReconnectApiExceptionTest.java | 18 +-
.../IgniteClientReconnectCacheTest.java | 82 +-
...eClientReconnectContinuousProcessorTest.java | 10 +-
.../IgniteClientReconnectFailoverTest.java | 4 +-
.../internal/IgniteClientReconnectStopTest.java | 2 +-
.../IgniteComputeEmptyClusterGroupTest.java | 8 +-
...eConcurrentEntryProcessorAccessStopTest.java | 2 +-
...ryConfigurationCustomSerializerSelfTest.java | 4 +-
.../internal/binary/BinaryEnumsSelfTest.java | 2 +-
.../BinaryObjectBuilderAdditionalSelfTest.java | 2 +-
.../internal/binary/BinaryTreeSelfTest.java | 4 +-
.../binary/GridBinaryAffinityKeySelfTest.java | 30 +-
...aultBinaryMappersBinaryMetaDataSelfTest.java | 4 +-
.../IgniteVariousConnectionNumberTest.java | 4 +-
.../GridDeploymentMessageCountSelfTest.java | 6 +-
.../GridDiscoveryManagerAliveCacheSelfTest.java | 6 +-
.../OptimizedMarshallerNodeFailoverTest.java | 6 +-
.../pagemem/impl/PageMemoryNoLoadSelfTest.java | 19 +-
.../GridCacheTxLoadFromStoreOnLockSelfTest.java | 2 +-
.../GridAffinityProcessorAbstractSelfTest.java | 2 +-
.../CacheAtomicSingleMessageCountSelfTest.java | 4 +-
.../cache/CacheClientStoreSelfTest.java | 2 +-
.../cache/CacheConcurrentReadThroughTest.java | 2 +-
.../cache/CacheConfigurationLeakTest.java | 4 +-
.../cache/CacheDeferredDeleteQueueTest.java | 4 +-
.../CacheDeferredDeleteSanitySelfTest.java | 4 +-
...cheDhtLocalPartitionAfterRemoveSelfTest.java | 6 +-
.../cache/CacheEnumOperationsAbstractTest.java | 2 +-
...CacheExchangeMessageDuplicatedStateTest.java | 10 +-
.../cache/CacheFutureExceptionSelfTest.java | 2 +-
.../cache/CacheGetEntryAbstractTest.java | 16 +-
.../processors/cache/CacheGetFromJobTest.java | 2 +-
...erceptorPartitionCounterLocalSanityTest.java | 2 +-
...torPartitionCounterRandomOperationsTest.java | 2 +-
.../CacheMemoryPolicyConfigurationTest.java | 26 +-
.../processors/cache/CacheNamesSelfTest.java | 8 +-
.../CacheNamesWithSpecialCharactersTest.java | 4 +-
.../cache/CacheNearReaderUpdateTest.java | 2 +-
...cheNearUpdateTopologyChangeAbstractTest.java | 8 +-
.../cache/CacheOffheapMapEntrySelfTest.java | 2 +-
.../processors/cache/CachePutIfAbsentTest.java | 2 +-
.../cache/CacheReadThroughRestartSelfTest.java | 8 +-
.../cache/CacheRebalancingSelfTest.java | 4 +-
.../cache/CacheRemoveAllSelfTest.java | 4 +-
.../CacheSerializableTransactionsTest.java | 6 +-
.../CacheStartupInDeploymentModesTest.java | 4 +-
.../CacheStoreUsageMultinodeAbstractTest.java | 8 +-
...eUsageMultinodeDynamicStartAbstractTest.java | 4 +-
.../processors/cache/CacheTxFastFinishTest.java | 4 +-
.../processors/cache/CrossCacheLockTest.java | 4 +-
.../cache/CrossCacheTxRandomOperationsTest.java | 2 +-
.../EntryVersionConsistencyReadThroughTest.java | 10 +-
.../GridCacheAbstractFailoverSelfTest.java | 8 +-
.../cache/GridCacheAbstractFullApiSelfTest.java | 114 +-
.../GridCacheAbstractLocalStoreSelfTest.java | 26 +-
.../cache/GridCacheAbstractMetricsSelfTest.java | 102 +-
.../GridCacheAbstractRemoveFailureTest.java | 6 +-
.../cache/GridCacheAbstractSelfTest.java | 8 +-
...acheAbstractUsersAffinityMapperSelfTest.java | 7 +-
.../cache/GridCacheAffinityApiSelfTest.java | 26 +-
.../cache/GridCacheAffinityRoutingSelfTest.java | 10 +-
...eAtomicEntryProcessorDeploymentSelfTest.java | 2 +-
.../GridCacheAtomicMessageCountSelfTest.java | 6 +-
.../cache/GridCacheBasicApiAbstractTest.java | 30 +-
.../cache/GridCacheClearLocallySelfTest.java | 8 +-
.../cache/GridCacheConcurrentMapSelfTest.java | 11 +-
.../GridCacheConcurrentTxMultiNodeTest.java | 10 +-
.../GridCacheConditionalDeploymentSelfTest.java | 4 +-
...idCacheConfigurationConsistencySelfTest.java | 2 +-
.../GridCacheDaemonNodeAbstractSelfTest.java | 8 +-
.../cache/GridCacheDeploymentSelfTest.java | 46 +-
.../cache/GridCacheEntryMemorySizeSelfTest.java | 4 +-
.../cache/GridCacheEntryVersionSelfTest.java | 16 +-
.../GridCacheEvictionEventAbstractTest.java | 2 +-
.../GridCacheFinishPartitionsSelfTest.java | 16 +-
...CacheFullTextQueryMultithreadedSelfTest.java | 2 +-
.../cache/GridCacheIncrementTransformTest.java | 4 +-
.../GridCacheInterceptorAbstractSelfTest.java | 8 +-
.../cache/GridCacheIteratorPerformanceTest.java | 6 +-
.../cache/GridCacheKeyCheckSelfTest.java | 6 +-
.../GridCacheMarshallerTxAbstractTest.java | 10 +-
.../GridCacheMarshallingNodeJoinSelfTest.java | 4 +-
.../GridCacheMissingCommitVersionSelfTest.java | 2 +-
...GridCacheMixedPartitionExchangeSelfTest.java | 4 +-
.../cache/GridCacheMultiUpdateLockSelfTest.java | 6 +-
...ridCacheMultinodeUpdateAbstractSelfTest.java | 6 +-
.../cache/GridCacheMvccFlagsTest.java | 4 +-
.../cache/GridCacheMvccManagerSelfTest.java | 9 +-
.../cache/GridCacheMvccPartitionedSelfTest.java | 34 +-
.../processors/cache/GridCacheMvccSelfTest.java | 58 +-
.../cache/GridCacheNestedTxAbstractTest.java | 12 +-
.../cache/GridCacheObjectToStringSelfTest.java | 4 +-
...HeapMultiThreadedUpdateAbstractSelfTest.java | 20 +-
...CacheOffHeapMultiThreadedUpdateSelfTest.java | 14 +-
.../cache/GridCacheOffheapUpdateSelfTest.java | 14 +-
.../cache/GridCachePartitionedGetSelfTest.java | 16 +-
...hePartitionedProjectionAffinitySelfTest.java | 8 +-
.../GridCachePreloadingEvictionsSelfTest.java | 14 +-
.../cache/GridCachePutAllFailoverSelfTest.java | 1 -
.../GridCacheQueryIndexingDisabledSelfTest.java | 2 +-
.../GridCacheQueryInternalKeysSelfTest.java | 6 +-
.../GridCacheReferenceCleanupSelfTest.java | 10 +-
...ridCacheReplicatedSynchronousCommitTest.java | 6 +-
.../GridCacheReturnValueTransferSelfTest.java | 4 +-
.../processors/cache/GridCacheStopSelfTest.java | 8 +-
...ridCacheStoreManagerDeserializationTest.java | 3 +
.../cache/GridCacheStorePutxSelfTest.java | 2 +-
.../cache/GridCacheStoreValueBytesSelfTest.java | 4 +-
.../cache/GridCacheSwapPreloadSelfTest.java | 10 +-
...acheTcpClientDiscoveryMultiThreadedTest.java | 4 +-
...cheTransactionalAbstractMetricsSelfTest.java | 8 +-
.../GridCacheTtlManagerEvictionSelfTest.java | 6 +-
.../cache/GridCacheTtlManagerLoadTest.java | 4 +-
.../GridCacheTtlManagerNotificationTest.java | 8 +-
.../cache/GridCacheTtlManagerSelfTest.java | 12 +-
.../GridCacheValueBytesPreloadingSelfTest.java | 12 +-
...idCacheValueConsistencyAbstractSelfTest.java | 14 +-
.../GridCacheVariableTopologySelfTest.java | 4 +-
.../cache/GridCacheVersionMultinodeTest.java | 2 +-
.../GridCacheVersionTopologyChangeTest.java | 2 +-
...ProjectionForCachesOnDaemonNodeSelfTest.java | 16 +-
.../IgniteCacheAbstractStopBusySelfTest.java | 3 +-
.../cache/IgniteCacheAbstractTest.java | 12 +-
...IgniteCacheBinaryEntryProcessorSelfTest.java | 6 +-
...teCacheConfigurationDefaultTemplateTest.java | 6 +-
.../IgniteCacheConfigurationTemplateTest.java | 29 +-
...niteCacheCopyOnReadDisabledAbstractTest.java | 2 +-
.../cache/IgniteCacheDynamicStopSelfTest.java | 10 +-
.../IgniteCacheEntryListenerAbstractTest.java | 6 +-
...niteCacheEntryListenerExpiredEventsTest.java | 2 +-
.../IgniteCacheEntryProcessorCallTest.java | 8 +-
.../IgniteCacheEntryProcessorNodeJoinTest.java | 16 +-
...niteCacheExpireAndUpdateConsistencyTest.java | 2 +-
...IgniteCacheGetCustomCollectionsSelfTest.java | 2 +-
.../cache/IgniteCacheIncrementTxTest.java | 10 +-
.../cache/IgniteCacheInvokeAbstractTest.java | 2 +-
...gniteCacheInvokeReadThroughAbstractTest.java | 2 +-
...gniteCacheLoadRebalanceEvictionSelfTest.java | 6 +-
.../IgniteCacheManyAsyncOperationsTest.java | 2 +-
.../cache/IgniteCacheObjectPutSelfTest.java | 2 +-
...CacheP2pUnmarshallingRebalanceErrorTest.java | 4 +-
.../IgniteCachePartitionMapUpdateTest.java | 4 +-
.../cache/IgniteCachePeekModesAbstractTest.java | 22 +-
.../IgniteCacheReadThroughStoreCallTest.java | 2 +-
...iteCacheScanPredicateDeploymentSelfTest.java | 2 +-
.../cache/IgniteCacheSerializationSelfTest.java | 4 +-
.../cache/IgniteCacheStartStopLoadTest.java | 2 +-
.../cache/IgniteCacheStoreCollectionTest.java | 4 +-
.../IgniteCacheStoreValueAbstractTest.java | 30 +-
.../cache/IgniteCacheTxPreloadNoWriteTest.java | 12 +-
.../IgniteClientAffinityAssignmentSelfTest.java | 22 +-
.../IgniteDaemonNodeMarshallerCacheTest.java | 2 +-
.../cache/IgniteDynamicCacheAndNodeStop.java | 4 +-
.../cache/IgniteDynamicCacheFilterTest.java | 10 +-
...eDynamicCacheStartNoExchangeTimeoutTest.java | 34 +-
.../cache/IgniteDynamicCacheStartSelfTest.java | 36 +-
...niteDynamicCacheStartStopConcurrentTest.java | 6 +-
.../IgniteDynamicClientCacheStartSelfTest.java | 44 +-
.../cache/IgniteExchangeFutureHistoryTest.java | 2 +-
...iteMarshallerCacheClassNameConflictTest.java | 8 +-
...lerCacheClientRequestsMappingOnMissTest.java | 22 +-
...eMarshallerCacheConcurrentReadWriteTest.java | 8 +-
.../cache/IgniteOnePhaseCommitNearSelfTest.java | 8 +-
.../cache/IgnitePutAllLargeBatchSelfTest.java | 12 +-
...tAllUpdateNonPreloadedPartitionSelfTest.java | 6 +-
.../IgniteStartCacheInTransactionSelfTest.java | 18 +-
.../cache/IgniteStaticCacheStartSelfTest.java | 2 +-
...gniteTopologyValidatorAbstractCacheTest.java | 37 +-
...iteTopologyValidatorAbstractTxCacheTest.java | 20 +-
...niteTopologyValidatorGridSplitCacheTest.java | 2 +-
.../processors/cache/IgniteTxAbstractTest.java | 6 +-
.../IgniteTxConcurrentGetAbstractTest.java | 6 +-
.../cache/IgniteTxConfigCacheSelfTest.java | 2 +-
.../IgniteTxExceptionAbstractSelfTest.java | 36 +-
.../cache/IgniteTxMultiNodeAbstractTest.java | 58 +-
.../IgniteTxMultiThreadedAbstractTest.java | 4 +-
.../cache/IgniteTxReentryAbstractSelfTest.java | 2 +-
.../IgniteTxStoreExceptionAbstractSelfTest.java | 34 +-
.../cache/MemoryPolicyConfigValidationTest.java | 127 +-
.../binary/BinaryMetadataUpdatesFlowTest.java | 14 +-
.../CacheKeepBinaryWithInterceptorTest.java | 6 +-
...yAtomicEntryProcessorDeploymentSelfTest.java | 6 +-
...naryObjectMetadataExchangeMultinodeTest.java | 16 +-
...acheBinaryObjectUserClassloaderSelfTest.java | 4 +-
...naryObjectsAbstractDataStreamerSelfTest.java | 4 +-
...aryObjectsAbstractMultiThreadedSelfTest.java | 2 +-
.../GridCacheBinaryObjectsAbstractSelfTest.java | 8 +-
.../GridCacheBinaryStoreAbstractSelfTest.java | 2 +-
...ntNodeBinaryObjectMetadataMultinodeTest.java | 8 +-
...CacheClientNodeBinaryObjectMetadataTest.java | 4 +-
.../GridDataStreamerImplSelfTest.java | 20 +-
...IgniteCacheAbstractExecutionContextTest.java | 4 +-
.../MemoryPolicyInitializationTest.java | 313 +++
...eAbstractDataStructuresFailoverSelfTest.java | 66 +-
...CacheAtomicReferenceApiSelfAbstractTest.java | 2 +-
...idCacheAtomicStampedApiSelfAbstractTest.java | 2 +-
.../GridCacheQueueApiSelfAbstractTest.java | 2 +-
.../GridCacheQueueCleanupSelfTest.java | 10 +-
.../GridCacheSequenceApiSelfAbstractTest.java | 2 +-
.../GridCacheSetAbstractSelfTest.java | 2 +-
.../GridCacheSetFailoverAbstractSelfTest.java | 2 +-
.../IgniteAtomicLongApiAbstractSelfTest.java | 2 +-
.../IgniteCountDownLatchAbstractSelfTest.java | 2 +-
.../IgniteLockAbstractSelfTest.java | 2 +-
.../IgniteSemaphoreAbstractSelfTest.java | 2 +-
...achePartitionedAtomicSequenceTxSelfTest.java | 2 +-
...idCachePartitionedNodeRestartTxSelfTest.java | 24 +-
...PartitionedQueueCreateMultiNodeSelfTest.java | 4 +-
...acheAsyncOperationsFailoverAbstractTest.java | 4 +-
.../distributed/CacheAsyncOperationsTest.java | 2 +-
.../CacheGetFutureHangsSelfTest.java | 4 +-
.../CacheGetInsideLockChangingTopologyTest.java | 2 +-
.../CacheLateAffinityAssignmentTest.java | 12 +-
...CacheLoadingConcurrentGridStartSelfTest.java | 20 +-
.../CacheLockReleaseNodeLeaveTest.java | 26 +-
.../CachePutAllFailoverAbstractTest.java | 2 +-
.../CacheTryLockMultithreadedTest.java | 4 +-
.../GridCacheAbstractJobExecutionTest.java | 14 +-
.../GridCacheAbstractNodeRestartSelfTest.java | 2 +-
...tractPartitionedByteArrayValuesSelfTest.java | 2 +-
.../GridCacheAbstractPrimarySyncSelfTest.java | 6 +-
.../GridCacheBasicOpAbstractTest.java | 26 +-
.../GridCacheClientModesAbstractSelfTest.java | 20 +-
.../GridCacheEntrySetAbstractSelfTest.java | 2 +-
.../distributed/GridCacheLockAbstractTest.java | 6 +-
.../distributed/GridCacheMixedModeSelfTest.java | 4 +-
.../GridCacheMultiNodeAbstractTest.java | 10 +-
.../GridCacheMultiNodeLockAbstractTest.java | 27 +-
...dCacheMultithreadedFailoverAbstractTest.java | 2 +-
.../GridCacheNodeFailureAbstractTest.java | 9 +-
...ridCachePartitionNotLoadedEventSelfTest.java | 4 +-
...chePartitionedReloadAllAbstractSelfTest.java | 8 +-
.../GridCachePreloadEventsAbstractSelfTest.java | 4 +-
...GridCachePreloadRestartAbstractSelfTest.java | 1 -
.../GridCacheTransformEventSelfTest.java | 2 +-
...niteBinaryMetadataUpdateNodeRestartTest.java | 2 +-
.../distributed/IgniteCache150ClientsTest.java | 4 +-
...niteCacheClientNodeChangingTopologyTest.java | 130 +-
.../IgniteCacheClientNodeConcurrentStart.java | 2 +-
...teCacheClientNodePartitionsExchangeTest.java | 16 +-
.../IgniteCacheClientReconnectTest.java | 2 +-
.../IgniteCacheConnectionRecoveryTest.java | 2 +-
.../distributed/IgniteCacheCreatePutTest.java | 6 +-
.../distributed/IgniteCacheGetRestartTest.java | 2 +-
.../distributed/IgniteCacheManyClientsTest.java | 6 +-
.../IgniteCacheMessageRecoveryAbstractTest.java | 4 +-
...eCacheMessageRecoveryIdleConnectionTest.java | 2 +-
.../IgniteCacheNearRestartRollbackSelfTest.java | 6 +-
.../distributed/IgniteCachePrimarySyncTest.java | 4 +-
.../IgniteCacheReadFromBackupTest.java | 2 +-
.../IgniteCacheServerNodeConcurrentStart.java | 6 +-
.../IgniteCacheSingleGetMessageTest.java | 2 +-
.../IgniteCacheSizeFailoverTest.java | 6 +-
.../IgniteCacheSystemTransactionsSelfTest.java | 6 +-
.../IgniteNoClassOnServerAbstractTest.java | 2 +-
.../IgniteTxCachePrimarySyncTest.java | 45 +-
...teSynchronizationModesMultithreadedTest.java | 15 +-
...iteTxConsistencyRestartAbstractSelfTest.java | 12 +-
...xOriginatingNodeFailureAbstractSelfTest.java | 10 +-
...cOriginatingNodeFailureAbstractSelfTest.java | 22 +-
.../IgniteTxTimeoutAbstractTest.java | 2 +-
...heAbstractTransformWriteThroughSelfTest.java | 2 +-
.../dht/GridCacheAtomicNearCacheSelfTest.java | 50 +-
.../dht/GridCacheColocatedDebugTest.java | 112 +-
...eColocatedOptimisticTransactionSelfTest.java | 2 +-
...dCacheColocatedTxSingleThreadedSelfTest.java | 2 +-
.../dht/GridCacheDhtEntrySelfTest.java | 6 +-
...GridCacheDhtEvictionNearReadersSelfTest.java | 8 +-
.../dht/GridCacheDhtMappingSelfTest.java | 4 +-
.../dht/GridCacheDhtPreloadBigDataSelfTest.java | 10 +-
.../dht/GridCacheDhtPreloadDelayedSelfTest.java | 26 +-
.../GridCacheDhtPreloadDisabledSelfTest.java | 10 +-
.../GridCacheDhtPreloadMessageCountTest.java | 8 +-
.../dht/GridCacheDhtPreloadPutGetSelfTest.java | 4 +-
.../dht/GridCacheDhtPreloadSelfTest.java | 18 +-
.../GridCacheDhtPreloadStartStopSelfTest.java | 4 +-
.../dht/GridCacheDhtPreloadUnloadSelfTest.java | 24 +-
...ePartitionedNearDisabledMetricsSelfTest.java | 12 +-
...idCachePartitionedPreloadEventsSelfTest.java | 6 +-
...dCachePartitionedTopologyChangeSelfTest.java | 18 +-
...itionedTxOriginatingNodeFailureSelfTest.java | 10 +-
...ridCachePartitionedUnloadEventsSelfTest.java | 10 +-
.../dht/GridCacheTxNodeFailureSelfTest.java | 12 +-
.../IgniteCacheCommitDelayTxRecoveryTest.java | 22 +-
.../dht/IgniteCacheConcurrentPutGetRemove.java | 2 +-
.../IgniteCacheCrossCacheTxFailoverTest.java | 5 +-
.../dht/IgniteCacheLockFailoverSelfTest.java | 8 +-
.../dht/IgniteCacheMultiTxLockSelfTest.java | 3 +-
...artitionedBackupNodeFailureRecoveryTest.java | 6 +-
...ePrimaryNodeFailureRecoveryAbstractTest.java | 12 +-
.../IgniteCachePutRetryAbstractSelfTest.java | 8 +-
.../dht/IgniteCachePutRetryAtomicSelfTest.java | 4 +-
...gniteCachePutRetryTransactionalSelfTest.java | 6 +-
.../dht/IgniteCacheTxRecoveryRollbackTest.java | 20 +-
.../dht/IgniteTxReentryColocatedSelfTest.java | 2 +-
...eAtomicInvalidPartitionHandlingSelfTest.java | 12 +-
.../atomic/GridCacheAtomicPreloadSelfTest.java | 10 +-
.../atomic/IgniteCacheAtomicProtocolTest.java | 4 +-
...tomicClientOnlyMultiNodeFullApiSelfTest.java | 6 +-
...eAtomicNearOnlyMultiNodeFullApiSelfTest.java | 2 +-
...AtomicPartitionedTckMetricsSelfTestImpl.java | 8 +-
.../near/GridCacheGetStoreErrorSelfTest.java | 4 +-
.../near/GridCacheNearEvictionSelfTest.java | 6 +-
.../near/GridCacheNearMetricsSelfTest.java | 32 +-
.../near/GridCacheNearMultiGetSelfTest.java | 6 +-
.../near/GridCacheNearMultiNodeSelfTest.java | 14 +-
...idCacheNearOnlyMultiNodeFullApiSelfTest.java | 10 +-
.../near/GridCacheNearOnlyTopologySelfTest.java | 16 +-
.../GridCacheNearPartitionedClearSelfTest.java | 2 +-
.../GridCacheNearReaderPreloadSelfTest.java | 2 +-
.../near/GridCacheNearReadersSelfTest.java | 36 +-
.../near/GridCacheNearTxForceKeyTest.java | 8 +-
.../near/GridCacheNearTxMultiNodeSelfTest.java | 18 +-
...AffinityExcludeNeighborsPerformanceTest.java | 2 +-
.../GridCachePartitionedAffinitySelfTest.java | 8 +-
...ionedClientOnlyNoPrimaryFullApiSelfTest.java | 4 +-
.../GridCachePartitionedEvictionSelfTest.java | 2 +-
...titionedExplicitLockNodeFailureSelfTest.java | 4 +-
...GridCachePartitionedFilteredPutSelfTest.java | 2 +-
.../GridCachePartitionedFullApiSelfTest.java | 8 +-
...idCachePartitionedHitsAndMissesSelfTest.java | 5 +-
.../GridCachePartitionedLoadCacheSelfTest.java | 2 +-
...achePartitionedMultiNodeCounterSelfTest.java | 24 +-
...achePartitionedMultiNodeFullApiSelfTest.java | 34 +-
...ePartitionedMultiThreadedPutGetSelfTest.java | 8 +-
.../GridCachePartitionedNodeRestartTest.java | 1 -
...ePartitionedOptimisticTxNodeRestartTest.java | 1 -
.../GridCachePartitionedStorePutSelfTest.java | 6 +-
.../GridCachePartitionedTxSalvageSelfTest.java | 2 +-
...achePartitionedTxSingleThreadedSelfTest.java | 2 +-
.../near/GridCachePutArrayValueSelfTest.java | 2 +-
...idCacheRendezvousAffinityClientSelfTest.java | 2 +-
.../near/GridPartitionedBackupLoadSelfTest.java | 4 +-
.../near/IgniteCacheNearOnlyTxTest.java | 24 +-
.../near/IgniteCacheNearReadCommittedTest.java | 4 +-
.../near/IgniteTxReentryNearSelfTest.java | 2 +-
.../near/NearCacheMultithreadedUpdateTest.java | 8 +-
.../near/NearCachePutAllMultinodeTest.java | 4 +-
.../near/NearCacheSyncUpdateTest.java | 4 +-
.../near/NoneRebalanceModeSelfTest.java | 4 +-
...cingDelayedPartitionMapExchangeSelfTest.java | 8 +-
.../GridCacheRebalancingOrderingTest.java | 2 +-
.../GridCacheRebalancingSyncCheckDataTest.java | 6 +-
.../GridCacheRebalancingSyncSelfTest.java | 10 +-
...eRebalancingUnmarshallingFailedSelfTest.java | 2 +-
...stractReplicatedByteArrayValuesSelfTest.java | 2 +-
.../GridCacheReplicatedNodeRestartSelfTest.java | 2 -
.../GridCacheSyncReplicatedPreloadSelfTest.java | 14 +-
.../GridCacheReplicatedPreloadSelfTest.java | 50 +-
...eplicatedPreloadStartStopEventsSelfTest.java | 2 +-
.../cache/eviction/EvictionAbstractTest.java | 13 +-
...heConcurrentEvictionConsistencySelfTest.java | 2 +-
.../GridCacheConcurrentEvictionsSelfTest.java | 2 +-
.../GridCacheEmptyEntriesAbstractSelfTest.java | 2 +-
.../GridCacheEvictionFilterSelfTest.java | 4 +-
.../GridCacheEvictionTouchSelfTest.java | 8 +-
.../lru/LruNearEvictionPolicySelfTest.java | 7 +-
.../LruNearOnlyNearEvictionPolicySelfTest.java | 9 +-
.../paged/PageEvictionAbstractTest.java | 22 +-
...LruNearEnabledPageEvictionMultinodeTest.java | 28 +
...LruNearEnabledPageEvictionMultinodeTest.java | 28 +
.../SortedEvictionPolicyPerformanceTest.java | 2 +-
.../IgniteCacheClientNearCacheExpiryTest.java | 4 +-
.../IgniteCacheExpiryPolicyAbstractTest.java | 22 +-
...eCacheExpiryPolicyWithStoreAbstractTest.java | 6 +-
.../expiry/IgniteCacheLargeValueExpireTest.java | 4 +-
...eCacheOnlyOneTtlCleanupThreadExistsTest.java | 5 +-
.../expiry/IgniteCacheTtlCleanupSelfTest.java | 8 +-
.../IgniteCacheLoadAllAbstractTest.java | 2 +-
.../IgniteCacheStoreSessionAbstractTest.java | 5 +-
...acheStoreSessionWriteBehindAbstractTest.java | 2 +-
.../IgniteCacheTxStoreSessionTest.java | 22 +-
...dCacheAtomicLocalTckMetricsSelfTestImpl.java | 8 +-
.../GridCacheLocalByteArrayValuesSelfTest.java | 2 +-
.../local/GridCacheLocalFullApiSelfTest.java | 4 +-
.../cache/local/GridCacheLocalLockSelfTest.java | 6 +-
.../GridCacheLocalMultithreadedSelfTest.java | 2 +-
.../local/GridCacheLocalTxTimeoutSelfTest.java | 2 +-
.../BinaryTxCacheLocalEntriesSelfTest.java | 2 +-
.../cache/query/IndexingSpiQuerySelfTest.java | 4 +-
.../continuous/CacheContinuousBatchAckTest.java | 2 +-
...eContinuousQueryAsyncFilterListenerTest.java | 2 +-
...acheContinuousQueryExecuteInPrimaryTest.java | 2 +-
...ContinuousQueryFailoverAbstractSelfTest.java | 85 +-
...ontinuousQueryOperationFromCallbackTest.java | 2 +-
.../CacheContinuousQueryOperationP2PTest.java | 2 +-
.../CacheContinuousQueryOrderingEventTest.java | 2 +-
...acheContinuousQueryRandomOperationsTest.java | 2 +-
.../CacheKeepBinaryIterationTest.java | 2 +-
.../ClientReconnectContinuousQueryTest.java | 4 +-
...yRemoteFilterMissingInClassPathSelfTest.java | 2 +-
...ridCacheContinuousQueryAbstractSelfTest.java | 68 +-
...dCacheContinuousQueryNodesFilteringTest.java | 2 +-
...dCacheContinuousQueryReplicatedSelfTest.java | 8 +-
...eContinuousQueryReplicatedTxOneNodeTest.java | 4 +-
...CacheContinuousQueryClientReconnectTest.java | 6 +-
.../IgniteCacheContinuousQueryClientTest.java | 18 +-
...eCacheContinuousQueryImmutableEntryTest.java | 10 +-
...teCacheContinuousQueryNoUnsubscribeTest.java | 14 +-
...IgniteCacheContinuousQueryReconnectTest.java | 8 +-
...BehindStorePartitionedMultiNodeSelfTest.java | 6 +-
.../IgniteCacheWriteBehindNoUpdateSelfTest.java | 2 +-
...CacheClientWriteBehindStoreAbstractTest.java | 2 +-
...ClientWriteBehindStoreNonCoalescingTest.java | 2 +-
...DeadlockDetectionMessageMarshallingTest.java | 116 ++
.../TxDeadlockDetectionUnmasrhalErrorsTest.java | 225 ++
...simisticDeadlockDetectionCrossCacheTest.java | 3 +-
.../TxPessimisticDeadlockDetectionTest.java | 2 +-
.../CacheVersionedEntryAbstractTest.java | 10 +-
.../processors/database/BPlusTreeSelfTest.java | 101 +-
.../database/FreeListImplSelfTest.java | 26 +-
.../database/IgniteDbAbstractTest.java | 2 +-
.../database/IgniteDbDynamicCacheSelfTest.java | 7 +-
.../database/IgniteDbPutGetAbstractTest.java | 64 +-
.../database/MemoryMetricsSelfTest.java | 5 +-
.../database/MetadataStorageSelfTest.java | 22 +-
.../DataStreamProcessorSelfTest.java | 58 +-
.../datastreamer/DataStreamerImplSelfTest.java | 10 +-
.../DataStreamerMultiThreadedSelfTest.java | 2 +-
.../DataStreamerUpdateAfterLoadTest.java | 5 +-
.../IgniteDataStreamerPerformanceTest.java | 3 +-
...lockMessageSystemPoolStarvationSelfTest.java | 4 +-
.../processors/igfs/IgfsCacheSelfTest.java | 3 +-
.../igfs/IgfsDataManagerSelfTest.java | 3 +-
.../processors/igfs/IgfsIgniteMock.java | 7 -
.../igfs/IgfsMetaManagerSelfTest.java | 3 +-
.../processors/igfs/IgfsOneClientNodeTest.java | 7 +-
.../processors/igfs/IgfsProcessorSelfTest.java | 3 +-
.../processors/igfs/IgfsSizeSelfTest.java | 2 +-
.../processors/igfs/IgfsStartCacheTest.java | 4 +-
.../processors/igfs/IgfsStreamsSelfTest.java | 3 +-
.../processors/igfs/IgfsTaskSelfTest.java | 4 +-
.../IgfsAbstractRecordResolverSelfTest.java | 4 +-
.../odbc/OdbcEscapeSequenceSelfTest.java | 2 +-
.../cache/GridCacheCommandHandlerSelfTest.java | 4 +
.../query/GridQueryCommandHandlerTest.java | 2 +-
.../service/GridServiceClientNodeTest.java | 7 +-
.../GridServiceProcessorAbstractSelfTest.java | 2 +-
.../ServicePredicateAccessCacheTest.java | 2 +-
.../IgniteOffheapReadWriteLockSelfTest.java | 18 +-
.../loadtests/GridCacheMultiNodeLoadTest.java | 1 -
.../cache/GridCacheAbstractLoadTest.java | 5 +-
.../cache/GridCacheDataStructuresLoadTest.java | 2 +-
.../loadtests/cache/GridCacheLoadTest.java | 4 +-
.../capacity/GridCapacityLoadTest.java | 2 +-
.../capacity/spring-capacity-cache.xml | 5 +-
.../loadtests/colocation/spring-colocation.xml | 5 -
.../GridContinuousOperationsLoadTest.java | 2 +-
.../GridCachePartitionedAtomicLongLoadTest.java | 3 +-
...ridSingleSplitsNewNodesAbstractLoadTest.java | 11 +-
...idSingleSplitsNewNodesMulticastLoadTest.java | 9 +-
.../loadtests/discovery/GridGcTimeoutTest.java | 2 +-
.../marshaller/GridMarshallerAbstractTest.java | 10 +-
.../p2p/GridP2PSameClassLoaderSelfTest.java | 2 +-
.../platform/PlatformCacheWriteMetricsTask.java | 5 -
.../platform/PlatformComputeEchoTask.java | 11 +-
.../ignite/platform/PlatformSqlQueryTask.java | 2 +-
.../SecurityPermissionSetBuilderTest.java | 83 +-
.../CacheCheckpointSpiSecondCacheSelfTest.java | 7 +-
.../communication/GridCacheMessageSelfTest.java | 2 +-
.../tcp/GridCacheDhtLockBackupSelfTest.java | 6 +-
.../discovery/AbstractDiscoverySelfTest.java | 19 +-
...gniteClientReconnectMassiveShutdownTest.java | 4 +-
...lientDiscoverySpiFailureTimeoutSelfTest.java | 245 ++-
.../tcp/TcpClientDiscoverySpiSelfTest.java | 79 +-
.../tcp/TcpDiscoveryMultiThreadedTest.java | 12 +-
.../spi/discovery/tcp/TcpDiscoverySelfTest.java | 34 +-
.../tcp/TcpDiscoverySpiConfigSelfTest.java | 4 +-
.../TcpDiscoverySpiFailureTimeoutSelfTest.java | 51 +-
.../GridInternalTasksLoadBalancingSelfTest.java | 7 +-
.../stream/socket/SocketStreamerSelfTest.java | 6 +-
.../ignite/testframework/GridTestUtils.java | 2 +-
.../configvariations/ConfigVariations.java | 2 -
.../testframework/junits/GridAbstractTest.java | 18 +-
.../junits/common/GridCommonAbstractTest.java | 23 +-
.../multijvm/IgniteClusterProcessProxy.java | 9 +-
.../junits/multijvm/IgniteProcessProxy.java | 5 -
.../junits/spi/GridSpiAbstractTest.java | 5 +
.../testframework/test/ParametersTest.java | 7 +-
.../IgniteCacheEvictionSelfTestSuite.java | 4 +
.../testsuites/IgniteCacheTestSuite2.java | 2 +
.../ignite/testsuites/IgniteIgfsTestSuite.java | 2 +-
.../TxDeadlockDetectionTestSuite.java | 4 +
.../webapp/META-INF/ignite-webapp-config.xml | 13 -
modules/docker/2.0.0/Dockerfile | 46 +
modules/docker/2.0.0/run.sh | 51 +
modules/docker/Dockerfile | 2 +-
modules/extdata/p2p/pom.xml | 2 +-
.../tests/p2p/CacheDeploymentTestTask1.java | 2 +-
.../tests/p2p/CacheDeploymentTestTask3.java | 2 +-
.../p2p/GridP2PContinuousDeploymentTask1.java | 2 +-
.../CacheNoValueClassOnServerTestClient.java | 2 +-
.../extdata/uri/modules/uri-dependency/pom.xml | 2 +-
modules/extdata/uri/pom.xml | 2 +-
modules/flink/pom.xml | 2 +-
.../sink/flink/FlinkIgniteSinkSelfTest.java | 4 +-
modules/flume/pom.xml | 2 +-
modules/gce/pom.xml | 2 +-
modules/geospatial/pom.xml | 2 +-
.../query/h2/H2IndexingAbstractGeoSelfTest.java | 3 +-
modules/hadoop/pom.xml | 2 +-
.../resources/META-INF/classnames.properties | 1 +
.../hadoop/impl/HadoopAbstractSelfTest.java | 4 +-
modules/hibernate-4.2/README.txt | 48 +
modules/hibernate-4.2/licenses/apache-2.0.txt | 202 ++
modules/hibernate-4.2/pom.xml | 159 ++
.../HibernateAbstractRegionAccessStrategy.java | 102 +
.../hibernate/HibernateCollectionRegion.java | 100 +
.../cache/hibernate/HibernateEntityRegion.java | 112 +
.../hibernate/HibernateGeneralDataRegion.java | 76 +
.../cache/hibernate/HibernateKeyWrapper.java | 73 +
.../hibernate/HibernateNaturalIdRegion.java | 103 +
.../hibernate/HibernateQueryResultsRegion.java | 70 +
.../ignite/cache/hibernate/HibernateRegion.java | 99 +
.../cache/hibernate/HibernateRegionFactory.java | 179 ++
.../hibernate/HibernateTimestampsRegion.java | 39 +
.../HibernateTransactionalDataRegion.java | 84 +
.../ignite/cache/hibernate/package-info.java | 24 +
.../hibernate/CacheHibernateBlobStore.java | 542 +++++
.../CacheHibernateBlobStoreEntry.hbm.xml | 31 +
.../hibernate/CacheHibernateBlobStoreEntry.java | 89 +
.../CacheHibernateBlobStoreFactory.java | 235 +++
.../CacheHibernateStoreSessionListener.java | 222 ++
.../cache/store/hibernate/package-info.java | 22 +
.../src/test/config/factory-cache.xml | 59 +
.../src/test/config/factory-cache1.xml | 61 +
.../config/factory-incorrect-store-cache.xml | 56 +
.../HibernateL2CacheConfigurationSelfTest.java | 409 ++++
.../hibernate/HibernateL2CacheMultiJvmTest.java | 440 ++++
.../hibernate/HibernateL2CacheSelfTest.java | 1954 +++++++++++++++++
.../HibernateL2CacheTransactionalSelfTest.java | 154 ++
...nateL2CacheTransactionalUseSyncSelfTest.java | 31 +
.../CacheHibernateBlobStoreNodeRestartTest.java | 46 +
.../CacheHibernateBlobStoreSelfTest.java | 113 +
.../CacheHibernateStoreFactorySelfTest.java | 288 +++
...heHibernateStoreSessionListenerSelfTest.java | 238 +++
.../cache/store/hibernate/hibernate.cfg.xml | 42 +
.../cache/store/hibernate/package-info.java | 22 +
.../IgniteBinaryHibernateTestSuite.java | 37 +
.../testsuites/IgniteHibernateTestSuite.java | 57 +
modules/hibernate-5.1/README.txt | 48 +
modules/hibernate-5.1/licenses/apache-2.0.txt | 202 ++
modules/hibernate-5.1/pom.xml | 159 ++
.../HibernateAbstractRegionAccessStrategy.java | 103 +
.../hibernate/HibernateCollectionRegion.java | 114 +
.../cache/hibernate/HibernateEntityRegion.java | 128 ++
.../hibernate/HibernateGeneralDataRegion.java | 79 +
.../cache/hibernate/HibernateKeyWrapper.java | 109 +
.../hibernate/HibernateNaturalIdRegion.java | 113 +
.../hibernate/HibernateQueryResultsRegion.java | 70 +
.../ignite/cache/hibernate/HibernateRegion.java | 99 +
.../cache/hibernate/HibernateRegionFactory.java | 168 ++
.../hibernate/HibernateTimestampsRegion.java | 39 +
.../HibernateTransactionalDataRegion.java | 84 +
.../ignite/cache/hibernate/package-info.java | 24 +
.../hibernate/CacheHibernateBlobStore.java | 543 +++++
.../CacheHibernateBlobStoreEntry.hbm.xml | 31 +
.../hibernate/CacheHibernateBlobStoreEntry.java | 89 +
.../CacheHibernateBlobStoreFactory.java | 235 +++
.../CacheHibernateStoreSessionListener.java | 224 ++
.../cache/store/hibernate/package-info.java | 22 +
.../src/test/config/factory-cache.xml | 59 +
.../src/test/config/factory-cache1.xml | 61 +
.../config/factory-incorrect-store-cache.xml | 56 +
.../HibernateL2CacheConfigurationSelfTest.java | 407 ++++
.../hibernate/HibernateL2CacheMultiJvmTest.java | 429 ++++
.../hibernate/HibernateL2CacheSelfTest.java | 1960 ++++++++++++++++++
.../HibernateL2CacheTransactionalSelfTest.java | 154 ++
...nateL2CacheTransactionalUseSyncSelfTest.java | 31 +
.../CacheHibernateBlobStoreNodeRestartTest.java | 46 +
.../CacheHibernateBlobStoreSelfTest.java | 114 +
.../CacheHibernateStoreFactorySelfTest.java | 256 +++
...heHibernateStoreSessionListenerSelfTest.java | 242 +++
.../cache/store/hibernate/hibernate.cfg.xml | 42 +
.../cache/store/hibernate/package-info.java | 22 +
.../IgniteBinaryHibernate5TestSuite.java | 37 +
.../testsuites/IgniteHibernate5TestSuite.java | 57 +
modules/hibernate-core/pom.xml | 76 +
.../HibernateAccessStrategyAdapter.java | 340 +++
.../HibernateAccessStrategyFactory.java | 235 +++
.../cache/hibernate/HibernateCacheProxy.java | 801 +++++++
.../hibernate/HibernateExceptionConverter.java | 29 +
.../hibernate/HibernateKeyTransformer.java | 29 +
.../HibernateNonStrictAccessStrategy.java | 230 ++
.../HibernateReadOnlyAccessStrategy.java | 105 +
.../HibernateReadWriteAccessStrategy.java | 326 +++
.../HibernateTransactionalAccessStrategy.java | 141 ++
.../ignite/cache/hibernate/package-info.java | 24 +
modules/hibernate/README.txt | 48 -
modules/hibernate/licenses/apache-2.0.txt | 202 --
modules/hibernate/pom.xml | 146 --
.../HibernateAbstractRegionAccessStrategy.java | 98 -
.../HibernateAccessStrategyAdapter.java | 379 ----
.../cache/hibernate/HibernateCacheProxy.java | 801 -------
.../hibernate/HibernateCollectionRegion.java | 100 -
.../cache/hibernate/HibernateEntityRegion.java | 112 -
.../hibernate/HibernateGeneralDataRegion.java | 71 -
.../hibernate/HibernateKeyTransformer.java | 28 -
.../cache/hibernate/HibernateKeyWrapper.java | 72 -
.../hibernate/HibernateNaturalIdRegion.java | 100 -
.../HibernateNonStrictAccessStrategy.java | 222 --
.../hibernate/HibernateQueryResultsRegion.java | 70 -
.../HibernateReadOnlyAccessStrategy.java | 107 -
.../HibernateReadWriteAccessStrategy.java | 328 ---
.../ignite/cache/hibernate/HibernateRegion.java | 99 -
.../cache/hibernate/HibernateRegionFactory.java | 266 ---
.../hibernate/HibernateTimestampsRegion.java | 39 -
.../HibernateTransactionalAccessStrategy.java | 141 --
.../HibernateTransactionalDataRegion.java | 107 -
.../ignite/cache/hibernate/package-info.java | 24 -
.../hibernate/CacheHibernateBlobStore.java | 542 -----
.../CacheHibernateBlobStoreEntry.hbm.xml | 31 -
.../hibernate/CacheHibernateBlobStoreEntry.java | 89 -
.../CacheHibernateBlobStoreFactory.java | 235 ---
.../CacheHibernateStoreSessionListener.java | 222 --
.../cache/store/hibernate/package-info.java | 22 -
.../hibernate/src/test/config/factory-cache.xml | 59 -
.../src/test/config/factory-cache1.xml | 61 -
.../config/factory-incorrect-store-cache.xml | 56 -
.../HibernateL2CacheConfigurationSelfTest.java | 408 ----
.../hibernate/HibernateL2CacheSelfTest.java | 1949 -----------------
.../HibernateL2CacheTransactionalSelfTest.java | 154 --
...nateL2CacheTransactionalUseSyncSelfTest.java | 31 -
.../CacheHibernateBlobStoreNodeRestartTest.java | 46 -
.../CacheHibernateBlobStoreSelfTest.java | 113 -
.../CacheHibernateStoreFactorySelfTest.java | 285 ---
...heHibernateStoreSessionListenerSelfTest.java | 238 ---
.../cache/store/hibernate/hibernate.cfg.xml | 42 -
.../cache/store/hibernate/package-info.java | 22 -
.../IgniteBinaryHibernateTestSuite.java | 37 -
.../testsuites/IgniteHibernateTestSuite.java | 57 -
modules/hibernate5/README.txt | 48 -
modules/hibernate5/licenses/apache-2.0.txt | 202 --
modules/hibernate5/pom.xml | 146 --
.../HibernateAbstractRegionAccessStrategy.java | 99 -
.../HibernateAccessStrategyAdapter.java | 379 ----
.../cache/hibernate/HibernateCacheProxy.java | 801 -------
.../hibernate/HibernateCollectionRegion.java | 114 -
.../cache/hibernate/HibernateEntityRegion.java | 129 --
.../hibernate/HibernateGeneralDataRegion.java | 72 -
.../hibernate/HibernateKeyTransformer.java | 28 -
.../cache/hibernate/HibernateKeyWrapper.java | 108 -
.../hibernate/HibernateNaturalIdRegion.java | 113 -
.../HibernateNonStrictAccessStrategy.java | 222 --
.../hibernate/HibernateQueryResultsRegion.java | 70 -
.../HibernateReadOnlyAccessStrategy.java | 107 -
.../HibernateReadWriteAccessStrategy.java | 328 ---
.../ignite/cache/hibernate/HibernateRegion.java | 99 -
.../cache/hibernate/HibernateRegionFactory.java | 255 ---
.../hibernate/HibernateTimestampsRegion.java | 39 -
.../HibernateTransactionalAccessStrategy.java | 141 --
.../HibernateTransactionalDataRegion.java | 107 -
.../ignite/cache/hibernate/package-info.java | 24 -
.../hibernate/CacheHibernateBlobStore.java | 542 -----
.../CacheHibernateBlobStoreEntry.hbm.xml | 31 -
.../hibernate/CacheHibernateBlobStoreEntry.java | 89 -
.../CacheHibernateBlobStoreFactory.java | 235 ---
.../CacheHibernateStoreSessionListener.java | 223 --
.../cache/store/hibernate/package-info.java | 22 -
.../src/test/config/factory-cache.xml | 59 -
.../src/test/config/factory-cache1.xml | 61 -
.../config/factory-incorrect-store-cache.xml | 56 -
.../HibernateL2CacheConfigurationSelfTest.java | 409 ----
.../hibernate/HibernateL2CacheSelfTest.java | 1948 -----------------
.../HibernateL2CacheTransactionalSelfTest.java | 154 --
...nateL2CacheTransactionalUseSyncSelfTest.java | 31 -
.../CacheHibernateBlobStoreNodeRestartTest.java | 46 -
.../CacheHibernateBlobStoreSelfTest.java | 113 -
.../CacheHibernateStoreFactorySelfTest.java | 326 ---
...heHibernateStoreSessionListenerSelfTest.java | 241 ---
.../cache/store/hibernate/hibernate.cfg.xml | 42 -
.../cache/store/hibernate/package-info.java | 22 -
.../IgniteBinaryHibernate5TestSuite.java | 37 -
.../testsuites/IgniteHibernate5TestSuite.java | 57 -
modules/indexing/pom.xml | 2 +-
.../query/h2/DmlStatementsProcessor.java | 17 +-
.../processors/query/h2/IgniteH2Indexing.java | 237 ++-
.../query/h2/dml/UpdatePlanBuilder.java | 32 +-
.../query/h2/opt/GridH2AbstractKeyValueRow.java | 78 +-
.../query/h2/opt/GridH2CollocationModel.java | 4 +-
.../query/h2/opt/GridH2IndexBase.java | 15 +-
.../query/h2/opt/GridH2KeyValueRowOffheap.java | 6 +-
.../query/h2/opt/GridH2KeyValueRowOnheap.java | 6 +-
.../query/h2/opt/GridH2ProxyIndex.java | 204 ++
.../query/h2/opt/GridH2ProxySpatialIndex.java | 70 +
.../query/h2/opt/GridH2RowDescriptor.java | 67 +
.../processors/query/h2/opt/GridH2Table.java | 114 +-
.../query/h2/opt/GridLuceneIndex.java | 4 +-
.../processors/query/h2/sql/DmlAstUtils.java | 36 +-
.../query/h2/twostep/GridMapQueryExecutor.java | 5 +-
.../h2/twostep/GridReduceQueryExecutor.java | 222 +-
.../h2/twostep/msg/GridH2QueryRequest.java | 64 +-
.../cache/BinarySerializationQuerySelfTest.java | 5 +-
.../CacheBinaryKeyConcurrentQueryTest.java | 2 +-
.../cache/CacheIndexStreamerTest.java | 4 +-
.../CacheOffheapBatchIndexingBaseTest.java | 2 +-
.../CacheOperationsWithExpirationTest.java | 2 +-
.../cache/CacheQueryBuildValueTest.java | 4 +-
.../cache/CacheQueryEvictDataLostTest.java | 2 +-
.../cache/CacheQueryFilterExpiredTest.java | 2 +-
.../CacheRandomOperationsMultithreadedTest.java | 2 +-
...CacheScanPartitionQueryFallbackSelfTest.java | 12 +-
.../cache/CacheSqlQueryValueCopySelfTest.java | 18 +-
.../cache/GridCacheOffHeapSelfTest.java | 4 +-
.../GridCacheOffheapIndexEntryEvictTest.java | 4 +-
.../cache/GridCacheQuerySimpleBenchmark.java | 2 +-
.../cache/GridCacheQueryTestValue.java | 2 +-
.../cache/GridIndexingWithNoopSwapSelfTest.java | 2 +-
.../IgniteBinaryObjectFieldsQuerySelfTest.java | 9 +-
.../IgniteBinaryObjectQueryArgumentsTest.java | 8 +-
...eBinaryWrappedObjectFieldsQuerySelfTest.java | 3 +-
.../IgniteCacheAbstractFieldsQuerySelfTest.java | 44 +-
...niteCacheAbstractInsertSqlQuerySelfTest.java | 2 +-
.../cache/IgniteCacheAbstractQuerySelfTest.java | 6 +-
.../IgniteCacheAbstractSqlDmlQuerySelfTest.java | 2 +-
.../IgniteCacheCollocatedQuerySelfTest.java | 6 +-
...acheConfigurationPrimitiveTypesSelfTest.java | 14 +-
.../IgniteCacheCrossCacheJoinRandomTest.java | 2 +-
.../IgniteCacheDeleteSqlQuerySelfTest.java | 6 +-
...acheDistributedJoinCollocatedAndNotTest.java | 2 +-
...acheDistributedJoinCustomAffinityMapper.java | 2 +-
.../IgniteCacheDistributedJoinNoIndexTest.java | 2 +-
...ributedJoinPartitionedAndReplicatedTest.java | 2 +-
...CacheDistributedJoinQueryConditionsTest.java | 2 +-
.../cache/IgniteCacheDistributedJoinTest.java | 12 +-
.../IgniteCacheFieldsQueryNoDataSelfTest.java | 2 +-
...teCacheFullTextQueryNodeJoiningSelfTest.java | 6 +-
...PartitionedAndReplicatedCollocationTest.java | 2 +-
...teCacheJoinPartitionedAndReplicatedTest.java | 59 +-
...IgniteCacheJoinQueryWithAffinityKeyTest.java | 22 +-
.../cache/IgniteCacheLargeResultSelfTest.java | 4 +-
...eLockPartitionOnAffinityRunAbstractTest.java | 4 +
.../IgniteCacheMultipleIndexedTypesTest.java | 2 +-
.../IgniteCacheObjectKeyIndexingSelfTest.java | 6 +-
.../cache/IgniteCacheOffheapEvictQueryTest.java | 2 +-
.../cache/IgniteCacheOffheapIndexScanTest.java | 4 +-
...hePartitionedQueryMultiThreadedSelfTest.java | 4 +-
.../cache/IgniteCacheQueriesLoadTest1.java | 2 +-
.../IgniteCacheQueryH2IndexingLeakTest.java | 4 +-
.../cache/IgniteCacheQueryIndexSelfTest.java | 4 +-
.../cache/IgniteCacheQueryLoadSelfTest.java | 14 +-
.../IgniteCacheQueryMultiThreadedSelfTest.java | 15 +-
...gniteCacheSqlQueryMultiThreadedSelfTest.java | 6 +-
.../IgniteCacheStarvationOnRebalanceTest.java | 2 +-
.../IgniteCacheUpdateSqlQuerySelfTest.java | 8 +-
...ClientReconnectCacheQueriesFailoverTest.java | 10 +-
.../cache/IgniteCrossCachesJoinsQueryTest.java | 79 +-
.../cache/QueryEntityCaseMismatchTest.java | 2 +-
.../cache/SqlFieldsQuerySelfTest.java | 2 +-
...stributedPartitionQueryAbstractSelfTest.java | 652 ++++++
...utedPartitionQueryConfigurationSelfTest.java | 92 +
...butedPartitionQueryNodeRestartsSelfTest.java | 114 +
...eCacheDistributedPartitionQuerySelfTest.java | 90 +
...niteCacheDistributedQueryCancelSelfTest.java | 6 +-
...butedQueryStopOnCancelOrTimeoutSelfTest.java | 6 +-
.../IgniteCachePartitionedQuerySelfTest.java | 2 +-
.../IgniteCacheQueryNoRebalanceSelfTest.java | 4 +-
.../near/IgniteCacheQueryNodeFailTest.java | 4 +-
.../IgniteCacheQueryNodeRestartSelfTest.java | 2 +-
.../IgniteCacheQueryNodeRestartSelfTest2.java | 7 +-
.../cache/index/AbstractSchemaSelfTest.java | 3 +
.../DynamicIndexAbstractConcurrentSelfTest.java | 5 +-
.../index/DynamicIndexAbstractSelfTest.java | 9 +-
...eCacheLocalQueryCancelOrTimeoutSelfTest.java | 6 +-
.../cache/ttl/CacheTtlAbstractSelfTest.java | 6 +-
.../query/IgniteQueryDedicatedPoolTest.java | 2 +-
.../query/IgniteSqlDistributedJoinSelfTest.java | 2 +-
.../query/IgniteSqlKeyValueFieldsTest.java | 392 ++++
.../query/IgniteSqlSchemaIndexingTest.java | 2 +-
.../query/IgniteSqlSplitterSelfTest.java | 10 +-
.../h2/GridIndexingSpiAbstractSelfTest.java | 14 +-
.../query/h2/IgniteSqlQueryMinMaxTest.java | 4 +-
.../h2/database/InlineIndexHelperTest.java | 40 +-
.../query/h2/sql/GridQueryParsingTest.java | 9 +-
.../IgniteCacheQuerySelfTestSuite.java | 8 +
modules/jcl/pom.xml | 2 +-
modules/jms11/pom.xml | 2 +-
.../stream/jms11/IgniteJmsStreamerTest.java | 28 +-
modules/jta/pom.xml | 2 +-
...CacheJtaConfigurationValidationSelfTest.java | 2 +-
...CacheJtaFactoryConfigValidationSelfTest.java | 2 +-
...titionedCacheJtaLookupClassNameSelfTest.java | 2 +-
modules/kafka/pom.xml | 2 +-
.../kafka/KafkaIgniteStreamerSelfTest.java | 8 +-
modules/kubernetes/pom.xml | 2 +-
modules/log4j/pom.xml | 2 +-
modules/log4j2/pom.xml | 2 +-
modules/mesos/pom.xml | 2 +-
.../apache/ignite/mesos/IgniteFramework.java | 111 +-
.../ignite/mesos/IgniteSchedulerSelfTest.java | 39 +-
modules/ml/pom.xml | 6 +-
.../org/apache/ignite/ml/math/Precision.java | 588 ++++++
.../java/org/apache/ignite/ml/math/Tracer.java | 35 +-
.../decompositions/CholeskyDecomposition.java | 6 +-
.../math/decompositions/EigenDecomposition.java | 6 +-
.../ml/math/decompositions/LUDecomposition.java | 9 +-
.../ml/math/decompositions/QRDecomposition.java | 70 +-
.../SingularValueDecomposition.java | 5 +-
.../math/exceptions/CardinalityException.java | 6 +-
.../exceptions/InsufficientDataException.java | 44 +
.../exceptions/MathArithmeticException.java | 47 +
.../MathIllegalArgumentException.java | 37 +
.../math/exceptions/MathRuntimeException.java | 47 +
.../ml/math/exceptions/NoDataException.java | 45 +
.../NonPositiveDefiniteMatrixException.java | 8 +-
.../exceptions/NonSquareMatrixException.java | 33 +
.../math/exceptions/NullArgumentException.java | 27 +
.../exceptions/SingularMatrixException.java | 9 +-
.../ignite/ml/math/functions/Functions.java | 5 +
.../apache/ignite/ml/math/impls/CacheUtils.java | 111 +-
.../ml/math/impls/matrix/AbstractMatrix.java | 5 +
.../impls/matrix/DenseLocalOffHeapMatrix.java | 5 -
.../impls/matrix/SparseDistributedMatrix.java | 16 +-
.../matrix/SparseDistributedMatrixStorage.java | 92 +-
.../math/impls/vector/SingleElementVector.java | 103 +-
.../apache/ignite/ml/math/util/MatrixUtil.java | 121 ++
.../AbstractMultipleLinearRegression.java | 358 ++++
.../regressions/MultipleLinearRegression.java | 71 +
.../OLSMultipleLinearRegression.java | 272 +++
.../regressions/RegressionsErrorMessages.java | 28 +
.../ignite/ml/regressions/package-info.java | 22 +
.../java/org/apache/ignite/ml/TestUtils.java | 248 +++
.../apache/ignite/ml/math/ExternalizeTest.java | 1 +
.../ignite/ml/math/MathImplLocalTestSuite.java | 7 +-
.../ignite/ml/math/MathImplMainTestSuite.java | 5 +-
.../CholeskyDecompositionTest.java | 6 +-
.../decompositions/LUDecompositionTest.java | 6 +-
.../decompositions/QRDecompositionTest.java | 6 +-
.../SingularValueDecompositionTest.java | 6 +-
.../matrix/SparseDistributedMatrixTest.java | 67 +-
.../AbstractMultipleLinearRegressionTest.java | 164 ++
.../OLSMultipleLinearRegressionTest.java | 812 ++++++++
modules/mqtt/pom.xml | 2 +-
.../stream/mqtt/IgniteMqttStreamerTest.java | 12 +-
modules/osgi-karaf/pom.xml | 2 +-
.../osgi-karaf/src/main/resources/features.xml | 2 +-
modules/osgi-paxlogging/pom.xml | 2 +-
modules/osgi/README.txt | 30 -
modules/osgi/pom.xml | 2 +-
modules/platforms/cpp/common/configure.ac | 2 +-
.../platforms/cpp/common/include/Makefile.am | 5 +-
.../cpp/common/include/ignite/common/promise.h | 201 ++
.../common/include/ignite/common/shared_state.h | 331 +++
.../cpp/common/include/ignite/future.h | 236 +++
.../cpp/common/include/ignite/ignite_error.h | 3 +
.../linux/include/ignite/common/concurrent_os.h | 234 ++-
.../win/include/ignite/common/concurrent_os.h | 169 +-
.../common/os/win/src/common/concurrent_os.cpp | 26 +-
.../cpp/common/project/vs/common.vcxproj | 3 +
.../common/project/vs/common.vcxproj.filters | 9 +
modules/platforms/cpp/configure.ac | 2 +-
modules/platforms/cpp/configure.acrel | 2 +-
modules/platforms/cpp/core-test/Makefile.am | 1 +
.../cpp/core-test/config/cache-identity-32.xml | 7 +-
.../cpp/core-test/config/cache-query-32.xml | 6 +-
.../config/cache-query-continuous-32.xml | 6 +-
.../config/cache-query-continuous-default.xml | 1 -
.../core-test/config/cache-query-default.xml | 6 +
.../cpp/core-test/config/cache-store-32.xml | 6 +-
.../cpp/core-test/config/cache-test-32.xml | 6 +-
modules/platforms/cpp/core-test/configure.ac | 2 +-
.../cpp/core-test/project/vs/core-test.vcxproj | 1 +
.../project/vs/core-test.vcxproj.filters | 4 +
.../cpp/core-test/src/cache_query_test.cpp | 82 +
.../cpp/core-test/src/concurrent_test.cpp | 47 +
.../platforms/cpp/core-test/src/future_test.cpp | 474 +++++
modules/platforms/cpp/core/configure.ac | 2 +-
modules/platforms/cpp/examples/configure.ac | 2 +-
.../putget-example/config/example-cache.xml | 10 +-
.../project/vs/putget-example.vcxproj | 3 +
.../project/vs/putget-example.vcxproj.filters | 8 +
.../putget-example/src/putget_example.cpp | 2 +-
.../project/vs/query-example.vcxproj | 3 +
.../project/vs/query-example.vcxproj.filters | 8 +
modules/platforms/cpp/ignite/configure.ac | 2 +-
.../cpp/odbc-test/config/queries-default.xml | 5 +
.../cpp/odbc-test/config/queries-test-32.xml | 6 +-
.../odbc-test/config/queries-test-noodbc-32.xml | 6 +-
.../cpp/odbc-test/include/complex_type.h | 25 +
.../cpp/odbc-test/src/configuration_test.cpp | 3 +-
.../cpp/odbc-test/src/queries_test.cpp | 210 +-
.../odbc/include/ignite/odbc/protocol_version.h | 14 +-
.../cpp/odbc/install/ignite-odbc-amd64.wxs | 2 +-
.../cpp/odbc/install/ignite-odbc-x86.wxs | 2 +-
.../src/system/ui/dsn_configuration_window.cpp | 32 +-
.../platforms/cpp/odbc/src/protocol_version.cpp | 16 +-
.../Properties/AssemblyInfo.cs | 6 +-
.../Properties/AssemblyInfo.cs | 6 +-
.../Properties/AssemblyInfo.cs | 6 +-
.../Config/ignite-config.xml | 1 -
.../Properties/AssemblyInfo.cs | 6 +-
.../Properties/AssemblyInfo.cs | 6 +-
.../Binary/BinaryCompactFooterInteropTest.cs | 2 +-
.../Binary/BinaryDynamicRegistrationTest.cs | 18 +-
.../Binary/JavaBinaryInteropTest.cs | 6 +-
.../BinaryConfigurationTest.cs | 2 +-
.../Cache/Affinity/AffinityFieldTest.cs | 4 +-
.../Cache/Affinity/AffinityTest.cs | 4 +-
.../Cache/CacheConfigurationTest.cs | 24 +-
.../Cache/CacheForkedTest.cs | 2 +-
.../Cache/CacheMetricsTest.cs | 4 +-
.../Cache/CacheNearTest.cs | 34 +-
.../Cache/Query/CacheLinqTest.cs | 30 +-
.../Cache/Query/CacheQueriesTest.cs | 52 +
.../Compute/BinarizableClosureTaskTest.cs | 10 +-
.../Compute/CancellationTest.cs | 4 +-
.../Compute/ComputeApiTest.cs | 56 +-
.../Compute/FailoverTaskSelfTest.cs | 46 +-
.../Compute/IgniteExceptionTaskSelfTest.cs | 105 +-
.../Compute/SerializableClosureTaskTest.cs | 30 +-
.../Config/Compute/compute-grid1.xml | 4 +-
.../Config/Compute/compute-grid2.xml | 1 -
.../Config/Compute/compute-standalone.xml | 4 +-
.../Config/Dynamic/dynamic-data.xml | 2 -
.../Config/cache-binarizables.xml | 4 +-
.../Config/cache-query-continuous.xml | 4 -
.../native-client-test-cache-affinity.xml | 1 +
.../Config/native-client-test-cache.xml | 9 -
.../Config/spring-test.xml | 14 +
.../Apache.Ignite.Core.Tests/EventsTest.cs | 13 +-
.../IgniteConfigurationSerializerTest.cs | 26 +-
.../IgniteConfigurationTest.cs | 41 +-
.../IgniteStartStopTest.cs | 2 +-
.../Log/CustomLoggerTest.cs | 3 +-
.../Apache.Ignite.Core.Tests/MarshallerTest.cs | 24 +-
.../Properties/AssemblyInfo.cs | 6 +-
.../Apache.Ignite.Core.Tests/TestUtils.cs | 4 +-
.../Cache/Configuration/CacheConfiguration.cs | 15 -
.../Cache/Configuration/DataPageEvictionMode.cs | 4 +-
.../Cache/Configuration/MemoryConfiguration.cs | 35 +-
.../Configuration/MemoryPolicyConfiguration.cs | 37 +-
.../Configuration/NearCacheConfiguration.cs | 2 +-
.../Cache/Configuration/QueryEntity.cs | 20 +
.../Apache.Ignite.Core/Cache/ICacheMetrics.cs | 8 -
.../Compute/ComputeTaskAdapter.cs | 4 +-
.../Discovery/Tcp/TcpDiscoverySpi.cs | 43 -
.../dotnet/Apache.Ignite.Core/IIgnite.cs | 3 +-
.../Apache.Ignite.Core/IgniteConfiguration.cs | 21 +
.../IgniteConfigurationSection.xsd | 62 +-
.../Impl/Cache/CacheMetricsImpl.cs | 7 -
.../Closure/ComputeAbstractClosureTask.cs | 3 +-
.../Apache.Ignite.Core/Impl/Compute/Compute.cs | 29 +
.../Impl/Compute/ComputeImpl.cs | 2 +
.../Impl/Compute/ComputeJobHolder.cs | 3 +-
.../Impl/Compute/ComputeTaskHolder.cs | 8 +-
.../dotnet/Apache.Ignite.Core/Impl/Ignite.cs | 14 +
.../Apache.Ignite.Core/Impl/NativeMethods.cs | 44 +
.../Properties/AssemblyInfo.cs | 6 +-
.../Properties/AssemblyInfo.cs | 6 +-
.../Properties/AssemblyInfo.cs | 6 +-
.../Impl/CacheQueryExpressionVisitor.cs | 14 +-
.../Impl/CacheQueryModelVisitor.cs | 12 +-
.../Properties/AssemblyInfo.cs | 6 +-
.../Properties/AssemblyInfo.cs | 6 +-
.../Properties/AssemblyInfo.cs | 6 +-
.../Apache.Ignite/Properties/AssemblyInfo.cs | 6 +-
.../Datagrid/MultiTieredCacheExample.cs | 2 +-
.../Properties/AssemblyInfo.cs | 6 +-
.../Properties/AssemblyInfo.cs | 6 +-
modules/rest-http/pom.xml | 2 +-
.../http/jetty/GridJettyObjectMapper.java | 13 +-
modules/rocketmq/README.txt | 25 +
modules/rocketmq/licenses/apache-2.0.txt | 202 ++
modules/rocketmq/pom.xml | 81 +
.../stream/rocketmq/RocketMQStreamer.java | 151 ++
.../ignite/stream/rocketmq/package-info.java | 21 +
.../stream/rocketmq/RocketMQStreamerTest.java | 214 ++
.../rocketmq/RocketMQStreamerTestSuite.java | 37 +
.../stream/rocketmq/TestRocketMQServer.java | 148 ++
.../ignite/stream/rocketmq/package-info.java | 21 +
modules/scalar-2.10/pom.xml | 2 +-
modules/scalar/pom.xml | 2 +-
.../scala/org/apache/ignite/scalar/scalar.scala | 19 +-
.../scalar/src/test/resources/spring-cache.xml | 4 +-
.../scalar/tests/ScalarCacheQueriesSpec.scala | 2 +-
modules/schedule/pom.xml | 2 +-
modules/slf4j/pom.xml | 2 +-
modules/spark-2.10/pom.xml | 2 +-
modules/spark/pom.xml | 2 +-
.../spark/JavaEmbeddedIgniteRDDSelfTest.java | 2 +-
.../spark/JavaStandaloneIgniteRDDSelfTest.java | 2 +-
modules/spring-data/pom.xml | 5 +-
modules/spring/pom.xml | 2 +-
.../spring/GridSpringCacheManagerSelfTest.java | 6 +-
.../jdbc/CacheJdbcBlobStoreFactorySelfTest.java | 2 +-
.../jdbc/CacheJdbcPojoStoreFactorySelfTest.java | 4 +-
.../internal/IgniteDynamicCacheConfigTest.java | 2 +-
.../java/org/apache/ignite/internal/cache.xml | 3 -
.../apache/ignite/internal/filtered-cache.xml | 3 -
.../apache/ignite/internal/invalid-cache.xml | 6 -
.../GridTransformSpringInjectionSelfTest.java | 2 +-
.../p2p/GridP2PUserVersionChangeSelfTest.java | 8 +-
.../IgniteStartFromStreamConfigurationTest.java | 4 +-
.../org/apache/ignite/spring/sprint-exclude.xml | 2 -
.../GridSpringTransactionManagerSelfTest.java | 2 +-
modules/ssh/pom.xml | 2 +-
modules/storm/pom.xml | 2 +-
modules/tools/pom.xml | 2 +-
modules/twitter/pom.xml | 2 +-
.../twitter/IgniteTwitterStreamerTest.java | 8 +-
modules/urideploy/pom.xml | 2 +-
.../ignite/p2p/GridP2PDisabledSelfTest.java | 4 +-
modules/visor-console-2.10/pom.xml | 2 +-
modules/visor-console/pom.xml | 2 +-
.../visor/commands/ack/VisorAckCommand.scala | 5 +-
.../commands/cache/VisorCacheClearCommand.scala | 5 +-
.../commands/cache/VisorCacheCommand.scala | 2 -
.../commands/cache/VisorCacheResetCommand.scala | 4 +-
.../commands/cache/VisorCacheStopCommand.scala | 4 +-
.../config/VisorConfigurationCommand.scala | 2 +-
.../scala/org/apache/ignite/visor/visor.scala | 5 +-
.../cache/VisorCacheClearCommandSpec.scala | 24 +-
.../commands/cache/VisorCacheCommandSpec.scala | 2 +-
.../cache/VisorCacheResetCommandSpec.scala | 8 +-
modules/visor-plugins/pom.xml | 2 +-
.../web-console/backend/app/browsersHandler.js | 13 +-
modules/web-console/backend/app/mongo.js | 77 +-
modules/web-console/frontend/app/app.config.js | 4 +-
modules/web-console/frontend/app/app.js | 8 +-
.../cluster-select/cluster-select.pug | 3 +-
.../list-of-registered-users.column-defs.js | 26 +-
.../list-of-registered-users.controller.js | 163 +-
.../list-of-registered-users.tpl.pug | 25 +-
.../frontend/app/data/event-groups.json | 14 -
.../frontend/app/filters/byName.filter.js | 4 +-
.../app/filters/domainsValidation.filter.js | 4 +-
.../frontend/app/filters/duration.filter.js | 4 +-
.../frontend/app/filters/hasPojo.filter.js | 4 +-
.../app/helpers/jade/form/form-field-text.pug | 55 +-
.../frontend/app/helpers/jade/mixins.pug | 20 +-
.../app/modules/agent/AgentManager.service.js | 96 +-
.../frontend/app/modules/cluster/Cache.js | 4 -
.../app/modules/cluster/CacheMetrics.js | 4 -
.../modules/configuration/Version.service.js | 2 +-
.../generator/ConfigurationGenerator.js | 17 +-
.../generator/PlatformGenerator.js | 10 +-
.../generator/Properties.service.js | 63 +-
.../generator/defaults/Cache.service.js | 3 -
.../generator/defaults/Cluster.service.js | 4 +-
.../generator/defaults/IGFS.service.js | 1 -
.../frontend/app/modules/demo/Demo.module.js | 4 +-
.../frontend/app/modules/sql/sql.controller.js | 12 +-
.../states/configuration/caches/memory.pug | 9 -
.../states/configuration/caches/query.pug | 6 -
.../states/configuration/clusters/discovery.pug | 8 +-
.../states/configuration/domains/general.pug | 4 +-
.../states/configuration/domains/query.pug | 2 +
.../modules/states/configuration/igfs/misc.pug | 2 -
.../configuration/summary/summary.controller.js | 2 +-
.../frontend/app/primitives/badge/index.scss | 1 +
.../frontend/app/primitives/btn/index.scss | 24 +-
.../frontend/app/primitives/dropdown/index.pug | 2 +-
.../frontend/app/primitives/dropdown/index.scss | 26 +-
.../frontend/app/primitives/panel/index.scss | 2 +-
.../app/primitives/ui-grid-header/index.scss | 10 +-
.../app/primitives/ui-grid-header/index.tpl.pug | 10 +-
.../app/primitives/ui-grid-settings/index.scss | 58 +-
.../frontend/app/primitives/ui-grid/index.scss | 149 +-
.../frontend/controllers/domains-controller.js | 28 +-
.../frontend/gulpfile.babel.js/paths.js | 1 +
.../frontend/gulpfile.babel.js/tasks/bundle.js | 2 +-
.../webpack/environments/development.js | 4 +-
.../frontend/public/images/icons/cross.svg | 1 +
.../frontend/public/images/icons/export.svg | 1 +
.../frontend/public/images/icons/gear.svg | 1 +
.../stylesheets/_bootstrap-variables.scss | 4 +-
.../frontend/test/karma.conf.babel.js | 6 +
.../views/configuration/domains-import.tpl.pug | 11 +-
modules/web-console/licenses/cc-by-3.0.txt | 319 +++
modules/web-console/pom.xml | 2 +-
modules/web-console/web-agent/pom.xml | 4 +-
.../ignite/console/agent/AgentLauncher.java | 10 +-
.../console/agent/handlers/ClusterListener.java | 2 +-
.../agent/handlers/DatabaseListener.java | 24 +-
.../console/agent/handlers/DemoListener.java | 2 +-
.../ignite/console/agent/rest/RestExecutor.java | 2 +-
.../demo/service/DemoCachesLoadService.java | 1 -
.../service/DemoRandomCacheLoadService.java | 1 -
modules/web/ignite-appserver-test/pom.xml | 2 +-
modules/web/ignite-websphere-test/pom.xml | 2 +-
modules/web/pom.xml | 2 +-
.../webapp2/META-INF/ignite-webapp-config.xml | 13 -
.../config/ignite-base-load-config.xml | 31 +
modules/yardstick/pom.xml | 2 +-
modules/yarn/pom.xml | 2 +-
modules/zeromq/pom.xml | 2 +-
.../stream/zeromq/IgniteZeroMqStreamerTest.java | 12 +-
modules/zookeeper/pom.xml | 2 +-
.../tcp/ipfinder/zk/ZookeeperIpFinderTest.java | 5 +-
parent/pom.xml | 6 +
pom.xml | 53 +-
1504 files changed, 41163 insertions(+), 27558 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/658aadc5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/658aadc5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
----------------------------------------------------------------------
[36/50] [abbrv] ignite git commit: IGNITE-5164: ODBC: renamed classes
which is obviously common with JDBC.
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/c7f09d8a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerQueryCloseRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerQueryCloseRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerQueryCloseRequest.java
new file mode 100644
index 0000000..74361c6
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerQueryCloseRequest.java
@@ -0,0 +1,49 @@
+/*
+ * 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.odbc;
+
+import org.apache.ignite.internal.util.typedef.internal.S;
+
+/**
+ * SQL listener query close request.
+ */
+public class SqlListenerQueryCloseRequest extends SqlListenerRequest {
+ /** Query ID. */
+ private final long queryId;
+
+ /**
+ * @param queryId Query ID.
+ */
+ public SqlListenerQueryCloseRequest(long queryId) {
+ super(QRY_CLOSE);
+
+ this.queryId = queryId;
+ }
+
+ /**
+ * @return Query ID.
+ */
+ public long queryId() {
+ return queryId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(SqlListenerQueryCloseRequest.class, this);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/c7f09d8a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerQueryCloseResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerQueryCloseResult.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerQueryCloseResult.java
new file mode 100644
index 0000000..2558a85
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerQueryCloseResult.java
@@ -0,0 +1,40 @@
+/*
+ * 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.odbc;
+
+/**
+ * SQL listener query close result.
+ */
+public class SqlListenerQueryCloseResult {
+ /** Query ID. */
+ private final long queryId;
+
+ /**
+ * @param queryId Query ID.
+ */
+ public SqlListenerQueryCloseResult(long queryId){
+ this.queryId = queryId;
+ }
+
+ /**
+ * @return Query ID.
+ */
+ public long getQueryId() {
+ return queryId;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/c7f09d8a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerQueryExecuteRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerQueryExecuteRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerQueryExecuteRequest.java
new file mode 100644
index 0000000..3c77e06
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerQueryExecuteRequest.java
@@ -0,0 +1,78 @@
+/*
+ * 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.odbc;
+
+import org.apache.ignite.internal.util.tostring.GridToStringExclude;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * SQL listener query execute request.
+ */
+public class SqlListenerQueryExecuteRequest extends SqlListenerRequest {
+ /** Cache name. */
+ private final String cacheName;
+
+ /** Sql query. */
+ @GridToStringInclude(sensitive = true)
+ private final String sqlQry;
+
+ /** Sql query arguments. */
+ @GridToStringExclude
+ private final Object[] args;
+
+ /**
+ * @param cacheName Cache name.
+ * @param sqlQry SQL query.
+ * @param args Arguments list.
+ */
+ public SqlListenerQueryExecuteRequest(String cacheName, String sqlQry, Object[] args) {
+ super(QRY_EXEC);
+
+ this.cacheName = cacheName.isEmpty() ? null : cacheName;
+ this.sqlQry = sqlQry;
+ this.args = args;
+ }
+
+ /**
+ * @return Sql query.
+ */
+ public String sqlQuery() {
+ return sqlQry;
+ }
+
+ /**
+ * @return Sql query arguments.
+ */
+ public Object[] arguments() {
+ return args;
+ }
+
+ /**
+ * @return Cache name.
+ */
+ @Nullable public String cacheName() {
+ return cacheName;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(SqlListenerQueryExecuteRequest.class, this, "args", args, true);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/c7f09d8a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerQueryExecuteResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerQueryExecuteResult.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerQueryExecuteResult.java
new file mode 100644
index 0000000..e4c0cb9
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerQueryExecuteResult.java
@@ -0,0 +1,54 @@
+/*
+ * 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.odbc;
+
+import java.util.Collection;
+
+/**
+ * SQL listener query execute result.
+ */
+public class SqlListenerQueryExecuteResult {
+ /** Query ID. */
+ private final long queryId;
+
+ /** Fields metadata. */
+ private final Collection<SqlListenerColumnMeta> columnsMeta;
+
+ /**
+ * @param queryId Query ID.
+ * @param columnsMeta Columns metadata.
+ */
+ public SqlListenerQueryExecuteResult(long queryId, Collection<SqlListenerColumnMeta> columnsMeta) {
+ this.queryId = queryId;
+ this.columnsMeta = columnsMeta;
+ }
+
+ /**
+ * @return Query ID.
+ */
+ public long getQueryId() {
+ return queryId;
+ }
+
+ /**
+ * @return Columns metadata.
+ */
+ public Collection<SqlListenerColumnMeta> getColumnsMetadata() {
+ return columnsMeta;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/c7f09d8a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerQueryFetchRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerQueryFetchRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerQueryFetchRequest.java
new file mode 100644
index 0000000..41c3be0
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerQueryFetchRequest.java
@@ -0,0 +1,61 @@
+/*
+ * 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.odbc;
+
+import org.apache.ignite.internal.util.typedef.internal.S;
+
+/**
+ * SQL listener query fetch request.
+ */
+public class SqlListenerQueryFetchRequest extends SqlListenerRequest {
+ /** Query ID. */
+ private final long queryId;
+
+ /** Page size - maximum number of rows to return. */
+ private final int pageSize;
+
+ /**
+ * @param queryId Query ID.
+ * @param pageSize Page size.
+ */
+ public SqlListenerQueryFetchRequest(long queryId, int pageSize) {
+ super(QRY_FETCH);
+
+ this.queryId = queryId;
+ this.pageSize = pageSize;
+ }
+
+ /**
+ * @return Page size.
+ */
+ public int pageSize() {
+ return pageSize;
+ }
+
+ /**
+ * @return Query ID.
+ */
+ public long queryId() {
+ return queryId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(SqlListenerQueryFetchRequest.class, this);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/c7f09d8a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerQueryFetchResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerQueryFetchResult.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerQueryFetchResult.java
new file mode 100644
index 0000000..6763f8b
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerQueryFetchResult.java
@@ -0,0 +1,66 @@
+/*
+ * 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.odbc;
+
+import java.util.Collection;
+
+/**
+ * SQL listener query fetch result.
+ */
+public class SqlListenerQueryFetchResult {
+ /** Query ID. */
+ private final long queryId;
+
+ /** Query result rows. */
+ private final Collection<?> items;
+
+ /** Flag indicating the query has no unfetched results. */
+ private final boolean last;
+
+ /**
+ * @param queryId Query ID.
+ * @param items Query result rows.
+ * @param last Flag indicating the query has no unfetched results.
+ */
+ public SqlListenerQueryFetchResult(long queryId, Collection<?> items, boolean last){
+ this.queryId = queryId;
+ this.items = items;
+ this.last = last;
+ }
+
+ /**
+ * @return Query ID.
+ */
+ public long queryId() {
+ return queryId;
+ }
+
+ /**
+ * @return Query result rows.
+ */
+ public Collection<?> items() {
+ return items;
+ }
+
+ /**
+ * @return Flag indicating the query has no unfetched results.
+ */
+ public boolean last() {
+ return last;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/c7f09d8a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerRequest.java
new file mode 100644
index 0000000..96f24c8
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerRequest.java
@@ -0,0 +1,61 @@
+/*
+ * 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.odbc;
+
+/**
+ * SQL listener command request.
+ */
+public class SqlListenerRequest {
+ /** Handshake request. */
+ public static final int HANDSHAKE = 1;
+
+ /** Execute sql query. */
+ public static final int QRY_EXEC = 2;
+
+ /** Fetch query results. */
+ public static final int QRY_FETCH = 3;
+
+ /** Close query. */
+ public static final int QRY_CLOSE = 4;
+
+ /** Get columns meta query. */
+ public static final int META_COLS = 5;
+
+ /** Get columns meta query. */
+ public static final int META_TBLS = 6;
+
+ /** Get parameters meta. */
+ public static final int META_PARAMS = 7;
+
+ /** Command. */
+ private final int cmd;
+
+ /**
+ * @param cmd Command type.
+ */
+ public SqlListenerRequest(int cmd) {
+ this.cmd = cmd;
+ }
+
+ /**
+ * @return Command.
+ */
+ public int command() {
+ return cmd;
+ }
+}
[46/50] [abbrv] ignite git commit: IGNITE-518: Unmuted tests that was
fixed in ignite-4036. This closes #1636.
Posted by sb...@apache.org.
IGNITE-518: Unmuted tests that was fixed in ignite-4036. This closes #1636.
(cherry picked from commit c4de164)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ad288a5a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ad288a5a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ad288a5a
Branch: refs/heads/ignite-5009
Commit: ad288a5a2533b1cb1e8ca92c055a4e1bc96c37f4
Parents: 94c1d75
Author: Andrey V. Mashenkov <an...@gmail.com>
Authored: Thu May 4 18:54:45 2017 +0300
Committer: Andrey V. Mashenkov <an...@gmail.com>
Committed: Thu May 4 18:54:45 2017 +0300
----------------------------------------------------------------------
.../expiry/IgniteCacheExpiryPolicyAbstractTest.java | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad288a5a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java
index 8ef7281..3ff1bff 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java
@@ -146,7 +146,8 @@ public abstract class IgniteCacheExpiryPolicyAbstractTest extends IgniteCacheAbs
assertEquals(0, pSize);
}
- /** * @throws Exception If failed.
+ /**
+ * @throws Exception If failed.
*/
public void testZeroOnCreate() throws Exception {
factory = CreatedExpiryPolicy.factoryOf(Duration.ZERO);
@@ -834,9 +835,7 @@ public abstract class IgniteCacheExpiryPolicyAbstractTest extends IgniteCacheAbs
/**
* @throws Exception If failed.
*/
- public void _testNearCreateUpdate() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-518");
-
+ public void testNearCreateUpdate() throws Exception {
if (cacheMode() != PARTITIONED)
return;
@@ -959,9 +958,7 @@ public abstract class IgniteCacheExpiryPolicyAbstractTest extends IgniteCacheAbs
/**
* @throws Exception If failed.
*/
- public void _testNearAccess() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-518");
-
+ public void testNearAccess() throws Exception {
if (cacheMode() != PARTITIONED)
return;
@@ -1009,10 +1006,10 @@ public abstract class IgniteCacheExpiryPolicyAbstractTest extends IgniteCacheAbs
* @throws Exception If failed.
*/
public void testNearExpiresOnClient() throws Exception {
- if(cacheMode() != PARTITIONED)
+ if (cacheMode() != PARTITIONED)
return;
- factory = CreatedExpiryPolicy.factoryOf(new Duration(TimeUnit.SECONDS,1));
+ factory = CreatedExpiryPolicy.factoryOf(new Duration(TimeUnit.SECONDS, 1));
nearCache = true;
[15/50] [abbrv] ignite git commit: IGNITE-5122: Fixed
http-rest-example.php.
Posted by sb...@apache.org.
IGNITE-5122: Fixed http-rest-example.php.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a04aa10a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a04aa10a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a04aa10a
Branch: refs/heads/ignite-5009
Commit: a04aa10a38a5e8c89223f567b4ce4822490509b2
Parents: cd46d46
Author: devozerov <pp...@gmail.com>
Authored: Sun Apr 30 11:23:14 2017 +0300
Committer: devozerov <pp...@gmail.com>
Committed: Sun Apr 30 11:23:14 2017 +0300
----------------------------------------------------------------------
examples/rest/http-rest-example.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/a04aa10a/examples/rest/http-rest-example.php
----------------------------------------------------------------------
diff --git a/examples/rest/http-rest-example.php b/examples/rest/http-rest-example.php
index fe20f4e..df565b2 100644
--- a/examples/rest/http-rest-example.php
+++ b/examples/rest/http-rest-example.php
@@ -43,8 +43,8 @@ if (!function_exists('json_decode'))
$URL = 'http://localhost:8080/ignite?';
-// Cache name to use (null or empty string for default cache).
-$CACHE_NAME = null;
+// Cache name to use.
+$CACHE_NAME = 'default';
/**
* Creates URL parameters.
[28/50] [abbrv] ignite git commit: IGNITE-5109 Refactoring for
SparseDistributedMatrix
Posted by sb...@apache.org.
IGNITE-5109 Refactoring for SparseDistributedMatrix
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/156ec536
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/156ec536
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/156ec536
Branch: refs/heads/ignite-5009
Commit: 156ec5360e6ec918878d9d0c6f7a5d04fc8161a0
Parents: c64ad78
Author: Yury Babak <yb...@gridgain.com>
Authored: Wed May 3 20:02:38 2017 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Wed May 3 20:02:38 2017 +0300
----------------------------------------------------------------------
.../apache/ignite/ml/math/impls/CacheUtils.java | 111 +++++++++++++------
.../ml/math/impls/matrix/AbstractMatrix.java | 5 +
.../impls/matrix/DenseLocalOffHeapMatrix.java | 5 -
.../impls/matrix/SparseDistributedMatrix.java | 16 ++-
.../matrix/SparseDistributedMatrixStorage.java | 89 ++++++++++-----
.../ignite/ml/math/MathImplMainTestSuite.java | 5 +-
.../matrix/SparseDistributedMatrixTest.java | 67 +++++++++--
7 files changed, 213 insertions(+), 85 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/156ec536/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/CacheUtils.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/CacheUtils.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/CacheUtils.java
index cfb01be..ace399b 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/CacheUtils.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/CacheUtils.java
@@ -28,13 +28,17 @@ import org.apache.ignite.cache.affinity.Affinity;
import org.apache.ignite.cache.query.ScanQuery;
import org.apache.ignite.cluster.ClusterGroup;
import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.lang.IgniteCallable;
+import org.apache.ignite.lang.IgnitePredicate;
import org.apache.ignite.lang.IgniteRunnable;
+import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.ml.math.KeyMapper;
import org.apache.ignite.ml.math.ValueMapper;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
import org.apache.ignite.ml.math.functions.IgniteConsumer;
import org.apache.ignite.ml.math.functions.IgniteFunction;
+import org.apache.ignite.ml.math.impls.storage.matrix.SparseDistributedMatrixStorage;
/**
* Distribution-related misc. support.
@@ -118,17 +122,21 @@ public class CacheUtils {
}
/**
- * @param cacheName Cache name.
+ * @param matrixUuid Matrix UUID.
* @return Sum obtained using sparse logic.
*/
- public static <K, V> double sparseSum(String cacheName) {
- Collection<Double> subSums = fold(cacheName, (CacheEntry<Integer, Map<Integer, Double>> ce, Double acc) -> {
- Map<Integer, Double> map = ce.entry().getValue();
+ public static <K, V> double sparseSum(IgniteUuid matrixUuid) {
+ Collection<Double> subSums = fold(SparseDistributedMatrixStorage.ML_CACHE_NAME, (CacheEntry<IgniteBiTuple<Integer, IgniteUuid>, Map<Integer, Double>> ce, Double acc) -> {
+ Cache.Entry<IgniteBiTuple<Integer, IgniteUuid>, Map<Integer, Double>> entry = ce.entry();
+ if (entry.getKey().get2().equals(matrixUuid)) {
+ Map<Integer, Double> map = entry.getValue();
- double sum = sum(map.values());
+ double sum = sum(map.values());
- return acc == null ? sum : acc + sum;
- });
+ return acc == null ? sum : acc + sum;
+ } else
+ return acc;
+ }, key -> key.get2().equals(matrixUuid));
return sum(subSums);
}
@@ -172,39 +180,48 @@ public class CacheUtils {
}
/**
- * @param cacheName Cache name.
+ * @param matrixUuid Matrix UUID.
* @return Minimum value obtained using sparse logic.
*/
- public static <K, V> double sparseMin(String cacheName) {
- Collection<Double> mins = fold(cacheName, (CacheEntry<Integer, Map<Integer, Double>> ce, Double acc) -> {
- Map<Integer, Double> map = ce.entry().getValue();
+ public static <K, V> double sparseMin(IgniteUuid matrixUuid) {
+ Collection<Double> mins = fold(SparseDistributedMatrixStorage.ML_CACHE_NAME, (CacheEntry<IgniteBiTuple<Integer, IgniteUuid>, Map<Integer, Double>> ce, Double acc) -> {
+ Cache.Entry<IgniteBiTuple<Integer, IgniteUuid>, Map<Integer, Double>> entry = ce.entry();
- double min = Collections.min(map.values());
+ if (entry.getKey().get2().equals(matrixUuid)) {
+ Map<Integer, Double> map = entry.getValue();
- if (acc == null)
- return min;
- else
- return Math.min(acc, min);
- });
+ double min = Collections.min(map.values());
+
+ if (acc == null)
+ return min;
+ else
+ return Math.min(acc, min);
+ } else
+ return acc;
+ }, key -> key.get2().equals(matrixUuid));
return Collections.min(mins);
}
/**
- * @param cacheName Cache name.
+ * @param matrixUuid Matrix UUID.
* @return Maximum value obtained using sparse logic.
*/
- public static <K, V> double sparseMax(String cacheName) {
- Collection<Double> maxes = fold(cacheName, (CacheEntry<Integer, Map<Integer, Double>> ce, Double acc) -> {
- Map<Integer, Double> map = ce.entry().getValue();
+ public static <K, V> double sparseMax(IgniteUuid matrixUuid) {
+ Collection<Double> maxes = fold(SparseDistributedMatrixStorage.ML_CACHE_NAME, (CacheEntry<IgniteBiTuple<Integer, IgniteUuid>, Map<Integer, Double>> ce, Double acc) -> {
+ Cache.Entry<IgniteBiTuple<Integer, IgniteUuid>, Map<Integer, Double>> entry = ce.entry();
+ if (entry.getKey().get2().equals(matrixUuid)) {
+ Map<Integer, Double> map = entry.getValue();
- double max = Collections.max(map.values());
+ double max = Collections.max(map.values());
- if (acc == null)
- return max;
- else
- return Math.max(acc, max);
- });
+ if (acc == null)
+ return max;
+ else
+ return Math.max(acc, max);
+ } else
+ return acc;
+ }, key -> key.get2().equals(matrixUuid));
return Collections.max(maxes);
}
@@ -254,19 +271,20 @@ public class CacheUtils {
}
/**
- * @param cacheName Cache name.
+ * @param matrixUuid Matrix UUID.
* @param mapper Mapping {@link IgniteFunction}.
*/
- public static <K, V> void sparseMap(String cacheName, IgniteFunction<Double, Double> mapper) {
- foreach(cacheName, (CacheEntry<Integer, Map<Integer, Double>> ce) -> {
- Integer k = ce.entry().getKey();
+ public static <K, V> void sparseMap(IgniteUuid matrixUuid, IgniteFunction<Double, Double> mapper) {
+ foreach(SparseDistributedMatrixStorage.ML_CACHE_NAME, (CacheEntry<IgniteBiTuple<Integer, IgniteUuid>, Map<Integer, Double>> ce) -> {
+ IgniteBiTuple k = ce.entry().getKey();
+
Map<Integer, Double> v = ce.entry().getValue();
for (Map.Entry<Integer, Double> e : v.entrySet())
e.setValue(mapper.apply(e.getValue()));
ce.cache().put(k, v);
- });
+ }, key -> key.get2().equals(matrixUuid));
}
/**
@@ -276,6 +294,17 @@ public class CacheUtils {
* @param <V> Cache value object type.
*/
public static <K, V> void foreach(String cacheName, IgniteConsumer<CacheEntry<K, V>> fun) {
+ foreach(cacheName, fun, null);
+ }
+
+ /**
+ * @param cacheName Cache name.
+ * @param fun An operation that accepts a cache entry and processes it.
+ * @param keyFilter Cache keys filter.
+ * @param <K> Cache key object type.
+ * @param <V> Cache value object type.
+ */
+ public static <K, V> void foreach(String cacheName, IgniteConsumer<CacheEntry<K, V>> fun, IgnitePredicate<K> keyFilter) {
bcast(cacheName, () -> {
Ignite ignite = Ignition.localIgnite();
IgniteCache<K, V> cache = ignite.getOrCreateCache(cacheName);
@@ -293,7 +322,7 @@ public class CacheUtils {
// Iterate over given partition.
// Query returns an empty cursor if this partition is not stored on this node.
for (Cache.Entry<K, V> entry : cache.query(new ScanQuery<K, V>(part,
- (k, v) -> affinity.mapPartitionToNode(p) == locNode)))
+ (k, v) -> affinity.mapPartitionToNode(p) == locNode && (keyFilter == null || keyFilter.apply(k)))))
fun.accept(new CacheEntry<>(entry, cache));
}
});
@@ -310,6 +339,20 @@ public class CacheUtils {
* @return Fold operation result.
*/
public static <K, V, A> Collection<A> fold(String cacheName, IgniteBiFunction<CacheEntry<K, V>, A, A> folder) {
+ return fold(cacheName, folder, null);
+ }
+
+ /**
+ * <b>Currently fold supports only commutative operations.<b/>
+ *
+ * @param cacheName Cache name.
+ * @param folder Fold function operating over cache entries.
+ * @param <K> Cache key object type.
+ * @param <V> Cache value object type.
+ * @param <A> Fold result type.
+ * @return Fold operation result.
+ */
+ public static <K, V, A> Collection<A> fold(String cacheName, IgniteBiFunction<CacheEntry<K, V>, A, A> folder, IgnitePredicate<K> keyFilter) {
return bcast(cacheName, () -> {
Ignite ignite = Ignition.localIgnite();
IgniteCache<K, V> cache = ignite.getOrCreateCache(cacheName);
@@ -329,7 +372,7 @@ public class CacheUtils {
// Iterate over given partition.
// Query returns an empty cursor if this partition is not stored on this node.
for (Cache.Entry<K, V> entry : cache.query(new ScanQuery<K, V>(part,
- (k, v) -> affinity.mapPartitionToNode(p) == locNode)))
+ (k, v) -> affinity.mapPartitionToNode(p) == locNode && (keyFilter == null || keyFilter.apply(k)))))
a = folder.apply(new CacheEntry<>(entry, cache), a);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/156ec536/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/AbstractMatrix.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/AbstractMatrix.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/AbstractMatrix.java
index c5edeb1..d1d3904 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/AbstractMatrix.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/AbstractMatrix.java
@@ -840,6 +840,11 @@ public abstract class AbstractMatrix implements Matrix {
}
/** {@inheritDoc} */
+ @Override public void destroy() {
+ getStorage().destroy();
+ }
+
+ /** {@inheritDoc} */
@Override public Matrix copy() {
Matrix cp = like(rowSize(), columnSize());
http://git-wip-us.apache.org/repos/asf/ignite/blob/156ec536/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/DenseLocalOffHeapMatrix.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/DenseLocalOffHeapMatrix.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/DenseLocalOffHeapMatrix.java
index 4161228..fad35fd 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/DenseLocalOffHeapMatrix.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/DenseLocalOffHeapMatrix.java
@@ -71,11 +71,6 @@ public class DenseLocalOffHeapMatrix extends AbstractMatrix {
}
/** {@inheritDoc} */
- @Override public void destroy() {
- getStorage().destroy();
- }
-
- /** {@inheritDoc} */
@Override protected Matrix likeIdentity() {
int n = rowSize();
Matrix res = like(n, n);
http://git-wip-us.apache.org/repos/asf/ignite/blob/156ec536/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/SparseDistributedMatrix.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/SparseDistributedMatrix.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/SparseDistributedMatrix.java
index 10ebdd0..3e508bd 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/SparseDistributedMatrix.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/SparseDistributedMatrix.java
@@ -26,6 +26,7 @@
package org.apache.ignite.ml.math.impls.matrix;
+import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.ml.math.Matrix;
import org.apache.ignite.ml.math.StorageConstants;
import org.apache.ignite.ml.math.Vector;
@@ -119,24 +120,24 @@ public class SparseDistributedMatrix extends AbstractMatrix implements StorageCo
* @return Matrix with mapped values.
*/
private Matrix mapOverValues(IgniteFunction<Double, Double> mapper) {
- CacheUtils.sparseMap(storage().cache().getName(), mapper);
+ CacheUtils.sparseMap(getUUID(), mapper);
return this;
}
/** {@inheritDoc} */
@Override public double sum() {
- return CacheUtils.sparseSum(storage().cache().getName());
+ return CacheUtils.sparseSum(getUUID());
}
/** {@inheritDoc} */
@Override public double maxValue() {
- return CacheUtils.sparseMax(storage().cache().getName());
+ return CacheUtils.sparseMax(getUUID());
}
/** {@inheritDoc} */
@Override public double minValue() {
- return CacheUtils.sparseMin(storage().cache().getName());
+ return CacheUtils.sparseMin(getUUID());
}
/** {@inheritDoc} */
@@ -146,11 +147,16 @@ public class SparseDistributedMatrix extends AbstractMatrix implements StorageCo
/** {@inheritDoc} */
@Override public Matrix like(int rows, int cols) {
- throw new UnsupportedOperationException();
+ return new SparseDistributedMatrix(rows, cols, storage().storageMode(), storage().accessMode());
}
/** {@inheritDoc} */
@Override public Vector likeVector(int crd) {
throw new UnsupportedOperationException();
}
+
+ /** */
+ private IgniteUuid getUUID(){
+ return ((SparseDistributedMatrixStorage) getStorage()).getUUID();
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/156ec536/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/SparseDistributedMatrixStorage.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/SparseDistributedMatrixStorage.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/SparseDistributedMatrixStorage.java
index bfc0e9f..816bf44 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/SparseDistributedMatrixStorage.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/SparseDistributedMatrixStorage.java
@@ -23,6 +23,9 @@ import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.Ignition;
import org.apache.ignite.cache.CacheAtomicityMode;
@@ -30,6 +33,7 @@ import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.CachePeekMode;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.ml.math.MatrixStorage;
import org.apache.ignite.ml.math.StorageConstants;
@@ -40,19 +44,22 @@ import org.apache.ignite.ml.math.impls.matrix.SparseDistributedMatrix;
* {@link MatrixStorage} implementation for {@link SparseDistributedMatrix}.
*/
public class SparseDistributedMatrixStorage extends CacheUtils implements MatrixStorage, StorageConstants {
+ /** Cache name used for all instances of {@link SparseDistributedMatrixStorage}.*/
+ public static final String ML_CACHE_NAME = "ML_SPARSE_MATRICES_CONTAINER";
/** Amount of rows in the matrix. */
private int rows;
/** Amount of columns in the matrix. */
private int cols;
-
/** Row or column based storage mode. */
private int stoMode;
/** Random or sequential access mode. */
private int acsMode;
+ /** Matrix uuid. */
+ private IgniteUuid uuid;
/** Actual distributed storage. */
private IgniteCache<
- Integer /* Row or column index. */,
+ IgniteBiTuple<Integer, IgniteUuid> /* Row or column index with matrix uuid. */,
Map<Integer, Double> /* Map-based row or column. */
> cache = null;
@@ -81,14 +88,15 @@ public class SparseDistributedMatrixStorage extends CacheUtils implements Matrix
this.acsMode = acsMode;
cache = newCache();
+
+ uuid = IgniteUuid.randomUuid();
}
/**
- *
- *
+ * Create new ML cache if needed.
*/
- private IgniteCache<Integer, Map<Integer, Double>> newCache() {
- CacheConfiguration<Integer, Map<Integer, Double>> cfg = new CacheConfiguration<>();
+ private IgniteCache<IgniteBiTuple<Integer, IgniteUuid>, Map<Integer, Double>> newCache() {
+ CacheConfiguration<IgniteBiTuple<Integer, IgniteUuid>, Map<Integer, Double>> cfg = new CacheConfiguration<>();
// Write to primary.
cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.PRIMARY_SYNC);
@@ -106,16 +114,18 @@ public class SparseDistributedMatrixStorage extends CacheUtils implements Matrix
cfg.setCacheMode(CacheMode.PARTITIONED);
// Random cache name.
- cfg.setName(new IgniteUuid().shortString());
+ cfg.setName(ML_CACHE_NAME);
- return Ignition.localIgnite().getOrCreateCache(cfg);
+ IgniteCache<IgniteBiTuple<Integer, IgniteUuid>, Map<Integer, Double>> cache = Ignition.localIgnite().getOrCreateCache(cfg);
+
+ return cache;
}
/**
*
*
*/
- public IgniteCache<Integer, Map<Integer, Double>> cache() {
+ public IgniteCache<IgniteBiTuple<Integer, IgniteUuid>, Map<Integer, Double>> cache() {
return cache;
}
@@ -138,34 +148,36 @@ public class SparseDistributedMatrixStorage extends CacheUtils implements Matrix
/** {@inheritDoc} */
@Override public double get(int x, int y) {
if (stoMode == ROW_STORAGE_MODE)
- return matrixGet(cache.getName(), x, y);
+ return matrixGet(x, y);
else
- return matrixGet(cache.getName(), y, x);
+ return matrixGet(y, x);
}
/** {@inheritDoc} */
@Override public void set(int x, int y, double v) {
if (stoMode == ROW_STORAGE_MODE)
- matrixSet(cache.getName(), x, y, v);
+ matrixSet(x, y, v);
else
- matrixSet(cache.getName(), y, x, v);
+ matrixSet(y, x, v);
}
/**
* Distributed matrix get.
*
- * @param cacheName Matrix's cache.
* @param a Row or column index.
* @param b Row or column index.
* @return Matrix value at (a, b) index.
*/
- private double matrixGet(String cacheName, int a, int b) {
+ private double matrixGet(int a, int b) {
// Remote get from the primary node (where given row or column is stored locally).
- return ignite().compute(groupForKey(cacheName, a)).call(() -> {
- IgniteCache<Integer, Map<Integer, Double>> cache = Ignition.localIgnite().getOrCreateCache(cacheName);
+ return ignite().compute(groupForKey(ML_CACHE_NAME, a)).call(() -> {
+ IgniteCache<IgniteBiTuple<Integer, IgniteUuid>, Map<Integer, Double>> cache = Ignition.localIgnite().getOrCreateCache(ML_CACHE_NAME);
// Local get.
- Map<Integer, Double> map = cache.localPeek(a, CachePeekMode.PRIMARY);
+ Map<Integer, Double> map = cache.localPeek(getCacheKey(a), CachePeekMode.PRIMARY);
+
+ if (map == null)
+ map = cache.get(getCacheKey(a));
return (map == null || !map.containsKey(b)) ? 0.0 : map.get(b);
});
@@ -174,21 +186,25 @@ public class SparseDistributedMatrixStorage extends CacheUtils implements Matrix
/**
* Distributed matrix set.
*
- * @param cacheName Matrix's cache.
* @param a Row or column index.
* @param b Row or column index.
* @param v New value to set.
*/
- private void matrixSet(String cacheName, int a, int b, double v) {
+ private void matrixSet(int a, int b, double v) {
// Remote set on the primary node (where given row or column is stored locally).
- ignite().compute(groupForKey(cacheName, a)).run(() -> {
- IgniteCache<Integer, Map<Integer, Double>> cache = Ignition.localIgnite().getOrCreateCache(cacheName);
+ ignite().compute(groupForKey(ML_CACHE_NAME, a)).run(() -> {
+ IgniteCache<IgniteBiTuple<Integer, IgniteUuid>, Map<Integer, Double>> cache = Ignition.localIgnite().getOrCreateCache(ML_CACHE_NAME);
// Local get.
- Map<Integer, Double> map = cache.localPeek(a, CachePeekMode.PRIMARY);
+ Map<Integer, Double> map = cache.localPeek(getCacheKey(a), CachePeekMode.PRIMARY);
- if (map == null)
- map = acsMode == SEQUENTIAL_ACCESS_MODE ? new Int2DoubleRBTreeMap() : new Int2DoubleOpenHashMap();
+
+ if (map == null) {
+ map = cache.get(getCacheKey(a)); //Remote entry get.
+
+ if (map == null)
+ map = acsMode == SEQUENTIAL_ACCESS_MODE ? new Int2DoubleRBTreeMap() : new Int2DoubleOpenHashMap();
+ }
if (v != 0.0)
map.put(b, v);
@@ -196,10 +212,15 @@ public class SparseDistributedMatrixStorage extends CacheUtils implements Matrix
map.remove(b);
// Local put.
- cache.put(a, map);
+ cache.put(getCacheKey(a), map);
});
}
+ /** Build cache key for row/column. */
+ private IgniteBiTuple<Integer, IgniteUuid> getCacheKey(int idx){
+ return new IgniteBiTuple<>(idx, uuid);
+ }
+
/** {@inheritDoc} */
@Override public int columnSize() {
return cols;
@@ -216,6 +237,7 @@ public class SparseDistributedMatrixStorage extends CacheUtils implements Matrix
out.writeInt(cols);
out.writeInt(acsMode);
out.writeInt(stoMode);
+ out.writeObject(uuid);
out.writeUTF(cache.getName());
}
@@ -225,6 +247,7 @@ public class SparseDistributedMatrixStorage extends CacheUtils implements Matrix
cols = in.readInt();
acsMode = in.readInt();
stoMode = in.readInt();
+ uuid = (IgniteUuid)in.readObject();
cache = ignite().getOrCreateCache(in.readUTF());
}
@@ -253,9 +276,11 @@ public class SparseDistributedMatrixStorage extends CacheUtils implements Matrix
return false;
}
- /** Destroy underlying cache. */
+ /** Delete all data from cache. */
@Override public void destroy() {
- cache.destroy();
+ Set<IgniteBiTuple<Integer, IgniteUuid>> keyset = IntStream.range(0, rows).mapToObj(this::getCacheKey).collect(Collectors.toSet());
+
+ cache.clearAll(keyset);
}
/** {@inheritDoc} */
@@ -266,6 +291,7 @@ public class SparseDistributedMatrixStorage extends CacheUtils implements Matrix
res = res * 37 + rows;
res = res * 37 + acsMode;
res = res * 37 + stoMode;
+ res = res * 37 + uuid.hashCode();
res = res * 37 + cache.hashCode();
return res;
@@ -282,6 +308,11 @@ public class SparseDistributedMatrixStorage extends CacheUtils implements Matrix
SparseDistributedMatrixStorage that = (SparseDistributedMatrixStorage)obj;
return rows == that.rows && cols == that.cols && acsMode == that.acsMode && stoMode == that.stoMode
- && (cache != null ? cache.equals(that.cache) : that.cache == null);
+ && uuid.equals(that.uuid) && (cache != null ? cache.equals(that.cache) : that.cache == null);
+ }
+
+ /** */
+ public IgniteUuid getUUID() {
+ return uuid;
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/156ec536/modules/ml/src/test/java/org/apache/ignite/ml/math/MathImplMainTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/math/MathImplMainTestSuite.java b/modules/ml/src/test/java/org/apache/ignite/ml/math/MathImplMainTestSuite.java
index 5f41583..8d6d2af 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/math/MathImplMainTestSuite.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/math/MathImplMainTestSuite.java
@@ -21,12 +21,13 @@ import org.junit.runner.RunWith;
import org.junit.runners.Suite;
/**
- * Test suite for local and distributed tests
+ * Test suite for local and distributed tests.
*/
@RunWith(Suite.class)
@Suite.SuiteClasses({
MathImplLocalTestSuite.class,
- MathImplDistributedTestSuite.class
+ MathImplDistributedTestSuite.class,
+ TracerTest.class
})
public class MathImplMainTestSuite {
// No-op.
http://git-wip-us.apache.org/repos/asf/ignite/blob/156ec536/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/matrix/SparseDistributedMatrixTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/matrix/SparseDistributedMatrixTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/matrix/SparseDistributedMatrixTest.java
index 8985806..5ee2e7d 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/matrix/SparseDistributedMatrixTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/matrix/SparseDistributedMatrixTest.java
@@ -31,12 +31,19 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.lang.IgniteBiTuple;
+import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.ml.math.Matrix;
import org.apache.ignite.ml.math.StorageConstants;
import org.apache.ignite.ml.math.exceptions.UnsupportedOperationException;
import org.apache.ignite.ml.math.impls.MathTestConstants;
+import org.apache.ignite.ml.math.impls.storage.matrix.SparseDistributedMatrixStorage;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.testframework.junits.common.GridCommonTest;
@@ -110,7 +117,7 @@ public class SparseDistributedMatrixTest extends GridCommonAbstractTest {
double v = Math.random();
cacheMatrix.set(i, j, v);
- assert Double.compare(v, cacheMatrix.get(i, j)) == 0;
+ assertEquals("Unexpected value for matrix element["+ i +" " + j + "]", v, cacheMatrix.get(i, j), PRECISION);
}
}
}
@@ -134,7 +141,7 @@ public class SparseDistributedMatrixTest extends GridCommonAbstractTest {
SparseDistributedMatrix objRestored = (SparseDistributedMatrix)objInputStream.readObject();
assertTrue(MathTestConstants.VAL_NOT_EQUALS, cacheMatrix.equals(objRestored));
- assertEquals(MathTestConstants.VAL_NOT_EQUALS, objRestored.get(1, 1), 1.0, 0.0);
+ assertEquals(MathTestConstants.VAL_NOT_EQUALS, objRestored.get(1, 1), 1.0, PRECISION);
}
/** Test simple math. */
@@ -225,19 +232,44 @@ public class SparseDistributedMatrixTest extends GridCommonAbstractTest {
}
/** */
+ public void testCacheBehaviour(){
+ IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
+
+ SparseDistributedMatrix cacheMatrix1 = new SparseDistributedMatrix(rows, cols, StorageConstants.ROW_STORAGE_MODE, StorageConstants.RANDOM_ACCESS_MODE);
+ SparseDistributedMatrix cacheMatrix2 = new SparseDistributedMatrix(rows, cols, StorageConstants.ROW_STORAGE_MODE, StorageConstants.RANDOM_ACCESS_MODE);
+
+ initMtx(cacheMatrix1);
+ initMtx(cacheMatrix2);
+
+ Collection<String> cacheNames = ignite.cacheNames();
+
+ assert cacheNames.contains(SparseDistributedMatrixStorage.ML_CACHE_NAME);
+
+ IgniteCache<IgniteBiTuple<Integer, IgniteUuid>, Object> cache = ignite.getOrCreateCache(SparseDistributedMatrixStorage.ML_CACHE_NAME);
+
+ Set<IgniteBiTuple<Integer, IgniteUuid>> keySet1 = buildKeySet(cacheMatrix1);
+ Set<IgniteBiTuple<Integer, IgniteUuid>> keySet2 = buildKeySet(cacheMatrix2);
+
+ assert cache.containsKeys(keySet1);
+ assert cache.containsKeys(keySet2);
+
+ cacheMatrix2.destroy();
+
+ assert cache.containsKeys(keySet1);
+ assert !cache.containsKeys(keySet2);
+
+ cacheMatrix1.destroy();
+
+ assert !cache.containsKeys(keySet1);
+ }
+
+ /** */
public void testLike() {
IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
cacheMatrix = new SparseDistributedMatrix(rows, cols, StorageConstants.ROW_STORAGE_MODE, StorageConstants.RANDOM_ACCESS_MODE);
- try {
- cacheMatrix.like(1, 1);
- fail("UnsupportedOperationException expected.");
- }
- catch (UnsupportedOperationException e) {
- return;
- }
- fail("UnsupportedOperationException expected.");
+ assertNotNull(cacheMatrix.like(1, 1));
}
/** */
@@ -262,4 +294,19 @@ public class SparseDistributedMatrixTest extends GridCommonAbstractTest {
for (int j = 0; j < m.columnSize(); j++)
m.set(i, j, 1.0);
}
+
+ /** Build key set for SparseDistributedMatrix. */
+ private Set<IgniteBiTuple<Integer, IgniteUuid>> buildKeySet(SparseDistributedMatrix m){
+ Set<IgniteBiTuple<Integer, IgniteUuid>> set = new HashSet<>();
+
+ SparseDistributedMatrixStorage storage = (SparseDistributedMatrixStorage)m.getStorage();
+
+ IgniteUuid uuid = storage.getUUID();
+ int size = storage.storageMode() == StorageConstants.ROW_STORAGE_MODE ? storage.rowSize() : storage.columnSize();
+
+ for (int i = 0; i < size; i++)
+ set.add(new IgniteBiTuple<>(i, uuid));
+
+ return set;
+ }
}
[33/50] [abbrv] ignite git commit: topologyVersion was not
initialized for GridDhtAtomicSingleUpdateRequest.
Posted by sb...@apache.org.
topologyVersion was not initialized for GridDhtAtomicSingleUpdateRequest.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7d0cc2c4
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7d0cc2c4
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7d0cc2c4
Branch: refs/heads/ignite-5009
Commit: 7d0cc2c4df9dca67a981cb1770bb13092535eb9a
Parents: 6579197
Author: sboikov <sb...@gridgain.com>
Authored: Thu May 4 11:23:41 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu May 4 11:23:41 2017 +0300
----------------------------------------------------------------------
.../atomic/GridDhtAtomicAbstractUpdateRequest.java | 15 +++++++++++++++
.../dht/atomic/GridDhtAtomicUpdateRequest.java | 7 ++-----
2 files changed, 17 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7d0cc2c4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateRequest.java
index 4ff8484..6fb7df6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateRequest.java
@@ -138,6 +138,15 @@ public abstract class GridDhtAtomicAbstractUpdateRequest extends GridCacheMessag
setFlag(true, DHT_ATOMIC_KEEP_BINARY_FLAG_MASK);
}
+ /** {@inheritDoc} */
+ @Override public final AffinityTopologyVersion topologyVersion() {
+ return topVer;
+ }
+
+ /**
+ * @param nearNodeId Near node ID.
+ * @param nearFutId Future ID on near node.
+ */
void nearReplyInfo(UUID nearNodeId, long nearFutId) {
assert nearNodeId != null;
@@ -145,10 +154,16 @@ public abstract class GridDhtAtomicAbstractUpdateRequest extends GridCacheMessag
this.nearFutId = nearFutId;
}
+ /**
+ * @return {@code True} if backups should reply immediately.
+ */
boolean replyWithoutDelay() {
return isFlag(DHT_ATOMIC_REPLY_WITHOUT_DELAY);
}
+ /**
+ * @param replyWithoutDelay {@code True} if backups should reply immediately.
+ */
void replyWithoutDelay(boolean replyWithoutDelay) {
setFlag(replyWithoutDelay, DHT_ATOMIC_REPLY_WITHOUT_DELAY);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7d0cc2c4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
index 54b2ae7..6f3f530 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
@@ -143,6 +143,8 @@ public class GridDhtAtomicUpdateRequest extends GridDhtAtomicAbstractUpdateReque
* @param invokeArgs Optional arguments for entry processor.
* @param syncMode Cache write synchronization mode.
* @param topVer Topology version.
+ * @param keepBinary Keep binary flag.
+ * @param skipStore Skip store flag.
* @param forceTransformBackups Force transform backups flag.
* @param subjId Subject ID.
* @param taskNameHash Task name hash code.
@@ -333,11 +335,6 @@ public class GridDhtAtomicUpdateRequest extends GridDhtAtomicAbstractUpdateReque
}
/** {@inheritDoc} */
- @Override public AffinityTopologyVersion topologyVersion() {
- return topVer;
- }
-
- /** {@inheritDoc} */
@Override public int size() {
return keys.size();
}
[35/50] [abbrv] ignite git commit: IGNITE-5162: ODBC: removed unused
version-dependent code. simplified version enum.
Posted by sb...@apache.org.
IGNITE-5162: ODBC: removed unused version-dependent code. simplified version enum.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7f8a4309
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7f8a4309
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7f8a4309
Branch: refs/heads/ignite-5009
Commit: 7f8a430908bcc6cbbd2d3c75afbbe2f500b88a6d
Parents: d70ebff
Author: devozerov <vo...@gridgain.com>
Authored: Thu May 4 13:12:14 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Thu May 4 13:12:14 2017 +0300
----------------------------------------------------------------------
.../processors/odbc/OdbcMessageParser.java | 8 +--
.../processors/odbc/OdbcProtocolVersion.java | 73 +++++---------------
.../processors/odbc/OdbcRequestHandler.java | 10 ++-
.../internal/processors/odbc/OdbcUtils.java | 3 +
4 files changed, 28 insertions(+), 66 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7f8a4309/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcMessageParser.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcMessageParser.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcMessageParser.java
index ab93f25..a3d7308 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcMessageParser.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcMessageParser.java
@@ -83,13 +83,11 @@ public class OdbcMessageParser {
OdbcProtocolVersion version = res.version();
- if (version.isUnknown())
+ if (version == OdbcProtocolVersion.UNKNOWN)
return res;
- if (version.isDistributedJoinsSupported()) {
- res.distributedJoins(reader.readBoolean());
- res.enforceJoinOrder(reader.readBoolean());
- }
+ res.distributedJoins(reader.readBoolean());
+ res.enforceJoinOrder(reader.readBoolean());
return res;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7f8a4309/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcProtocolVersion.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcProtocolVersion.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcProtocolVersion.java
index 57efa02..5c156d2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcProtocolVersion.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcProtocolVersion.java
@@ -14,52 +14,37 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.ignite.internal.processors.odbc;
-import java.util.HashMap;
-import java.util.Map;
+package org.apache.ignite.internal.processors.odbc;
/**
* ODBC protocol version.
*/
public enum OdbcProtocolVersion {
- /** First version of the ODBC. Released with Ignite 1.6 */
- VERSION_1_6_0(1),
-
- /** Second version of the ODBC. Released with Ignite 1.8 */
- VERSION_1_8_0(makeVersion(1,8,0)),
+ /** Version 2.1.0. */
+ VER_2_1_0(makeVersion(2, 1, 0), "2.1.0"),
/** Unknown version. */
- VERSION_UNKNOWN(Long.MIN_VALUE);
+ UNKNOWN(Long.MIN_VALUE, "UNKNOWN");
/** Mask to get 2 lowest bytes of the value and cast to long. */
private static final long LONG_MASK = 0x000000000000FFFFL;
- /** Long value to enum map. */
- private static final Map<Long, OdbcProtocolVersion> versions = new HashMap<>();
-
- /** Enum value to Ignite version map */
- private static final Map<OdbcProtocolVersion, String> since = new HashMap<>();
-
- /**
- * Map long values to version.
- */
- static {
- for (OdbcProtocolVersion version : values())
- versions.put(version.longValue(), version);
-
- since.put(VERSION_1_6_0, "1.6.0");
- since.put(VERSION_1_8_0, "1.8.0");
- }
-
/** Long value for version. */
private final long longVal;
+ /** Since string. */
+ private final String since;
+
/**
+ * Constructor.
+ *
* @param longVal Long value.
+ * @param since Since string.
*/
- OdbcProtocolVersion(long longVal) {
+ OdbcProtocolVersion(long longVal, String since) {
this.longVal = longVal;
+ this.since = since;
}
/**
@@ -79,16 +64,12 @@ public enum OdbcProtocolVersion {
* @return Protocol version.
*/
public static OdbcProtocolVersion fromLong(long longVal) {
- OdbcProtocolVersion res = versions.get(longVal);
-
- return res == null ? VERSION_UNKNOWN : res;
- }
+ for (OdbcProtocolVersion ver : OdbcProtocolVersion.values()) {
+ if (ver.longValue() == longVal)
+ return ver;
+ }
- /**
- * @return Current version.
- */
- public static OdbcProtocolVersion current() {
- return VERSION_1_8_0;
+ return UNKNOWN;
}
/**
@@ -99,27 +80,9 @@ public enum OdbcProtocolVersion {
}
/**
- * @return {@code true} if this version is unknown.
- */
- public boolean isUnknown() {
- return longVal == VERSION_UNKNOWN.longVal;
- }
-
- /**
- * @return {@code true} if this version supports distributed joins.
- */
- public boolean isDistributedJoinsSupported() {
- assert !isUnknown();
-
- return longVal >= VERSION_1_8_0.longVal;
- }
-
- /**
* @return Ignite version when introduced.
*/
public String since() {
- assert !isUnknown();
-
- return since.get(this);
+ return since;
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7f8a4309/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcRequestHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcRequestHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcRequestHandler.java
index 311d2eb..c17dd63 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcRequestHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcRequestHandler.java
@@ -141,22 +141,20 @@ public class OdbcRequestHandler {
try {
OdbcProtocolVersion version = req.version();
- if (version.isUnknown()) {
+ if (version == OdbcProtocolVersion.UNKNOWN) {
IgniteProductVersion ver = ctx.grid().version();
String verStr = Byte.toString(ver.major()) + '.' + ver.minor() + '.' + ver.maintenance();
- OdbcHandshakeResult res = new OdbcHandshakeResult(false, OdbcProtocolVersion.current().since(), verStr);
+ OdbcHandshakeResult res = new OdbcHandshakeResult(false, OdbcUtils.VER_LATEST.since(), verStr);
return new OdbcResponse(res);
}
OdbcHandshakeResult res = new OdbcHandshakeResult(true, null, null);
- if (version.isDistributedJoinsSupported()) {
- distributedJoins = req.distributedJoins();
- enforceJoinOrder = req.enforceJoinOrder();
- }
+ distributedJoins = req.distributedJoins();
+ enforceJoinOrder = req.enforceJoinOrder();
return new OdbcResponse(res);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7f8a4309/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcUtils.java
index d851d13..668ce6a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcUtils.java
@@ -23,6 +23,9 @@ import org.apache.ignite.IgniteException;
* Various ODBC utility methods.
*/
public class OdbcUtils {
+ /** Latest version. */
+ public static final OdbcProtocolVersion VER_LATEST = OdbcProtocolVersion.VER_2_1_0;
+
/**
* Add quotation marks at the beginning and end of the string.
*
[48/50] [abbrv] ignite git commit: Merge remote-tracking branch
'remotes/origin/master' into ignite-5009
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/658aadc5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCache.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/658aadc5/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/658aadc5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java
----------------------------------------------------------------------
diff --cc modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java
index 5be7e07,3ff1bff..6186352
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java
@@@ -1010,10 -1006,10 +1006,10 @@@ public abstract class IgniteCacheExpiry
* @throws Exception If failed.
*/
public void testNearExpiresOnClient() throws Exception {
- if(cacheMode() != PARTITIONED)
+ if (cacheMode() != PARTITIONED)
return;
- factory = CreatedExpiryPolicy.factoryOf(new Duration(TimeUnit.SECONDS, 2));
- factory = CreatedExpiryPolicy.factoryOf(new Duration(TimeUnit.SECONDS, 1));
++ factory = CreatedExpiryPolicy.factoryOf(new Duration(TimeUnit.SECONDS,2));
nearCache = true;
http://git-wip-us.apache.org/repos/asf/ignite/blob/658aadc5/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
----------------------------------------------------------------------
[40/50] [abbrv] ignite git commit: IGNITE-5167: ODBC: extracted
handler/parser interfaces.
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e5a82d6/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeUtils.java
deleted file mode 100644
index 01f32d1..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeUtils.java
+++ /dev/null
@@ -1,440 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.odbc.escape;
-
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.internal.processors.odbc.OdbcUtils;
-import java.util.LinkedList;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * ODBC escape sequence parse.
- */
-public class OdbcEscapeUtils {
- /** Odbc date regexp pattern: '2016-08-23' */
- private static final Pattern DATE_PATTERN = Pattern.compile("^'\\d{4}-\\d{2}-\\d{2}'$");
-
- /** Odbc time regexp pattern: '14:33:44' */
- private static final Pattern TIME_PATTERN = Pattern.compile("^'\\d{2}:\\d{2}:\\d{2}'$");
-
- /** Odbc timestamp regexp pattern: '2016-08-23 14:33:44.12345' */
- private static final Pattern TIMESTAMP_PATTERN =
- Pattern.compile("^'\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}(\\.\\d+)?'$");
-
- /** GUID regexp pattern: '12345678-9abc-def0-1234-123456789abc' */
- private static final Pattern GUID_PATTERN =
- Pattern.compile("^'\\p{XDigit}{8}-\\p{XDigit}{4}-\\p{XDigit}{4}-\\p{XDigit}{4}-\\p{XDigit}{12}'$");
-
- /** CONVERT function data type parameter pattern: last parameter, after comma */
- private static final Pattern CONVERT_TYPE_PATTERN =
- Pattern.compile(",\\s*(SQL_[\\w_]+)\\s*(?:\\(\\s*\\d+\\s*(?:,\\s*\\d+\\s*)?\\))?\\s*\\)\\s*$",
- Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE);
-
- /**
- * Parse escape sequence.
- *
- * @param text Original text.
- * @return Result.
- */
- public static String parse(String text) {
- if (text == null)
- throw new IgniteException("Text cannot be null.");
-
- return parse0(text.trim(), 0, false).result();
- }
-
- /**
- * Internal parse routine.
- *
- * @param text Text.
- * @param startPos Start position.
- * @param earlyExit When set to {@code true} we must return as soon as single expression is parsed.
- * @return Parse result.
- */
- private static OdbcEscapeParseResult parse0(String text, int startPos, boolean earlyExit) {
- StringBuilder res = new StringBuilder();
-
- int curPos = startPos;
-
- int plainPos = startPos;
- int openPos = -1;
-
- boolean insideLiteral = false;
-
- LinkedList<OdbcEscapeParseResult> nested = null;
-
- while (curPos < text.length()) {
- char curChar = text.charAt(curPos);
-
- if (curChar == '\'')
- /* Escaped quote in odbc is two successive singe quotes. They'll flip flag twice without side-effect. */
- insideLiteral = !insideLiteral;
- else if (!insideLiteral) {
- if (curChar == '{') {
- if (openPos == -1) {
- // Top-level opening brace. Append previous portion and remember current position.
- res.append(text, plainPos, curPos);
-
- openPos = curPos;
- }
- else {
- // Nested opening brace -> perform recursion.
- OdbcEscapeParseResult nestedRes = parse0(text, curPos, true);
-
- if (nested == null)
- nested = new LinkedList<>();
-
- nested.add(nestedRes);
-
- curPos += nestedRes.originalLength() - 1;
-
- plainPos = curPos + 1;
- }
- }
- else if (curChar == '}') {
- if (openPos == -1)
- // Close without open -> exception.
- throw new IgniteException("Malformed escape sequence " +
- "(closing curly brace without opening curly brace): " + text);
- else {
- String parseRes;
-
- if (nested == null)
- // Found sequence without nesting, process it.
- parseRes = parseEscapeSequence(text, openPos, curPos + 1 - openPos);
- else {
- // Special case to process nesting.
- String res0 = appendNested(text, openPos, curPos + 1, nested);
-
- nested = null;
-
- parseRes = parseEscapeSequence(res0, 0, res0.length());
- }
-
- if (earlyExit)
- return new OdbcEscapeParseResult(startPos, curPos + 1 - startPos, parseRes);
- else
- res.append(parseRes);
-
- openPos = -1;
-
- plainPos = curPos + 1;
- }
- }
- }
-
- curPos++;
- }
-
- if (openPos != -1)
- throw new IgniteException("Malformed escape sequence (closing curly brace missing): " + text);
-
- if (insideLiteral)
- throw new IgniteException("Malformed literal expression (closing quote missing): " + text);
-
- if (curPos > plainPos)
- res.append(text, plainPos, curPos);
-
- return new OdbcEscapeParseResult(startPos, curPos - startPos + 1, res.toString());
- }
-
- /**
- * Parse escape sequence: {escape_sequence}.
- *
- * @param text Text.
- * @param startPos Start position within text.
- * @param len Length.
- * @return Result.
- */
- private static String parseEscapeSequence(String text, int startPos, int len) {
- assert validSubstring(text, startPos, len);
-
- char firstChar = text.charAt(startPos);
-
- if (firstChar == '{') {
- char lastChar = text.charAt(startPos + len - 1);
-
- if (lastChar != '}')
- throw new IgniteException("Failed to parse escape sequence because it is not enclosed: " +
- substring(text, startPos, len));
-
- OdbcEscapeToken token = parseToken(text, startPos, len);
-
- return parseEscapeSequence(text, startPos, len, token);
- }
- else {
- // Nothing to escape, return original string.
- if (startPos == 0 || text.length() == len)
- return text;
- else
- return substring(text, startPos, len);
- }
- }
-
- /**
- * Get escape sequence info.
- *
- * @param text Text.
- * @param startPos Start position.
- * @return Escape sequence info.
- */
- private static OdbcEscapeToken parseToken(String text, int startPos, int len) {
- assert validSubstring(text, startPos, len);
- assert text.charAt(startPos) == '{';
-
- int pos = startPos + 1;
-
- while (Character.isWhitespace(text.charAt(pos)))
- pos++;
-
- OdbcEscapeType curTyp = null;
- boolean empty = false;
-
- for (OdbcEscapeType typ : OdbcEscapeType.sortedValues()) {
- if (text.startsWith(typ.body(), pos)) {
- if (typ.standard())
- pos += typ.body().length();
-
- empty = (startPos + len == pos + 1);
-
- if (!empty && typ.standard()) {
- char charAfter = text.charAt(pos);
-
- if (!Character.isWhitespace(charAfter))
- throw new IgniteException("Unexpected escape sequence token: " +
- substring(text, startPos, len));
- }
-
- curTyp = typ;
-
- break;
- }
- }
-
- if (curTyp == null)
- throw new IgniteException("Unsupported escape sequence: " + substring(text, startPos, len));
-
- if (empty && !curTyp.allowEmpty())
- throw new IgniteException("Escape sequence cannot be empty: " + substring(text, startPos, len));
-
- return new OdbcEscapeToken(curTyp, pos - (startPos + 1));
- }
-
- /**
- * Parse standard expression: {TOKEN expression}
- *
- * @param text Text.
- * @param startPos Start position.
- * @param len Length.
- * @param token Token.
- * @return Result.
- */
- private static String parseEscapeSequence(String text, int startPos, int len, OdbcEscapeToken token) {
- assert validSubstring(text, startPos, len);
-
- // Get expression borders.
- int startPos0 = startPos + 1 /* open brace */ + token.length() /* token. */;
- int len0 = len - 1 /* open brace */ - token.length() /* token */ - 1 /* close brace */;
-
- switch (token.type()) {
- case SCALAR_FUNCTION:
- return parseScalarFunctionExpression(text, startPos0, len0);
-
- case GUID: {
- String res = parseExpression(text, startPos0, len0, token.type(), GUID_PATTERN);
-
- return "CAST(" + res + " AS UUID)";
- }
-
- case DATE:
- return parseExpression(text, startPos0, len0, token.type(), DATE_PATTERN);
-
- case TIME:
- return parseExpression(text, startPos0, len0, token.type(), TIME_PATTERN);
-
- case TIMESTAMP:
- return parseExpression(text, startPos0, len0, token.type(), TIMESTAMP_PATTERN);
-
- case OUTER_JOIN:
- return parseExpression(text, startPos0, len0);
-
- case CALL: {
- String val = parseExpression(text, startPos0, len0);
-
- return "CALL " + val;
- }
-
- case ESCAPE:
- case ESCAPE_WO_TOKEN:
- return parseLikeEscCharacterExpression(text, startPos0, len0);
-
- default:
- throw new IgniteException("Unsupported escape sequence token [text=" +
- substring(text, startPos, len) + ", token=" + token.type().body() + ']');
- }
- }
-
- /**
- * Parse simple expression.
- *
- * @param text Text.
- * @param startPos Start position.
- * @param len Length.
- * @return Parsed expression.
- */
- private static String parseExpression(String text, int startPos, int len) {
- return substring(text, startPos, len).trim();
- }
-
- /**
- * Parse LIKE escape character expression.
- *
- * @param text Text.
- * @param startPos Start position.
- * @param len Length.
- * @return Parsed expression.
- */
- private static String parseLikeEscCharacterExpression(String text, int startPos, int len) {
- return "ESCAPE " + substring(text, startPos, len).trim();
- }
-
- /**
- * Parse expression and validate against ODBC specification with regex pattern.
- *
- * @param text Text.
- * @param startPos Start position.
- * @param len Length.
- * @return Parsed expression.
- */
- private static String parseExpression(String text, int startPos, int len, OdbcEscapeType type, Pattern pattern) {
- String val = parseExpression(text, startPos, len);
-
- if (!pattern.matcher(val).matches())
- throw new IgniteException("Invalid " + type + " escape sequence: " + substring(text, startPos, len));
-
- return val;
- }
-
- /**
- * Parse scalar function expression.
- *
- * @param text Text.
- * @param startPos Start position.
- * @param len Length.
- * @return Parsed expression.
- */
- private static String parseScalarFunctionExpression(String text, int startPos, int len) {
- int pos = startPos;
- int endPos = startPos + len;
- final String errPrefix = "Malformed scalar function escape sequence.";
-
- while ((++pos < endPos) && Character.isWhitespace(text.charAt(pos)));
- if (pos == endPos)
- throw new IgniteException(errPrefix + " Expected function name.");
-
- int funcNamePos = pos;
- while ((++pos < endPos) && Character.isAlphabetic(text.charAt(pos)));
- if (pos == endPos)
- throw new IgniteException(errPrefix + " Expected function parameter list: " +
- substring(text, startPos, len));
-
- String funcName = text.substring(funcNamePos, pos);
-
- switch (funcName.toUpperCase()) {
- case "CONVERT": {
- Matcher matcher = CONVERT_TYPE_PATTERN.matcher(text.substring(startPos, endPos));
-
- if (!matcher.find())
- throw new IgniteException(errPrefix + " Invalid arguments :" +
- substring(text, startPos, len));
-
- return (text.substring(startPos, startPos + matcher.start(1)) +
- OdbcUtils.getIgniteTypeFromOdbcType(matcher.group(1)) +
- text.substring(startPos + matcher.end(1), startPos + len)).trim();
- }
- default:
- return substring(text, startPos, len).trim();
- }
- }
-
- /**
- * Append nested results.
- *
- * @param text Original text.
- * @param startPos Start position.
- * @param endPos End position.
- * @param nestedRess Nested results.
- * @return Result.
- */
- private static String appendNested(String text, int startPos, int endPos,
- LinkedList<OdbcEscapeParseResult> nestedRess) {
- StringBuilder res = new StringBuilder();
-
- int curPos = startPos;
-
- for (OdbcEscapeParseResult nestedRes : nestedRess) {
- // Append text between current position and replace.
- res.append(text, curPos, nestedRes.originalStart());
-
- // Append replaced text.
- res.append(nestedRes.result());
-
- // Advance position.
- curPos = nestedRes.originalStart() + nestedRes.originalLength();
- }
-
- // Append remainder.
- res.append(text, curPos, endPos);
-
- return res.toString();
- }
-
- /**
- * Perform "substring" using start position and length.
- *
- * @param text Text.
- * @param startPos Start position.
- * @param len Length.
- * @return Substring.
- */
- private static String substring(String text, int startPos, int len) {
- assert validSubstring(text, startPos, len);
-
- return text.substring(startPos, startPos + len);
- }
-
- /**
- * Check whether substring is valid.
- *
- * @param text Substring.
- * @param startPos Start position.
- * @param len Length.
- * @return {@code True} if valid.
- */
- private static boolean validSubstring(String text, int startPos, int len) {
- return text != null && startPos + len <= text.length();
- }
-
- /**
- * Private constructor.
- */
- private OdbcEscapeUtils() {
- // No-op.
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e5a82d6/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcMessageParser.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcMessageParser.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcMessageParser.java
new file mode 100644
index 0000000..37fe3bf
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcMessageParser.java
@@ -0,0 +1,322 @@
+/*
+ * 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.odbc.odbc;
+
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.binary.BinaryReaderExImpl;
+import org.apache.ignite.internal.binary.BinaryWriterExImpl;
+import org.apache.ignite.internal.binary.GridBinaryMarshaller;
+import org.apache.ignite.internal.binary.streams.BinaryHeapInputStream;
+import org.apache.ignite.internal.binary.streams.BinaryHeapOutputStream;
+import org.apache.ignite.internal.binary.streams.BinaryInputStream;
+import org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl;
+import org.apache.ignite.internal.processors.odbc.SqlListenerHandshakeRequest;
+import org.apache.ignite.internal.processors.odbc.SqlListenerHandshakeResult;
+import org.apache.ignite.internal.processors.odbc.OdbcQueryGetColumnsMetaRequest;
+import org.apache.ignite.internal.processors.odbc.OdbcQueryGetColumnsMetaResult;
+import org.apache.ignite.internal.processors.odbc.OdbcQueryGetParamsMetaRequest;
+import org.apache.ignite.internal.processors.odbc.OdbcQueryGetParamsMetaResult;
+import org.apache.ignite.internal.processors.odbc.OdbcQueryGetTablesMetaRequest;
+import org.apache.ignite.internal.processors.odbc.OdbcQueryGetTablesMetaResult;
+import org.apache.ignite.internal.processors.odbc.OdbcTableMeta;
+import org.apache.ignite.internal.processors.odbc.SqlListenerColumnMeta;
+import org.apache.ignite.internal.processors.odbc.SqlListenerMessageParser;
+import org.apache.ignite.internal.processors.odbc.SqlListenerQueryCloseRequest;
+import org.apache.ignite.internal.processors.odbc.SqlListenerQueryCloseResult;
+import org.apache.ignite.internal.processors.odbc.SqlListenerQueryExecuteRequest;
+import org.apache.ignite.internal.processors.odbc.SqlListenerQueryExecuteResult;
+import org.apache.ignite.internal.processors.odbc.SqlListenerQueryFetchRequest;
+import org.apache.ignite.internal.processors.odbc.SqlListenerQueryFetchResult;
+import org.apache.ignite.internal.processors.odbc.SqlListenerRequest;
+import org.apache.ignite.internal.processors.odbc.SqlListenerResponse;
+
+import java.util.Collection;
+
+/**
+ * ODBC message parser.
+ */
+public class OdbcMessageParser implements SqlListenerMessageParser {
+ /** Initial output stream capacity. */
+ private static final int INIT_CAP = 1024;
+
+ /** Marshaller. */
+ private final GridBinaryMarshaller marsh;
+
+ /** Logger. */
+ private final IgniteLogger log;
+
+ /** Protocol version confirmation flag. */
+ private boolean verConfirmed = false;
+
+ /**
+ * @param ctx Context.
+ */
+ public OdbcMessageParser(final GridKernalContext ctx) {
+ CacheObjectBinaryProcessorImpl cacheObjProc = (CacheObjectBinaryProcessorImpl)ctx.cacheObjects();
+
+ this.marsh = cacheObjProc.marshaller();
+
+ this.log = ctx.log(getClass());
+ }
+
+ /** {@inheritDoc} */
+ @Override public SqlListenerRequest decode(byte[] msg) {
+ assert msg != null;
+
+ BinaryInputStream stream = new BinaryHeapInputStream(msg);
+
+ BinaryReaderExImpl reader = new BinaryReaderExImpl(null, stream, null, true);
+
+ byte cmd = reader.readByte();
+
+ // This is a special case because we can not decode protocol messages until
+ // we has not confirmed that the remote client uses the same protocol version.
+ if (!verConfirmed) {
+ if (cmd == SqlListenerRequest.HANDSHAKE)
+ {
+ long longVersion = reader.readLong();
+
+ SqlListenerHandshakeRequest res = new SqlListenerHandshakeRequest(longVersion);
+
+ res.distributedJoins(reader.readBoolean());
+ res.enforceJoinOrder(reader.readBoolean());
+
+ return res;
+ }
+ else
+ throw new IgniteException("Unexpected ODBC command " +
+ "(first message is not a handshake request): [cmd=" + cmd + ']');
+ }
+
+ SqlListenerRequest res;
+
+ switch (cmd) {
+ case SqlListenerRequest.QRY_EXEC: {
+ String cache = reader.readString();
+ String sql = reader.readString();
+ int argsNum = reader.readInt();
+
+ Object[] params = new Object[argsNum];
+
+ for (int i = 0; i < argsNum; ++i)
+ params[i] = reader.readObjectDetached();
+
+ res = new SqlListenerQueryExecuteRequest(cache, sql, params);
+
+ break;
+ }
+
+ case SqlListenerRequest.QRY_FETCH: {
+ long queryId = reader.readLong();
+ int pageSize = reader.readInt();
+
+ res = new SqlListenerQueryFetchRequest(queryId, pageSize);
+
+ break;
+ }
+
+ case SqlListenerRequest.QRY_CLOSE: {
+ long queryId = reader.readLong();
+
+ res = new SqlListenerQueryCloseRequest(queryId);
+
+ break;
+ }
+
+ case SqlListenerRequest.META_COLS: {
+ String cache = reader.readString();
+ String table = reader.readString();
+ String column = reader.readString();
+
+ res = new OdbcQueryGetColumnsMetaRequest(cache, table, column);
+
+ break;
+ }
+
+ case SqlListenerRequest.META_TBLS: {
+ String catalog = reader.readString();
+ String schema = reader.readString();
+ String table = reader.readString();
+ String tableType = reader.readString();
+
+ res = new OdbcQueryGetTablesMetaRequest(catalog, schema, table, tableType);
+
+ break;
+ }
+
+ case SqlListenerRequest.META_PARAMS: {
+ String cacheName = reader.readString();
+ String sqlQuery = reader.readString();
+
+ res = new OdbcQueryGetParamsMetaRequest(cacheName, sqlQuery);
+
+ break;
+ }
+
+ default:
+ throw new IgniteException("Unknown ODBC command: [cmd=" + cmd + ']');
+ }
+
+ return res;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte[] encode(SqlListenerResponse msg) {
+ assert msg != null;
+
+ // Creating new binary writer
+ BinaryWriterExImpl writer = marsh.writer(new BinaryHeapOutputStream(INIT_CAP));
+
+ // Writing status.
+ writer.writeByte((byte) msg.status());
+
+ if (msg.status() != SqlListenerResponse.STATUS_SUCCESS) {
+ writer.writeString(msg.error());
+
+ return writer.array();
+ }
+
+ Object res0 = msg.response();
+
+ if (res0 == null)
+ return writer.array();
+ if (res0 instanceof SqlListenerHandshakeResult) {
+ SqlListenerHandshakeResult res = (SqlListenerHandshakeResult) res0;
+
+ if (log.isDebugEnabled())
+ log.debug("Handshake result: " + (res.accepted() ? "accepted" : "rejected"));
+
+ verConfirmed = res.accepted();
+
+ if (res.accepted()) {
+ verConfirmed = true;
+
+ writer.writeBoolean(true);
+ }
+ else {
+ writer.writeBoolean(false);
+ writer.writeString(res.protocolVersionSince());
+ writer.writeString(res.currentVersion());
+ }
+ }
+ else if (res0 instanceof SqlListenerQueryExecuteResult) {
+ SqlListenerQueryExecuteResult res = (SqlListenerQueryExecuteResult) res0;
+
+ if (log.isDebugEnabled())
+ log.debug("Resulting query ID: " + res.getQueryId());
+
+ writer.writeLong(res.getQueryId());
+
+ Collection<SqlListenerColumnMeta> metas = res.getColumnsMetadata();
+
+ assert metas != null;
+
+ writer.writeInt(metas.size());
+
+ for (SqlListenerColumnMeta meta : metas)
+ meta.write(writer);
+ }
+ else if (res0 instanceof SqlListenerQueryFetchResult) {
+ SqlListenerQueryFetchResult res = (SqlListenerQueryFetchResult) res0;
+
+ if (log.isDebugEnabled())
+ log.debug("Resulting query ID: " + res.queryId());
+
+ writer.writeLong(res.queryId());
+
+ Collection<?> items0 = res.items();
+
+ assert items0 != null;
+
+ writer.writeBoolean(res.last());
+
+ writer.writeInt(items0.size());
+
+ for (Object row0 : items0) {
+ if (row0 != null) {
+ Collection<?> row = (Collection<?>)row0;
+
+ writer.writeInt(row.size());
+
+ for (Object obj : row) {
+ if (obj == null) {
+ writer.writeObjectDetached(null);
+ continue;
+ }
+
+ Class<?> cls = obj.getClass();
+
+ if (cls == java.sql.Time.class)
+ writer.writeTime((java.sql.Time)obj);
+ else if (cls == java.sql.Timestamp.class)
+ writer.writeTimestamp((java.sql.Timestamp)obj);
+ else if (cls == java.sql.Date.class)
+ writer.writeDate((java.util.Date)obj);
+ else
+ writer.writeObjectDetached(obj);
+ }
+ }
+ }
+ }
+ else if (res0 instanceof SqlListenerQueryCloseResult) {
+ SqlListenerQueryCloseResult res = (SqlListenerQueryCloseResult) res0;
+
+ if (log.isDebugEnabled())
+ log.debug("Resulting query ID: " + res.getQueryId());
+
+ writer.writeLong(res.getQueryId());
+ }
+ else if (res0 instanceof OdbcQueryGetColumnsMetaResult) {
+ OdbcQueryGetColumnsMetaResult res = (OdbcQueryGetColumnsMetaResult) res0;
+
+ Collection<SqlListenerColumnMeta> columnsMeta = res.meta();
+
+ assert columnsMeta != null;
+
+ writer.writeInt(columnsMeta.size());
+
+ for (SqlListenerColumnMeta columnMeta : columnsMeta)
+ columnMeta.write(writer);
+ }
+ else if (res0 instanceof OdbcQueryGetTablesMetaResult) {
+ OdbcQueryGetTablesMetaResult res = (OdbcQueryGetTablesMetaResult) res0;
+
+ Collection<OdbcTableMeta> tablesMeta = res.meta();
+
+ assert tablesMeta != null;
+
+ writer.writeInt(tablesMeta.size());
+
+ for (OdbcTableMeta tableMeta : tablesMeta)
+ tableMeta.writeBinary(writer);
+ }
+ else if (res0 instanceof OdbcQueryGetParamsMetaResult) {
+ OdbcQueryGetParamsMetaResult res = (OdbcQueryGetParamsMetaResult) res0;
+
+ byte[] typeIds = res.typeIds();
+
+ writer.writeObjectDetached(typeIds);
+ }
+ else
+ assert false : "Should not reach here.";
+
+ return writer.array();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e5a82d6/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java
new file mode 100644
index 0000000..815f650
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java
@@ -0,0 +1,540 @@
+/*
+ * 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.odbc.odbc;
+
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cache.query.QueryCursor;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.binary.GridBinaryMarshaller;
+import org.apache.ignite.internal.processors.cache.QueryCursorImpl;
+import org.apache.ignite.internal.processors.odbc.SqlListenerHandshakeRequest;
+import org.apache.ignite.internal.processors.odbc.SqlListenerHandshakeResult;
+import org.apache.ignite.internal.processors.odbc.OdbcQueryGetColumnsMetaRequest;
+import org.apache.ignite.internal.processors.odbc.OdbcQueryGetColumnsMetaResult;
+import org.apache.ignite.internal.processors.odbc.OdbcQueryGetParamsMetaRequest;
+import org.apache.ignite.internal.processors.odbc.OdbcQueryGetParamsMetaResult;
+import org.apache.ignite.internal.processors.odbc.OdbcQueryGetTablesMetaRequest;
+import org.apache.ignite.internal.processors.odbc.OdbcQueryGetTablesMetaResult;
+import org.apache.ignite.internal.processors.odbc.OdbcTableMeta;
+import org.apache.ignite.internal.processors.odbc.OdbcUtils;
+import org.apache.ignite.internal.processors.odbc.SqlListenerColumnMeta;
+import org.apache.ignite.internal.processors.odbc.SqlListenerProtocolVersion;
+import org.apache.ignite.internal.processors.odbc.SqlListenerQueryCloseRequest;
+import org.apache.ignite.internal.processors.odbc.SqlListenerQueryCloseResult;
+import org.apache.ignite.internal.processors.odbc.SqlListenerQueryExecuteRequest;
+import org.apache.ignite.internal.processors.odbc.SqlListenerQueryExecuteResult;
+import org.apache.ignite.internal.processors.odbc.SqlListenerQueryFetchRequest;
+import org.apache.ignite.internal.processors.odbc.SqlListenerQueryFetchResult;
+import org.apache.ignite.internal.processors.odbc.SqlListenerRequest;
+import org.apache.ignite.internal.processors.odbc.SqlListenerRequestHandler;
+import org.apache.ignite.internal.processors.odbc.SqlListenerResponse;
+import org.apache.ignite.internal.processors.odbc.odbc.escape.OdbcEscapeUtils;
+import org.apache.ignite.internal.processors.query.GridQueryFieldMetadata;
+import org.apache.ignite.internal.processors.query.GridQueryTypeDescriptor;
+import org.apache.ignite.internal.util.GridSpinBusyLock;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteBiTuple;
+import org.apache.ignite.lang.IgniteProductVersion;
+
+import java.sql.ParameterMetaData;
+import java.sql.PreparedStatement;
+import java.sql.Types;
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicLong;
+
+import static org.apache.ignite.internal.processors.odbc.SqlListenerRequest.*;
+
+/**
+ * SQL query handler.
+ */
+public class OdbcRequestHandler implements SqlListenerRequestHandler {
+ /** Query ID sequence. */
+ private static final AtomicLong QRY_ID_GEN = new AtomicLong();
+
+ /** Kernel context. */
+ private final GridKernalContext ctx;
+
+ /** Logger. */
+ private final IgniteLogger log;
+
+ /** Busy lock. */
+ private final GridSpinBusyLock busyLock;
+
+ /** Maximum allowed cursors. */
+ private final int maxCursors;
+
+ /** Current queries cursors. */
+ private final ConcurrentHashMap<Long, IgniteBiTuple<QueryCursor, Iterator>> qryCursors = new ConcurrentHashMap<>();
+
+ /** Distributed joins flag. */
+ private boolean distributedJoins = false;
+
+ /** Enforce join order flag. */
+ private boolean enforceJoinOrder = false;
+
+ /**
+ * Constructor.
+ *
+ * @param ctx Context.
+ * @param busyLock Shutdown latch.
+ * @param maxCursors Maximum allowed cursors.
+ */
+ public OdbcRequestHandler(GridKernalContext ctx, GridSpinBusyLock busyLock, int maxCursors) {
+ this.ctx = ctx;
+ this.busyLock = busyLock;
+ this.maxCursors = maxCursors;
+
+ log = ctx.log(getClass());
+ }
+
+ /** {@inheritDoc} */
+ @Override public SqlListenerResponse handle(SqlListenerRequest req) {
+ assert req != null;
+
+ if (!busyLock.enterBusy())
+ return new SqlListenerResponse(SqlListenerResponse.STATUS_FAILED,
+ "Failed to handle ODBC request because node is stopping: " + req);
+
+ try {
+ switch (req.command()) {
+ case HANDSHAKE:
+ return performHandshake((SqlListenerHandshakeRequest)req);
+
+ case QRY_EXEC:
+ return executeQuery((SqlListenerQueryExecuteRequest)req);
+
+ case QRY_FETCH:
+ return fetchQuery((SqlListenerQueryFetchRequest)req);
+
+ case QRY_CLOSE:
+ return closeQuery((SqlListenerQueryCloseRequest)req);
+
+ case META_COLS:
+ return getColumnsMeta((OdbcQueryGetColumnsMetaRequest)req);
+
+ case META_TBLS:
+ return getTablesMeta((OdbcQueryGetTablesMetaRequest)req);
+
+ case META_PARAMS:
+ return getParamsMeta((OdbcQueryGetParamsMetaRequest)req);
+ }
+
+ return new SqlListenerResponse(SqlListenerResponse.STATUS_FAILED, "Unsupported ODBC request: " + req);
+ }
+ finally {
+ busyLock.leaveBusy();
+ }
+ }
+
+ /**
+ * {@link SqlListenerHandshakeRequest} command handler.
+ *
+ * @param req Handshake request.
+ * @return Response.
+ */
+ private SqlListenerResponse performHandshake(SqlListenerHandshakeRequest req) {
+ try {
+ SqlListenerProtocolVersion version = req.version();
+
+ if (version == SqlListenerProtocolVersion.UNKNOWN) {
+ IgniteProductVersion ver = ctx.grid().version();
+
+ String verStr = Byte.toString(ver.major()) + '.' + ver.minor() + '.' + ver.maintenance();
+
+ SqlListenerHandshakeResult res = new SqlListenerHandshakeResult(false, OdbcUtils.VER_LATEST.since(), verStr);
+
+ return new SqlListenerResponse(res);
+ }
+
+ SqlListenerHandshakeResult res = new SqlListenerHandshakeResult(true, null, null);
+
+ distributedJoins = req.distributedJoins();
+ enforceJoinOrder = req.enforceJoinOrder();
+
+ return new SqlListenerResponse(res);
+ }
+ catch (Exception e) {
+ U.error(log, "Failed to perform handshake [reqId=" + req.requestId() + ", req=" + req + ']', e);
+
+ return new SqlListenerResponse(SqlListenerResponse.STATUS_FAILED, e.toString());
+ }
+ }
+
+ /**
+ * {@link SqlListenerQueryExecuteRequest} command handler.
+ *
+ * @param req Execute query request.
+ * @return Response.
+ */
+ private SqlListenerResponse executeQuery(SqlListenerQueryExecuteRequest req) {
+ int cursorCnt = qryCursors.size();
+
+ if (maxCursors > 0 && cursorCnt >= maxCursors)
+ return new SqlListenerResponse(SqlListenerResponse.STATUS_FAILED, "Too many opened cursors (either close other " +
+ "opened cursors or increase the limit through OdbcConfiguration.setMaxOpenCursors()) " +
+ "[maximum=" + maxCursors + ", current=" + cursorCnt + ']');
+
+ long qryId = QRY_ID_GEN.getAndIncrement();
+
+ try {
+ String sql = OdbcEscapeUtils.parse(req.sqlQuery());
+
+ if (log.isDebugEnabled())
+ log.debug("ODBC query parsed [reqId=" + req.requestId() + ", original=" + req.sqlQuery() +
+ ", parsed=" + sql + ']');
+
+ SqlFieldsQuery qry = new SqlFieldsQuery(sql);
+
+ qry.setArgs(req.arguments());
+
+ qry.setDistributedJoins(distributedJoins);
+ qry.setEnforceJoinOrder(enforceJoinOrder);
+
+ IgniteCache<Object, Object> cache0 = ctx.grid().cache(req.cacheName());
+
+ if (cache0 == null)
+ return new SqlListenerResponse(SqlListenerResponse.STATUS_FAILED,
+ "Cache doesn't exist (did you configure it?): " + req.cacheName());
+
+ IgniteCache<Object, Object> cache = cache0.withKeepBinary();
+
+ if (cache == null)
+ return new SqlListenerResponse(SqlListenerResponse.STATUS_FAILED,
+ "Can not get cache with keep binary: " + req.cacheName());
+
+ QueryCursor qryCur = cache.query(qry);
+
+ qryCursors.put(qryId, new IgniteBiTuple<QueryCursor, Iterator>(qryCur, null));
+
+ List<?> fieldsMeta = ((QueryCursorImpl) qryCur).fieldsMeta();
+
+ SqlListenerQueryExecuteResult res = new SqlListenerQueryExecuteResult(qryId, convertMetadata(fieldsMeta));
+
+ return new SqlListenerResponse(res);
+ }
+ catch (Exception e) {
+ qryCursors.remove(qryId);
+
+ U.error(log, "Failed to execute SQL query [reqId=" + req.requestId() + ", req=" + req + ']', e);
+
+ return new SqlListenerResponse(SqlListenerResponse.STATUS_FAILED, e.toString());
+ }
+ }
+
+ /**
+ * {@link SqlListenerQueryCloseRequest} command handler.
+ *
+ * @param req Execute query request.
+ * @return Response.
+ */
+ private SqlListenerResponse closeQuery(SqlListenerQueryCloseRequest req) {
+ try {
+ IgniteBiTuple<QueryCursor, Iterator> tuple = qryCursors.get(req.queryId());
+
+ if (tuple == null)
+ return new SqlListenerResponse(SqlListenerResponse.STATUS_FAILED,
+ "Failed to find query with ID: " + req.queryId());
+
+ QueryCursor cur = tuple.get1();
+
+ assert(cur != null);
+
+ cur.close();
+
+ qryCursors.remove(req.queryId());
+
+ SqlListenerQueryCloseResult res = new SqlListenerQueryCloseResult(req.queryId());
+
+ return new SqlListenerResponse(res);
+ }
+ catch (Exception e) {
+ qryCursors.remove(req.queryId());
+
+ U.error(log, "Failed to close SQL query [reqId=" + req.requestId() + ", req=" + req.queryId() + ']', e);
+
+ return new SqlListenerResponse(SqlListenerResponse.STATUS_FAILED, e.toString());
+ }
+ }
+
+ /**
+ * {@link SqlListenerQueryFetchRequest} command handler.
+ *
+ * @param req Execute query request.
+ * @return Response.
+ */
+ private SqlListenerResponse fetchQuery(SqlListenerQueryFetchRequest req) {
+ try {
+ IgniteBiTuple<QueryCursor, Iterator> tuple = qryCursors.get(req.queryId());
+
+ if (tuple == null)
+ return new SqlListenerResponse(SqlListenerResponse.STATUS_FAILED,
+ "Failed to find query with ID: " + req.queryId());
+
+ Iterator iter = tuple.get2();
+
+ if (iter == null) {
+ QueryCursor cur = tuple.get1();
+
+ iter = cur.iterator();
+
+ tuple.put(cur, iter);
+ }
+
+ List<Object> items = new ArrayList<>();
+
+ for (int i = 0; i < req.pageSize() && iter.hasNext(); ++i)
+ items.add(iter.next());
+
+ SqlListenerQueryFetchResult res = new SqlListenerQueryFetchResult(req.queryId(), items, !iter.hasNext());
+
+ return new SqlListenerResponse(res);
+ }
+ catch (Exception e) {
+ U.error(log, "Failed to fetch SQL query result [reqId=" + req.requestId() + ", req=" + req + ']', e);
+
+ return new SqlListenerResponse(SqlListenerResponse.STATUS_FAILED, e.toString());
+ }
+ }
+
+ /**
+ * {@link OdbcQueryGetColumnsMetaRequest} command handler.
+ *
+ * @param req Get columns metadata request.
+ * @return Response.
+ */
+ private SqlListenerResponse getColumnsMeta(OdbcQueryGetColumnsMetaRequest req) {
+ try {
+ List<SqlListenerColumnMeta> meta = new ArrayList<>();
+
+ String cacheName;
+ String tableName;
+
+ if (req.tableName().contains(".")) {
+ // Parsing two-part table name.
+ String[] parts = req.tableName().split("\\.");
+
+ cacheName = OdbcUtils.removeQuotationMarksIfNeeded(parts[0]);
+
+ tableName = parts[1];
+ }
+ else {
+ cacheName = OdbcUtils.removeQuotationMarksIfNeeded(req.cacheName());
+
+ tableName = req.tableName();
+ }
+
+ Collection<GridQueryTypeDescriptor> tablesMeta = ctx.query().types(cacheName);
+
+ for (GridQueryTypeDescriptor table : tablesMeta) {
+ if (!matches(table.name(), tableName))
+ continue;
+
+ for (Map.Entry<String, Class<?>> field : table.fields().entrySet()) {
+ if (!matches(field.getKey(), req.columnName()))
+ continue;
+
+ SqlListenerColumnMeta columnMeta = new SqlListenerColumnMeta(req.cacheName(), table.name(),
+ field.getKey(), field.getValue());
+
+ if (!meta.contains(columnMeta))
+ meta.add(columnMeta);
+ }
+ }
+
+ OdbcQueryGetColumnsMetaResult res = new OdbcQueryGetColumnsMetaResult(meta);
+
+ return new SqlListenerResponse(res);
+ }
+ catch (Exception e) {
+ U.error(log, "Failed to get columns metadata [reqId=" + req.requestId() + ", req=" + req + ']', e);
+
+ return new SqlListenerResponse(SqlListenerResponse.STATUS_FAILED, e.toString());
+ }
+ }
+
+ /**
+ * {@link OdbcQueryGetTablesMetaRequest} command handler.
+ *
+ * @param req Get tables metadata request.
+ * @return Response.
+ */
+ private SqlListenerResponse getTablesMeta(OdbcQueryGetTablesMetaRequest req) {
+ try {
+ List<OdbcTableMeta> meta = new ArrayList<>();
+
+ String realSchema = OdbcUtils.removeQuotationMarksIfNeeded(req.schema());
+
+ for (String cacheName : ctx.cache().cacheNames())
+ {
+ if (!matches(cacheName, realSchema))
+ continue;
+
+ Collection<GridQueryTypeDescriptor> tablesMeta = ctx.query().types(cacheName);
+
+ for (GridQueryTypeDescriptor table : tablesMeta) {
+ if (!matches(table.name(), req.table()))
+ continue;
+
+ if (!matches("TABLE", req.tableType()))
+ continue;
+
+ OdbcTableMeta tableMeta = new OdbcTableMeta(null, cacheName, table.name(), "TABLE");
+
+ if (!meta.contains(tableMeta))
+ meta.add(tableMeta);
+ }
+ }
+
+ OdbcQueryGetTablesMetaResult res = new OdbcQueryGetTablesMetaResult(meta);
+
+ return new SqlListenerResponse(res);
+ }
+ catch (Exception e) {
+ U.error(log, "Failed to get tables metadata [reqId=" + req.requestId() + ", req=" + req + ']', e);
+
+ return new SqlListenerResponse(SqlListenerResponse.STATUS_FAILED, e.toString());
+ }
+ }
+
+ /**
+ * {@link OdbcQueryGetParamsMetaRequest} command handler.
+ *
+ * @param req Get params metadata request.
+ * @return Response.
+ */
+ private SqlListenerResponse getParamsMeta(OdbcQueryGetParamsMetaRequest req) {
+ try {
+ PreparedStatement stmt = ctx.query().prepareNativeStatement(req.cacheName(), req.query());
+
+ ParameterMetaData pmd = stmt.getParameterMetaData();
+
+ byte[] typeIds = new byte[pmd.getParameterCount()];
+
+ for (int i = 1; i <= pmd.getParameterCount(); ++i) {
+ int sqlType = pmd.getParameterType(i);
+
+ typeIds[i - 1] = sqlTypeToBinary(sqlType);
+ }
+
+ OdbcQueryGetParamsMetaResult res = new OdbcQueryGetParamsMetaResult(typeIds);
+
+ return new SqlListenerResponse(res);
+ }
+ catch (Exception e) {
+ U.error(log, "Failed to get params metadata [reqId=" + req.requestId() + ", req=" + req + ']', e);
+
+ return new SqlListenerResponse(SqlListenerResponse.STATUS_FAILED, e.toString());
+ }
+ }
+
+ /**
+ * Convert {@link java.sql.Types} to binary type constant (See {@link GridBinaryMarshaller} constants).
+ *
+ * @param sqlType SQL type.
+ * @return Binary type.
+ */
+ private static byte sqlTypeToBinary(int sqlType) {
+ switch (sqlType) {
+ case Types.BIGINT:
+ return GridBinaryMarshaller.LONG;
+
+ case Types.BOOLEAN:
+ return GridBinaryMarshaller.BOOLEAN;
+
+ case Types.DATE:
+ return GridBinaryMarshaller.DATE;
+
+ case Types.DOUBLE:
+ return GridBinaryMarshaller.DOUBLE;
+
+ case Types.FLOAT:
+ case Types.REAL:
+ return GridBinaryMarshaller.FLOAT;
+
+ case Types.NUMERIC:
+ case Types.DECIMAL:
+ return GridBinaryMarshaller.DECIMAL;
+
+ case Types.INTEGER:
+ return GridBinaryMarshaller.INT;
+
+ case Types.SMALLINT:
+ return GridBinaryMarshaller.SHORT;
+
+ case Types.TIME:
+ return GridBinaryMarshaller.TIME;
+
+ case Types.TIMESTAMP:
+ return GridBinaryMarshaller.TIMESTAMP;
+
+ case Types.TINYINT:
+ return GridBinaryMarshaller.BYTE;
+
+ case Types.CHAR:
+ case Types.VARCHAR:
+ case Types.LONGNVARCHAR:
+ return GridBinaryMarshaller.STRING;
+
+ case Types.NULL:
+ return GridBinaryMarshaller.NULL;
+
+ case Types.BINARY:
+ case Types.VARBINARY:
+ case Types.LONGVARBINARY:
+ default:
+ return GridBinaryMarshaller.BYTE_ARR;
+ }
+ }
+
+ /**
+ * Convert metadata in collection from {@link GridQueryFieldMetadata} to
+ * {@link SqlListenerColumnMeta}.
+ *
+ * @param meta Internal query field metadata.
+ * @return Odbc query field metadata.
+ */
+ private static Collection<SqlListenerColumnMeta> convertMetadata(Collection<?> meta) {
+ List<SqlListenerColumnMeta> res = new ArrayList<>();
+
+ if (meta != null) {
+ for (Object info : meta) {
+ assert info instanceof GridQueryFieldMetadata;
+
+ res.add(new SqlListenerColumnMeta((GridQueryFieldMetadata)info));
+ }
+ }
+
+ return res;
+ }
+
+ /**
+ * Checks whether string matches SQL pattern.
+ *
+ * @param str String.
+ * @param ptrn Pattern.
+ * @return Whether string matches pattern.
+ */
+ private static boolean matches(String str, String ptrn) {
+ return str != null && (F.isEmpty(ptrn) ||
+ str.toUpperCase().matches(ptrn.toUpperCase().replace("%", ".*").replace("_", ".")));
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e5a82d6/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/escape/OdbcEscapeParseResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/escape/OdbcEscapeParseResult.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/escape/OdbcEscapeParseResult.java
new file mode 100644
index 0000000..369e7ac
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/escape/OdbcEscapeParseResult.java
@@ -0,0 +1,73 @@
+/*
+ * 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.odbc.odbc.escape;
+
+import org.apache.ignite.internal.util.typedef.internal.S;
+
+/**
+ * ODBC escape sequence parse result.
+ */
+public class OdbcEscapeParseResult {
+ /** Original start position. */
+ private final int originalStart;
+
+ /** Original length. */
+ private final int originalLen;
+
+ /** Resulting text. */
+ private final String res;
+
+ /**
+ * Constructor.
+ *
+ * @param originalStart Original start position.
+ * @param originalLen Original length.
+ * @param res Resulting text.
+ */
+ public OdbcEscapeParseResult(int originalStart, int originalLen, String res) {
+ this.originalStart = originalStart;
+ this.originalLen = originalLen;
+ this.res = res;
+ }
+
+ /**
+ * @return Original start position.
+ */
+ public int originalStart() {
+ return originalStart;
+ }
+
+ /**
+ * @return Original length.
+ */
+ public int originalLength() {
+ return originalLen;
+ }
+
+ /**
+ * @return Resulting text.
+ */
+ public String result() {
+ return res;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(OdbcEscapeParseResult.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e5a82d6/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/escape/OdbcEscapeToken.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/escape/OdbcEscapeToken.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/escape/OdbcEscapeToken.java
new file mode 100644
index 0000000..a8b40fa
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/escape/OdbcEscapeToken.java
@@ -0,0 +1,61 @@
+/*
+ * 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.odbc.odbc.escape;
+
+import org.apache.ignite.internal.util.typedef.internal.S;
+
+/**
+ * ODBC escape sequence token.
+ */
+public class OdbcEscapeToken {
+ /** Escape sequence type. */
+ private final OdbcEscapeType type;
+
+ /** Token length. */
+ private final int len;
+
+ /**
+ * Constructor.
+ *
+ * @param type Escape sequence type.
+ * @param len Token length.
+ */
+ public OdbcEscapeToken(OdbcEscapeType type, int len) {
+ this.type = type;
+ this.len = len;
+ }
+
+ /**
+ * @return Escape sequence type.
+ */
+ public OdbcEscapeType type() {
+ return type;
+ }
+
+ /**
+ * @return Token length.
+ */
+ public int length() {
+ return len;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(OdbcEscapeToken.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e5a82d6/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/escape/OdbcEscapeType.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/escape/OdbcEscapeType.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/escape/OdbcEscapeType.java
new file mode 100644
index 0000000..748263d
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/escape/OdbcEscapeType.java
@@ -0,0 +1,112 @@
+/*
+ * 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.odbc.odbc.escape;
+
+/**
+ * ODBC escape sequence type.
+ */
+public enum OdbcEscapeType {
+ /** Scalar function. */
+ SCALAR_FUNCTION("fn", true, false),
+
+ /** Outer join. */
+ OUTER_JOIN("oj", true, false),
+
+ /** Stored procedure call */
+ CALL("call", true, false),
+
+ /** Date. */
+ DATE("d", true, false),
+
+ /** Timestamp. */
+ TIMESTAMP("ts", true, false),
+
+ /** Time. */
+ TIME("t", true, false),
+
+ /** GUID. */
+ GUID("guid", true, false),
+
+ /** LIKE escape character clause. */
+ ESCAPE_WO_TOKEN("\'", false, false),
+
+ /** LIKE escape character clause. */
+ ESCAPE("escape", true, false);
+
+ /** Values in convenient order. */
+ private static final OdbcEscapeType[] VALS = new OdbcEscapeType[] {
+ SCALAR_FUNCTION, // Assume that scalar functions are very frequent.
+ DATE, TIMESTAMP, // Date and timestamp are relatively frequent as well; also TS must go before T.
+ OUTER_JOIN, // Joins are less frequent,
+ CALL, // Procedure calls are less frequent than joins.
+ ESCAPE_WO_TOKEN, ESCAPE, TIME, GUID // LIKE, TIME and GUID are even less frequent.
+ };
+
+ /**
+ * Get values in convenient order, where the most frequent values goes first, and "startsWith" invocation is
+ * enough to get type (i.e. "ts" goes before "t").
+ *
+ * @return Values.
+ */
+ public static OdbcEscapeType[] sortedValues() {
+ return VALS;
+ }
+
+ /** Escape sequence body. */
+ private final String body;
+
+ /** Whether this is a standard token with no special handling. */
+ private final boolean standard;
+
+ /** Whether empty escape sequence is allowed. */
+ private final boolean allowEmpty;
+
+ /**
+ * Constructor.
+ *
+ * @param body Escape sequence body.
+ * @param standard Whether this is a standard token with no special handling.
+ * @param allowEmpty Whether empty escape sequence is allowed.
+ */
+ OdbcEscapeType(String body, boolean standard, boolean allowEmpty) {
+ this.body = body;
+ this.standard = standard;
+ this.allowEmpty = allowEmpty;
+ }
+
+ /**
+ * @return Escape sequence body.
+ */
+ public String body() {
+ return body;
+ }
+
+ /**
+ * @return Whether this is a standard token with no special handling.
+ */
+ public boolean standard() {
+ return standard;
+ }
+
+ /**
+ * @return Whether empty escape sequence is allowed.
+ */
+ public boolean allowEmpty() {
+ return allowEmpty;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e5a82d6/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/escape/OdbcEscapeUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/escape/OdbcEscapeUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/escape/OdbcEscapeUtils.java
new file mode 100644
index 0000000..cd97667
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/escape/OdbcEscapeUtils.java
@@ -0,0 +1,441 @@
+/*
+ * 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.odbc.odbc.escape;
+
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.internal.processors.odbc.OdbcUtils;
+
+import java.util.LinkedList;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * ODBC escape sequence parse.
+ */
+public class OdbcEscapeUtils {
+ /** Odbc date regexp pattern: '2016-08-23' */
+ private static final Pattern DATE_PATTERN = Pattern.compile("^'\\d{4}-\\d{2}-\\d{2}'$");
+
+ /** Odbc time regexp pattern: '14:33:44' */
+ private static final Pattern TIME_PATTERN = Pattern.compile("^'\\d{2}:\\d{2}:\\d{2}'$");
+
+ /** Odbc timestamp regexp pattern: '2016-08-23 14:33:44.12345' */
+ private static final Pattern TIMESTAMP_PATTERN =
+ Pattern.compile("^'\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}(\\.\\d+)?'$");
+
+ /** GUID regexp pattern: '12345678-9abc-def0-1234-123456789abc' */
+ private static final Pattern GUID_PATTERN =
+ Pattern.compile("^'\\p{XDigit}{8}-\\p{XDigit}{4}-\\p{XDigit}{4}-\\p{XDigit}{4}-\\p{XDigit}{12}'$");
+
+ /** CONVERT function data type parameter pattern: last parameter, after comma */
+ private static final Pattern CONVERT_TYPE_PATTERN =
+ Pattern.compile(",\\s*(SQL_[\\w_]+)\\s*(?:\\(\\s*\\d+\\s*(?:,\\s*\\d+\\s*)?\\))?\\s*\\)\\s*$",
+ Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE);
+
+ /**
+ * Parse escape sequence.
+ *
+ * @param text Original text.
+ * @return Result.
+ */
+ public static String parse(String text) {
+ if (text == null)
+ throw new IgniteException("Text cannot be null.");
+
+ return parse0(text.trim(), 0, false).result();
+ }
+
+ /**
+ * Internal parse routine.
+ *
+ * @param text Text.
+ * @param startPos Start position.
+ * @param earlyExit When set to {@code true} we must return as soon as single expression is parsed.
+ * @return Parse result.
+ */
+ private static OdbcEscapeParseResult parse0(String text, int startPos, boolean earlyExit) {
+ StringBuilder res = new StringBuilder();
+
+ int curPos = startPos;
+
+ int plainPos = startPos;
+ int openPos = -1;
+
+ boolean insideLiteral = false;
+
+ LinkedList<OdbcEscapeParseResult> nested = null;
+
+ while (curPos < text.length()) {
+ char curChar = text.charAt(curPos);
+
+ if (curChar == '\'')
+ /* Escaped quote in odbc is two successive singe quotes. They'll flip flag twice without side-effect. */
+ insideLiteral = !insideLiteral;
+ else if (!insideLiteral) {
+ if (curChar == '{') {
+ if (openPos == -1) {
+ // Top-level opening brace. Append previous portion and remember current position.
+ res.append(text, plainPos, curPos);
+
+ openPos = curPos;
+ }
+ else {
+ // Nested opening brace -> perform recursion.
+ OdbcEscapeParseResult nestedRes = parse0(text, curPos, true);
+
+ if (nested == null)
+ nested = new LinkedList<>();
+
+ nested.add(nestedRes);
+
+ curPos += nestedRes.originalLength() - 1;
+
+ plainPos = curPos + 1;
+ }
+ }
+ else if (curChar == '}') {
+ if (openPos == -1)
+ // Close without open -> exception.
+ throw new IgniteException("Malformed escape sequence " +
+ "(closing curly brace without opening curly brace): " + text);
+ else {
+ String parseRes;
+
+ if (nested == null)
+ // Found sequence without nesting, process it.
+ parseRes = parseEscapeSequence(text, openPos, curPos + 1 - openPos);
+ else {
+ // Special case to process nesting.
+ String res0 = appendNested(text, openPos, curPos + 1, nested);
+
+ nested = null;
+
+ parseRes = parseEscapeSequence(res0, 0, res0.length());
+ }
+
+ if (earlyExit)
+ return new OdbcEscapeParseResult(startPos, curPos + 1 - startPos, parseRes);
+ else
+ res.append(parseRes);
+
+ openPos = -1;
+
+ plainPos = curPos + 1;
+ }
+ }
+ }
+
+ curPos++;
+ }
+
+ if (openPos != -1)
+ throw new IgniteException("Malformed escape sequence (closing curly brace missing): " + text);
+
+ if (insideLiteral)
+ throw new IgniteException("Malformed literal expression (closing quote missing): " + text);
+
+ if (curPos > plainPos)
+ res.append(text, plainPos, curPos);
+
+ return new OdbcEscapeParseResult(startPos, curPos - startPos + 1, res.toString());
+ }
+
+ /**
+ * Parse escape sequence: {escape_sequence}.
+ *
+ * @param text Text.
+ * @param startPos Start position within text.
+ * @param len Length.
+ * @return Result.
+ */
+ private static String parseEscapeSequence(String text, int startPos, int len) {
+ assert validSubstring(text, startPos, len);
+
+ char firstChar = text.charAt(startPos);
+
+ if (firstChar == '{') {
+ char lastChar = text.charAt(startPos + len - 1);
+
+ if (lastChar != '}')
+ throw new IgniteException("Failed to parse escape sequence because it is not enclosed: " +
+ substring(text, startPos, len));
+
+ OdbcEscapeToken token = parseToken(text, startPos, len);
+
+ return parseEscapeSequence(text, startPos, len, token);
+ }
+ else {
+ // Nothing to escape, return original string.
+ if (startPos == 0 || text.length() == len)
+ return text;
+ else
+ return substring(text, startPos, len);
+ }
+ }
+
+ /**
+ * Get escape sequence info.
+ *
+ * @param text Text.
+ * @param startPos Start position.
+ * @return Escape sequence info.
+ */
+ private static OdbcEscapeToken parseToken(String text, int startPos, int len) {
+ assert validSubstring(text, startPos, len);
+ assert text.charAt(startPos) == '{';
+
+ int pos = startPos + 1;
+
+ while (Character.isWhitespace(text.charAt(pos)))
+ pos++;
+
+ OdbcEscapeType curTyp = null;
+ boolean empty = false;
+
+ for (OdbcEscapeType typ : OdbcEscapeType.sortedValues()) {
+ if (text.startsWith(typ.body(), pos)) {
+ if (typ.standard())
+ pos += typ.body().length();
+
+ empty = (startPos + len == pos + 1);
+
+ if (!empty && typ.standard()) {
+ char charAfter = text.charAt(pos);
+
+ if (!Character.isWhitespace(charAfter))
+ throw new IgniteException("Unexpected escape sequence token: " +
+ substring(text, startPos, len));
+ }
+
+ curTyp = typ;
+
+ break;
+ }
+ }
+
+ if (curTyp == null)
+ throw new IgniteException("Unsupported escape sequence: " + substring(text, startPos, len));
+
+ if (empty && !curTyp.allowEmpty())
+ throw new IgniteException("Escape sequence cannot be empty: " + substring(text, startPos, len));
+
+ return new OdbcEscapeToken(curTyp, pos - (startPos + 1));
+ }
+
+ /**
+ * Parse standard expression: {TOKEN expression}
+ *
+ * @param text Text.
+ * @param startPos Start position.
+ * @param len Length.
+ * @param token Token.
+ * @return Result.
+ */
+ private static String parseEscapeSequence(String text, int startPos, int len, OdbcEscapeToken token) {
+ assert validSubstring(text, startPos, len);
+
+ // Get expression borders.
+ int startPos0 = startPos + 1 /* open brace */ + token.length() /* token. */;
+ int len0 = len - 1 /* open brace */ - token.length() /* token */ - 1 /* close brace */;
+
+ switch (token.type()) {
+ case SCALAR_FUNCTION:
+ return parseScalarFunctionExpression(text, startPos0, len0);
+
+ case GUID: {
+ String res = parseExpression(text, startPos0, len0, token.type(), GUID_PATTERN);
+
+ return "CAST(" + res + " AS UUID)";
+ }
+
+ case DATE:
+ return parseExpression(text, startPos0, len0, token.type(), DATE_PATTERN);
+
+ case TIME:
+ return parseExpression(text, startPos0, len0, token.type(), TIME_PATTERN);
+
+ case TIMESTAMP:
+ return parseExpression(text, startPos0, len0, token.type(), TIMESTAMP_PATTERN);
+
+ case OUTER_JOIN:
+ return parseExpression(text, startPos0, len0);
+
+ case CALL: {
+ String val = parseExpression(text, startPos0, len0);
+
+ return "CALL " + val;
+ }
+
+ case ESCAPE:
+ case ESCAPE_WO_TOKEN:
+ return parseLikeEscCharacterExpression(text, startPos0, len0);
+
+ default:
+ throw new IgniteException("Unsupported escape sequence token [text=" +
+ substring(text, startPos, len) + ", token=" + token.type().body() + ']');
+ }
+ }
+
+ /**
+ * Parse simple expression.
+ *
+ * @param text Text.
+ * @param startPos Start position.
+ * @param len Length.
+ * @return Parsed expression.
+ */
+ private static String parseExpression(String text, int startPos, int len) {
+ return substring(text, startPos, len).trim();
+ }
+
+ /**
+ * Parse LIKE escape character expression.
+ *
+ * @param text Text.
+ * @param startPos Start position.
+ * @param len Length.
+ * @return Parsed expression.
+ */
+ private static String parseLikeEscCharacterExpression(String text, int startPos, int len) {
+ return "ESCAPE " + substring(text, startPos, len).trim();
+ }
+
+ /**
+ * Parse expression and validate against ODBC specification with regex pattern.
+ *
+ * @param text Text.
+ * @param startPos Start position.
+ * @param len Length.
+ * @return Parsed expression.
+ */
+ private static String parseExpression(String text, int startPos, int len, OdbcEscapeType type, Pattern pattern) {
+ String val = parseExpression(text, startPos, len);
+
+ if (!pattern.matcher(val).matches())
+ throw new IgniteException("Invalid " + type + " escape sequence: " + substring(text, startPos, len));
+
+ return val;
+ }
+
+ /**
+ * Parse scalar function expression.
+ *
+ * @param text Text.
+ * @param startPos Start position.
+ * @param len Length.
+ * @return Parsed expression.
+ */
+ private static String parseScalarFunctionExpression(String text, int startPos, int len) {
+ int pos = startPos;
+ int endPos = startPos + len;
+ final String errPrefix = "Malformed scalar function escape sequence.";
+
+ while ((++pos < endPos) && Character.isWhitespace(text.charAt(pos)));
+ if (pos == endPos)
+ throw new IgniteException(errPrefix + " Expected function name.");
+
+ int funcNamePos = pos;
+ while ((++pos < endPos) && Character.isAlphabetic(text.charAt(pos)));
+ if (pos == endPos)
+ throw new IgniteException(errPrefix + " Expected function parameter list: " +
+ substring(text, startPos, len));
+
+ String funcName = text.substring(funcNamePos, pos);
+
+ switch (funcName.toUpperCase()) {
+ case "CONVERT": {
+ Matcher matcher = CONVERT_TYPE_PATTERN.matcher(text.substring(startPos, endPos));
+
+ if (!matcher.find())
+ throw new IgniteException(errPrefix + " Invalid arguments :" +
+ substring(text, startPos, len));
+
+ return (text.substring(startPos, startPos + matcher.start(1)) +
+ OdbcUtils.getIgniteTypeFromOdbcType(matcher.group(1)) +
+ text.substring(startPos + matcher.end(1), startPos + len)).trim();
+ }
+ default:
+ return substring(text, startPos, len).trim();
+ }
+ }
+
+ /**
+ * Append nested results.
+ *
+ * @param text Original text.
+ * @param startPos Start position.
+ * @param endPos End position.
+ * @param nestedRess Nested results.
+ * @return Result.
+ */
+ private static String appendNested(String text, int startPos, int endPos,
+ LinkedList<OdbcEscapeParseResult> nestedRess) {
+ StringBuilder res = new StringBuilder();
+
+ int curPos = startPos;
+
+ for (OdbcEscapeParseResult nestedRes : nestedRess) {
+ // Append text between current position and replace.
+ res.append(text, curPos, nestedRes.originalStart());
+
+ // Append replaced text.
+ res.append(nestedRes.result());
+
+ // Advance position.
+ curPos = nestedRes.originalStart() + nestedRes.originalLength();
+ }
+
+ // Append remainder.
+ res.append(text, curPos, endPos);
+
+ return res.toString();
+ }
+
+ /**
+ * Perform "substring" using start position and length.
+ *
+ * @param text Text.
+ * @param startPos Start position.
+ * @param len Length.
+ * @return Substring.
+ */
+ private static String substring(String text, int startPos, int len) {
+ assert validSubstring(text, startPos, len);
+
+ return text.substring(startPos, startPos + len);
+ }
+
+ /**
+ * Check whether substring is valid.
+ *
+ * @param text Substring.
+ * @param startPos Start position.
+ * @param len Length.
+ * @return {@code True} if valid.
+ */
+ private static boolean validSubstring(String text, int startPos, int len) {
+ return text != null && startPos + len <= text.length();
+ }
+
+ /**
+ * Private constructor.
+ */
+ private OdbcEscapeUtils() {
+ // No-op.
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e5a82d6/modules/core/src/main/resources/META-INF/classnames.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties
index ca5f756..8349687 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -1220,7 +1220,7 @@ org.apache.ignite.internal.processors.marshaller.MarshallerMappingItem
org.apache.ignite.internal.processors.marshaller.MissingMappingRequestMessage
org.apache.ignite.internal.processors.marshaller.MissingMappingResponseMessage
org.apache.ignite.internal.processors.odbc.OdbcProtocolVersion
-org.apache.ignite.internal.processors.odbc.escape.OdbcEscapeType
+org.apache.ignite.internal.processors.odbc.odbc.escape.OdbcEscapeType
org.apache.ignite.internal.processors.platform.PlatformAbstractConfigurationClosure
org.apache.ignite.internal.processors.platform.PlatformAbstractPredicate
org.apache.ignite.internal.processors.platform.PlatformEventFilterListener
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e5a82d6/modules/core/src/test/java/org/apache/ignite/internal/processors/odbc/OdbcEscapeSequenceSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/odbc/OdbcEscapeSequenceSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/odbc/OdbcEscapeSequenceSelfTest.java
index ecb6c2d..c08c40c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/odbc/OdbcEscapeSequenceSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/odbc/OdbcEscapeSequenceSelfTest.java
@@ -18,7 +18,7 @@
package org.apache.ignite.internal.processors.odbc;
import org.apache.ignite.IgniteException;
-import org.apache.ignite.internal.processors.odbc.escape.OdbcEscapeUtils;
+import org.apache.ignite.internal.processors.odbc.odbc.escape.OdbcEscapeUtils;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e5a82d6/modules/platforms/cpp/odbc-test/src/configuration_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/configuration_test.cpp b/modules/platforms/cpp/odbc-test/src/configuration_test.cpp
index 3893ad9..d182f93 100644
--- a/modules/platforms/cpp/odbc-test/src/configuration_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/configuration_test.cpp
@@ -276,8 +276,7 @@ BOOST_AUTO_TEST_CASE(TestConnectStringInvalidVersion)
BOOST_AUTO_TEST_CASE(TestConnectStringValidVersion)
{
- CheckValidProtocolVersion("Protocol_Version=1.6.0;", ignite::odbc::ProtocolVersion::VERSION_1_6_0);
- CheckValidProtocolVersion("Protocol_Version=1.8.0;", ignite::odbc::ProtocolVersion::VERSION_1_8_0);
+ CheckValidProtocolVersion("Protocol_Version=2.0.0;", ignite::odbc::ProtocolVersion::VERSION_2_0_0);
}
BOOST_AUTO_TEST_CASE(TestConnectStringInvalidBoolKeys)
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e5a82d6/modules/platforms/cpp/odbc-test/src/queries_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/queries_test.cpp b/modules/platforms/cpp/odbc-test/src/queries_test.cpp
index fdf3503..0f9eaee 100644
--- a/modules/platforms/cpp/odbc-test/src/queries_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/queries_test.cpp
@@ -378,14 +378,9 @@ BOOST_AUTO_TEST_CASE(TestLegacyConnection)
Connect("DRIVER={Apache Ignite};SERVER=127.0.0.1;PORT=11110;CACHE=cache");
}
-BOOST_AUTO_TEST_CASE(TestConnectionProtocolVersion_1_6_0)
+BOOST_AUTO_TEST_CASE(TestConnectionProtocolVERSION_2_0_0)
{
- Connect("DRIVER={Apache Ignite};ADDRESS=127.0.0.1:11110;CACHE=cache;PROTOCOL_VERSION=1.6.0");
-}
-
-BOOST_AUTO_TEST_CASE(TestConnectionProtocolVersion_1_8_0)
-{
- Connect("DRIVER={Apache Ignite};ADDRESS=127.0.0.1:11110;CACHE=cache;PROTOCOL_VERSION=1.8.0");
+ Connect("DRIVER={Apache Ignite};ADDRESS=127.0.0.1:11110;CACHE=cache;PROTOCOL_VERSION=2.0.0");
}
BOOST_AUTO_TEST_CASE(TestTwoRowsInt8)
@@ -950,7 +945,6 @@ BOOST_AUTO_TEST_CASE(TestNullFields)
BOOST_CHECK(ret == SQL_NO_DATA);
}
-
BOOST_AUTO_TEST_CASE(TestDistributedJoins)
{
// Starting additional node.
@@ -1025,58 +1019,6 @@ BOOST_AUTO_TEST_CASE(TestDistributedJoins)
BOOST_CHECK_EQUAL(rowsNum, entriesNum);
}
-BOOST_AUTO_TEST_CASE(TestDistributedJoinsWithOldVersion)
-{
- // Starting additional node.
- Ignite node1 = StartAdditionalNode("Node1");
- Ignite node2 = StartAdditionalNode("Node2");
-
- const int entriesNum = 1000;
-
- // Filling cache with data.
- for (int i = 0; i < entriesNum; ++i)
- {
- TestType entry;
-
- entry.i32Field = i;
- entry.i64Field = entriesNum - i - 1;
-
- cache1.Put(i, entry);
- }
-
- Connect("DRIVER={Apache Ignite};ADDRESS=127.0.0.1:11110;CACHE=cache;DISTRIBUTED_JOINS=true;PROTOCOL_VERSION=1.6.0");
-
- SQLRETURN ret;
-
- const size_t columnsCnt = 2;
-
- SQLBIGINT columns[columnsCnt] = { 0 };
-
- // Binding colums.
- for (SQLSMALLINT i = 0; i < columnsCnt; ++i)
- {
- ret = SQLBindCol(stmt, i + 1, SQL_C_SLONG, &columns[i], 0, 0);
-
- if (!SQL_SUCCEEDED(ret))
- BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
- }
-
- SQLCHAR request[] =
- "SELECT T0.i32Field, T1.i64Field FROM TestType AS T0 "
- "INNER JOIN TestType AS T1 "
- "ON (T0.i32Field = T1.i64Field)";
-
- ret = SQLExecDirect(stmt, request, SQL_NTS);
-
- if (!SQL_SUCCEEDED(ret))
- BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
-
- int rowsNum = CountRows(stmt);
-
- BOOST_CHECK_GT(rowsNum, 0);
- BOOST_CHECK_LT(rowsNum, entriesNum);
-}
-
BOOST_AUTO_TEST_CASE(TestInsertSelect)
{
Connect("DRIVER={Apache Ignite};ADDRESS=127.0.0.1:11110;CACHE=cache");
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e5a82d6/modules/platforms/cpp/odbc/include/ignite/odbc/protocol_version.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/protocol_version.h b/modules/platforms/cpp/odbc/include/ignite/odbc/protocol_version.h
index d3d288e..bb42dd4 100644
--- a/modules/platforms/cpp/odbc/include/ignite/odbc/protocol_version.h
+++ b/modules/platforms/cpp/odbc/include/ignite/odbc/protocol_version.h
@@ -37,11 +37,8 @@ namespace ignite
/** Version to string map type alias. */
typedef std::map<ProtocolVersion, std::string> VersionToStringMap;
- /** First version of the protocol that was introduced in Ignite 1.6.0. */
- static const ProtocolVersion VERSION_1_6_0;
-
- /** First version of the protocol that was introduced in Ignite 1.8.0. */
- static const ProtocolVersion VERSION_1_8_0;
+ /** First version of the protocol that was introduced in Ignite 2.0.0. */
+ static const ProtocolVersion VERSION_2_0_0;
/** Unknown version of the protocol. */
static const ProtocolVersion VERSION_UNKNOWN;
@@ -93,13 +90,6 @@ namespace ignite
bool IsUnknown() const;
/**
- * Check if the distributed joins supported.
- *
- * @retuen True if the distributed joins supported.
- */
- bool IsDistributedJoinsSupported() const;
-
- /**
* Comparison operator.
*
* @param val1 First value.
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e5a82d6/modules/platforms/cpp/odbc/os/win/src/system/ui/dsn_configuration_window.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/os/win/src/system/ui/dsn_configuration_window.cpp b/modules/platforms/cpp/odbc/os/win/src/system/ui/dsn_configuration_window.cpp
index c839999..4a88052 100644
--- a/modules/platforms/cpp/odbc/os/win/src/system/ui/dsn_configuration_window.cpp
+++ b/modules/platforms/cpp/odbc/os/win/src/system/ui/dsn_configuration_window.cpp
@@ -159,12 +159,6 @@ namespace ignite
enforceJoinOrderCheckBox = CreateCheckBox(editPosX + checkBoxSize + interval, rowPos, checkBoxSize,
rowSize, "Enforce Join Order", ChildId::ENFORCE_JOIN_ORDER_CHECK_BOX, config.IsEnforceJoinOrder());
- if (!config.GetProtocolVersion().IsDistributedJoinsSupported())
- {
- distributedJoinsCheckBox->SetEnabled(false);
- enforceJoinOrderCheckBox->SetEnabled(false);
- }
-
rowPos += interval * 2 + rowSize;
connectionSettingsGroupBox = CreateGroupBox(margin, sectionBegin, width - 2 * margin,
@@ -206,31 +200,6 @@ namespace ignite
break;
}
- case ChildId::PROTOCOL_VERSION_COMBO_BOX:
- {
- if (HIWORD(wParam) == CBN_SELCHANGE)
- {
- std::string text;
-
- protocolVersionComboBox->GetText(text);
-
- ProtocolVersion version = ProtocolVersion::FromString(text);
-
- if (!version.IsUnknown() && !version.IsDistributedJoinsSupported())
- {
- distributedJoinsCheckBox->SetEnabled(false);
- enforceJoinOrderCheckBox->SetEnabled(false);
- }
- else
- {
- distributedJoinsCheckBox->SetEnabled(true);
- enforceJoinOrderCheckBox->SetEnabled(true);
- }
- }
-
- break;
- }
-
case IDCANCEL:
case ChildId::CANCEL_BUTTON:
{
@@ -253,6 +222,7 @@ namespace ignite
break;
}
+ case ChildId::PROTOCOL_VERSION_COMBO_BOX:
default:
return false;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e5a82d6/modules/platforms/cpp/odbc/src/protocol_version.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/protocol_version.cpp b/modules/platforms/cpp/odbc/src/protocol_version.cpp
index ebd3b6a..859135d 100644
--- a/modules/platforms/cpp/odbc/src/protocol_version.cpp
+++ b/modules/platforms/cpp/odbc/src/protocol_version.cpp
@@ -25,21 +25,18 @@ namespace ignite
{
namespace odbc
{
- const ProtocolVersion ProtocolVersion::VERSION_1_6_0(1);
- const ProtocolVersion ProtocolVersion::VERSION_1_8_0(MakeVersion(1,8,0));
+ const ProtocolVersion ProtocolVersion::VERSION_2_0_0(MakeVersion(2,0,0));
const ProtocolVersion ProtocolVersion::VERSION_UNKNOWN(INT64_MIN);
ProtocolVersion::StringToVersionMap::value_type s2vInitVals[] = {
- std::make_pair("1.6.0", ProtocolVersion::VERSION_1_6_0),
- std::make_pair("1.8.0", ProtocolVersion::VERSION_1_8_0)
+ std::make_pair("2.0.0", ProtocolVersion::VERSION_2_0_0)
};
const ProtocolVersion::StringToVersionMap ProtocolVersion::stringToVersionMap(s2vInitVals,
s2vInitVals + (sizeof(s2vInitVals) / sizeof(s2vInitVals[0])));
ProtocolVersion::VersionToStringMap::value_type v2sInitVals[] = {
- std::make_pair(ProtocolVersion::VERSION_1_6_0, "1.6.0"),
- std::make_pair(ProtocolVersion::VERSION_1_8_0, "1.8.0")
+ std::make_pair(ProtocolVersion::VERSION_2_0_0, "2.0.0")
};
const ProtocolVersion::VersionToStringMap ProtocolVersion::versionToStringMap(v2sInitVals,
@@ -64,7 +61,7 @@ namespace ignite
const ProtocolVersion& ProtocolVersion::GetCurrent()
{
- return VERSION_1_8_0;
+ return VERSION_2_0_0;
}
ProtocolVersion ProtocolVersion::FromString(const std::string& version)
@@ -106,11 +103,6 @@ namespace ignite
return *this == VERSION_UNKNOWN;
}
- bool ProtocolVersion::IsDistributedJoinsSupported() const
- {
- return *this >= VERSION_1_8_0;
- }
-
bool operator==(const ProtocolVersion& val1, const ProtocolVersion& val2)
{
return val1.val == val2.val;
[10/50] [abbrv] ignite git commit: Release notes for 2.0.
Posted by sb...@apache.org.
Release notes for 2.0.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6ab579c7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6ab579c7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6ab579c7
Branch: refs/heads/ignite-5009
Commit: 6ab579c77123d72fee14c5bf9401ef0c4959c839
Parents: e80773b
Author: devozerov <vo...@gridgain.com>
Authored: Fri Apr 28 18:16:24 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Fri Apr 28 18:16:24 2017 +0300
----------------------------------------------------------------------
RELEASE_NOTES.txt | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6ab579c7/RELEASE_NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index 65cc9d4..b64aced 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -1,6 +1,42 @@
Apache Ignite Release Notes
===========================
+Apache Ignite In-Memory Data Fabric 2.0
+---------------------------------------
+Ignite:
+* Introduced new page memory architecture
+* Machine Learning beta: distributed algebra support for dense and sparse data sets
+* Reworked and simplified API for asynchronous operations
+* Custom thread pool executors for compute tasks
+* Removed CLOCK mode in ATOMIC cache
+* Deprecated schema-import utility in favor of Web Console
+* Integration with Spring Data
+* Integration with Hibernate 5
+* Integration with RocketMQ
+* Integration with ZeroMQ
+* SQL: CREATE INDEX and DROP INDEX commands
+* SQL: Ability to execute queries over specific set of partitions
+* SQL: Improved REPLICATED cache support
+* SQL: Updated H2 version to 1.4.195
+* SQL: Improved performance of MIN/MAX aggregate functions
+* ODBC: Added Time data type support
+* Massive performance improvements
+
+Ignite.NET:
+* Custom plugin API
+* Generic cache store
+* Binary types now can be registered dynamically
+* LINQ: join, "contains" and DateTime property support
+
+Ignite CPP:
+* Implemented Cache::Invoke
+* Added remote filters support to continuous queries
+
+Web Console:
+* Multi-cluster support
+* Possibility to configure Kubernetes IP finder
+* EnforceJoinOrder option on Queries screen
+
Apache Ignite In-Memory Data Fabric 1.9
---------------------------------------
Ignite:
[30/50] [abbrv] ignite git commit: IGNITE-5012 Implement ordinary
least squares (OLS) linear regression.
Posted by sb...@apache.org.
IGNITE-5012 Implement ordinary least squares (OLS) linear regression.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/934f6ac2
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/934f6ac2
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/934f6ac2
Branch: refs/heads/ignite-5009
Commit: 934f6ac22c04f652815f79a9238ea72b9111a7e8
Parents: 156ec53
Author: Artem Malykh <am...@gridgain.com>
Authored: Wed May 3 20:05:18 2017 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Wed May 3 20:05:18 2017 +0300
----------------------------------------------------------------------
.../org/apache/ignite/ml/math/Precision.java | 588 ++++++++++++++
.../java/org/apache/ignite/ml/math/Tracer.java | 22 +-
.../decompositions/CholeskyDecomposition.java | 6 +-
.../math/decompositions/EigenDecomposition.java | 6 +-
.../ml/math/decompositions/LUDecomposition.java | 9 +-
.../ml/math/decompositions/QRDecomposition.java | 70 +-
.../SingularValueDecomposition.java | 5 +-
.../math/exceptions/CardinalityException.java | 6 +-
.../exceptions/InsufficientDataException.java | 44 +
.../exceptions/MathArithmeticException.java | 47 ++
.../MathIllegalArgumentException.java | 37 +
.../math/exceptions/MathRuntimeException.java | 47 ++
.../ml/math/exceptions/NoDataException.java | 45 +
.../NonPositiveDefiniteMatrixException.java | 8 +-
.../exceptions/NonSquareMatrixException.java | 33 +
.../math/exceptions/NullArgumentException.java | 27 +
.../exceptions/SingularMatrixException.java | 9 +-
.../ignite/ml/math/functions/Functions.java | 5 +
.../apache/ignite/ml/math/util/MatrixUtil.java | 121 +++
.../AbstractMultipleLinearRegression.java | 358 ++++++++
.../regressions/MultipleLinearRegression.java | 71 ++
.../OLSMultipleLinearRegression.java | 272 +++++++
.../regressions/RegressionsErrorMessages.java | 28 +
.../ignite/ml/regressions/package-info.java | 22 +
.../java/org/apache/ignite/ml/TestUtils.java | 248 ++++++
.../apache/ignite/ml/math/ExternalizeTest.java | 1 +
.../ignite/ml/math/MathImplLocalTestSuite.java | 7 +-
.../CholeskyDecompositionTest.java | 6 +-
.../decompositions/LUDecompositionTest.java | 6 +-
.../decompositions/QRDecompositionTest.java | 6 +-
.../SingularValueDecompositionTest.java | 6 +-
.../AbstractMultipleLinearRegressionTest.java | 164 ++++
.../OLSMultipleLinearRegressionTest.java | 812 +++++++++++++++++++
33 files changed, 3100 insertions(+), 42 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/934f6ac2/modules/ml/src/main/java/org/apache/ignite/ml/math/Precision.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/Precision.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/Precision.java
new file mode 100644
index 0000000..830644c
--- /dev/null
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/Precision.java
@@ -0,0 +1,588 @@
+/*
+ * 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.ml.math;
+
+import java.math.BigDecimal;
+import org.apache.ignite.ml.math.exceptions.MathArithmeticException;
+import org.apache.ignite.ml.math.exceptions.MathIllegalArgumentException;
+
+/**
+ * This class is based on the corresponding class from Apache Common Math lib.
+ * Utilities for comparing numbers. *
+ */
+public class Precision {
+ /**
+ * <p>
+ * Largest double-precision floating-point number such that
+ * {@code 1 + EPSILON} is numerically equal to 1. This value is an upper
+ * bound on the relative error due to rounding real numbers to double
+ * precision floating-point numbers.
+ * </p>
+ * <p>
+ * In IEEE 754 arithmetic, this is 2<sup>-53</sup>.
+ * </p>
+ *
+ * @see <a href="http://en.wikipedia.org/wiki/Machine_epsilon">Machine epsilon</a>
+ */
+ public static final double EPSILON;
+
+ /**
+ * Safe minimum, such that {@code 1 / SAFE_MIN} does not overflow.
+ * <br/>
+ * In IEEE 754 arithmetic, this is also the smallest normalized
+ * number 2<sup>-1022</sup>.
+ */
+ public static final double SAFE_MIN;
+
+ /** Exponent offset in IEEE754 representation. */
+ private static final long EXPONENT_OFFSET = 1023L;
+
+ /** Offset to order signed double numbers lexicographically. */
+ private static final long SGN_MASK = 0x8000000000000000L;
+ /** Offset to order signed double numbers lexicographically. */
+ private static final int SGN_MASK_FLOAT = 0x80000000;
+ /** Positive zero. */
+ private static final double POSITIVE_ZERO = 0d;
+ /** Positive zero bits. */
+ private static final long POSITIVE_ZERO_DOUBLE_BITS = Double.doubleToRawLongBits(+0.0);
+ /** Negative zero bits. */
+ private static final long NEGATIVE_ZERO_DOUBLE_BITS = Double.doubleToRawLongBits(-0.0);
+ /** Positive zero bits. */
+ private static final int POSITIVE_ZERO_FLOAT_BITS = Float.floatToRawIntBits(+0.0f);
+ /** Negative zero bits. */
+ private static final int NEGATIVE_ZERO_FLOAT_BITS = Float.floatToRawIntBits(-0.0f);
+ /** */
+ private static final String INVALID_ROUNDING_METHOD = "invalid rounding method {0}, " +
+ "valid methods: {1} ({2}), {3} ({4}), {5} ({6}), {7} ({8}), {9} ({10}), {11} ({12}), {13} ({14}), {15} ({16})";
+
+ static {
+ /*
+ * This was previously expressed as = 0x1.0p-53;
+ * However, OpenJDK (Sparc Solaris) cannot handle such small
+ * constants: MATH-721
+ */
+ EPSILON = Double.longBitsToDouble((EXPONENT_OFFSET - 53L) << 52);
+
+ /*
+ * This was previously expressed as = 0x1.0p-1022;
+ * However, OpenJDK (Sparc Solaris) cannot handle such small
+ * constants: MATH-721
+ */
+ SAFE_MIN = Double.longBitsToDouble((EXPONENT_OFFSET - 1022L) << 52);
+ }
+
+ /**
+ * Private constructor.
+ */
+ private Precision() {
+ }
+
+ /**
+ * Compares two numbers given some amount of allowed error.
+ *
+ * @param x the first number
+ * @param y the second number
+ * @param eps the amount of error to allow when checking for equality
+ * @return <ul><li>0 if {@link #equals(double, double, double) equals(x, y, eps)}</li> <li>< 0 if !{@link
+ * #equals(double, double, double) equals(x, y, eps)} && x < y</li> <li>> 0 if !{@link #equals(double,
+ * double, double) equals(x, y, eps)} && x > y or either argument is NaN</li></ul>
+ */
+ public static int compareTo(double x, double y, double eps) {
+ if (equals(x, y, eps))
+ return 0;
+ else if (x < y)
+ return -1;
+ return 1;
+ }
+
+ /**
+ * Compares two numbers given some amount of allowed error.
+ * Two float numbers are considered equal if there are {@code (maxUlps - 1)}
+ * (or fewer) floating point numbers between them, i.e. two adjacent floating
+ * point numbers are considered equal.
+ * Adapted from <a
+ * href="http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/">
+ * Bruce Dawson</a>. Returns {@code false} if either of the arguments is NaN.
+ *
+ * @param x first value
+ * @param y second value
+ * @param maxUlps {@code (maxUlps - 1)} is the number of floating point values between {@code x} and {@code y}.
+ * @return <ul><li>0 if {@link #equals(double, double, int) equals(x, y, maxUlps)}</li> <li>< 0 if !{@link
+ * #equals(double, double, int) equals(x, y, maxUlps)} && x < y</li> <li>> 0 if !{@link
+ * #equals(double, double, int) equals(x, y, maxUlps)} && x > y or either argument is NaN</li></ul>
+ */
+ public static int compareTo(final double x, final double y, final int maxUlps) {
+ if (equals(x, y, maxUlps))
+ return 0;
+ else if (x < y)
+ return -1;
+ return 1;
+ }
+
+ /**
+ * Returns true iff they are equal as defined by
+ * {@link #equals(float, float, int) equals(x, y, 1)}.
+ *
+ * @param x first value
+ * @param y second value
+ * @return {@code true} if the values are equal.
+ */
+ public static boolean equals(float x, float y) {
+ return equals(x, y, 1);
+ }
+
+ /**
+ * Returns true if both arguments are NaN or they are
+ * equal as defined by {@link #equals(float, float) equals(x, y, 1)}.
+ *
+ * @param x first value
+ * @param y second value
+ * @return {@code true} if the values are equal or both are NaN.
+ * @since 2.2
+ */
+ public static boolean equalsIncludingNaN(float x, float y) {
+ return (x != x || y != y) ? !(x != x ^ y != y) : equals(x, y, 1);
+ }
+
+ /**
+ * Returns true if the arguments are equal or within the range of allowed
+ * error (inclusive). Returns {@code false} if either of the arguments
+ * is NaN.
+ *
+ * @param x first value
+ * @param y second value
+ * @param eps the amount of absolute error to allow.
+ * @return {@code true} if the values are equal or within range of each other.
+ * @since 2.2
+ */
+ public static boolean equals(float x, float y, float eps) {
+ return equals(x, y, 1) || Math.abs(y - x) <= eps;
+ }
+
+ /**
+ * Returns true if the arguments are both NaN, are equal, or are within the range
+ * of allowed error (inclusive).
+ *
+ * @param x first value
+ * @param y second value
+ * @param eps the amount of absolute error to allow.
+ * @return {@code true} if the values are equal or within range of each other, or both are NaN.
+ * @since 2.2
+ */
+ public static boolean equalsIncludingNaN(float x, float y, float eps) {
+ return equalsIncludingNaN(x, y) || (Math.abs(y - x) <= eps);
+ }
+
+ /**
+ * Returns true if the arguments are equal or within the range of allowed
+ * error (inclusive).
+ * Two float numbers are considered equal if there are {@code (maxUlps - 1)}
+ * (or fewer) floating point numbers between them, i.e. two adjacent floating
+ * point numbers are considered equal.
+ * Adapted from <a
+ * href="http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/">
+ * Bruce Dawson</a>. Returns {@code false} if either of the arguments is NaN.
+ *
+ * @param x first value
+ * @param y second value
+ * @param maxUlps {@code (maxUlps - 1)} is the number of floating point values between {@code x} and {@code y}.
+ * @return {@code true} if there are fewer than {@code maxUlps} floating point values between {@code x} and {@code
+ * y}.
+ * @since 2.2
+ */
+ public static boolean equals(final float x, final float y, final int maxUlps) {
+
+ final int xInt = Float.floatToRawIntBits(x);
+ final int yInt = Float.floatToRawIntBits(y);
+
+ final boolean isEqual;
+ if (((xInt ^ yInt) & SGN_MASK_FLOAT) == 0) {
+ // number have same sign, there is no risk of overflow
+ isEqual = Math.abs(xInt - yInt) <= maxUlps;
+ }
+ else {
+ // number have opposite signs, take care of overflow
+ final int deltaPlus;
+ final int deltaMinus;
+ if (xInt < yInt) {
+ deltaPlus = yInt - POSITIVE_ZERO_FLOAT_BITS;
+ deltaMinus = xInt - NEGATIVE_ZERO_FLOAT_BITS;
+ }
+ else {
+ deltaPlus = xInt - POSITIVE_ZERO_FLOAT_BITS;
+ deltaMinus = yInt - NEGATIVE_ZERO_FLOAT_BITS;
+ }
+
+ if (deltaPlus > maxUlps)
+ isEqual = false;
+ else
+ isEqual = deltaMinus <= (maxUlps - deltaPlus);
+
+ }
+
+ return isEqual && !Float.isNaN(x) && !Float.isNaN(y);
+
+ }
+
+ /**
+ * Returns true if the arguments are both NaN or if they are equal as defined
+ * by {@link #equals(float, float, int) equals(x, y, maxUlps)}.
+ *
+ * @param x first value
+ * @param y second value
+ * @param maxUlps {@code (maxUlps - 1)} is the number of floating point values between {@code x} and {@code y}.
+ * @return {@code true} if both arguments are NaN or if there are less than {@code maxUlps} floating point values
+ * between {@code x} and {@code y}.
+ * @since 2.2
+ */
+ public static boolean equalsIncludingNaN(float x, float y, int maxUlps) {
+ return (x != x || y != y) ? !(x != x ^ y != y) : equals(x, y, maxUlps);
+ }
+
+ /**
+ * Returns true iff they are equal as defined by
+ * {@link #equals(double, double, int) equals(x, y, 1)}.
+ *
+ * @param x first value
+ * @param y second value
+ * @return {@code true} if the values are equal.
+ */
+ public static boolean equals(double x, double y) {
+ return equals(x, y, 1);
+ }
+
+ /**
+ * Returns true if the arguments are both NaN or they are
+ * equal as defined by {@link #equals(double, double) equals(x, y, 1)}.
+ *
+ * @param x first value
+ * @param y second value
+ * @return {@code true} if the values are equal or both are NaN.
+ * @since 2.2
+ */
+ public static boolean equalsIncludingNaN(double x, double y) {
+ return (x != x || y != y) ? !(x != x ^ y != y) : equals(x, y, 1);
+ }
+
+ /**
+ * Returns {@code true} if there is no double value strictly between the
+ * arguments or the difference between them is within the range of allowed
+ * error (inclusive). Returns {@code false} if either of the arguments
+ * is NaN.
+ *
+ * @param x First value.
+ * @param y Second value.
+ * @param eps Amount of allowed absolute error.
+ * @return {@code true} if the values are two adjacent floating point numbers or they are within range of each
+ * other.
+ */
+ public static boolean equals(double x, double y, double eps) {
+ return equals(x, y, 1) || Math.abs(y - x) <= eps;
+ }
+
+ /**
+ * Returns {@code true} if there is no double value strictly between the
+ * arguments or the relative difference between them is less than or equal
+ * to the given tolerance. Returns {@code false} if either of the arguments
+ * is NaN.
+ *
+ * @param x First value.
+ * @param y Second value.
+ * @param eps Amount of allowed relative error.
+ * @return {@code true} if the values are two adjacent floating point numbers or they are within range of each
+ * other.
+ * @since 3.1
+ */
+ public static boolean equalsWithRelativeTolerance(double x, double y, double eps) {
+ if (equals(x, y, 1))
+ return true;
+
+ final double absMax = Math.max(Math.abs(x), Math.abs(y));
+ final double relativeDifference = Math.abs((x - y) / absMax);
+
+ return relativeDifference <= eps;
+ }
+
+ /**
+ * Returns true if the arguments are both NaN, are equal or are within the range
+ * of allowed error (inclusive).
+ *
+ * @param x first value
+ * @param y second value
+ * @param eps the amount of absolute error to allow.
+ * @return {@code true} if the values are equal or within range of each other, or both are NaN.
+ * @since 2.2
+ */
+ public static boolean equalsIncludingNaN(double x, double y, double eps) {
+ return equalsIncludingNaN(x, y) || (Math.abs(y - x) <= eps);
+ }
+
+ /**
+ * Returns true if the arguments are equal or within the range of allowed
+ * error (inclusive).
+ * <p>
+ * Two float numbers are considered equal if there are {@code (maxUlps - 1)}
+ * (or fewer) floating point numbers between them, i.e. two adjacent
+ * floating point numbers are considered equal.
+ * </p>
+ * <p>
+ * Adapted from <a
+ * href="http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/">
+ * Bruce Dawson</a>. Returns {@code false} if either of the arguments is NaN.
+ * </p>
+ *
+ * @param x first value
+ * @param y second value
+ * @param maxUlps {@code (maxUlps - 1)} is the number of floating point values between {@code x} and {@code y}.
+ * @return {@code true} if there are fewer than {@code maxUlps} floating point values between {@code x} and {@code
+ * y}.
+ */
+ public static boolean equals(final double x, final double y, final int maxUlps) {
+
+ final long xInt = Double.doubleToRawLongBits(x);
+ final long yInt = Double.doubleToRawLongBits(y);
+
+ final boolean isEqual;
+ if (((xInt ^ yInt) & SGN_MASK) == 0L) {
+ // number have same sign, there is no risk of overflow
+ isEqual = Math.abs(xInt - yInt) <= maxUlps;
+ }
+ else {
+ // number have opposite signs, take care of overflow
+ final long deltaPlus;
+ final long deltaMinus;
+ if (xInt < yInt) {
+ deltaPlus = yInt - POSITIVE_ZERO_DOUBLE_BITS;
+ deltaMinus = xInt - NEGATIVE_ZERO_DOUBLE_BITS;
+ }
+ else {
+ deltaPlus = xInt - POSITIVE_ZERO_DOUBLE_BITS;
+ deltaMinus = yInt - NEGATIVE_ZERO_DOUBLE_BITS;
+ }
+
+ if (deltaPlus > maxUlps)
+ isEqual = false;
+ else
+ isEqual = deltaMinus <= (maxUlps - deltaPlus);
+
+ }
+
+ return isEqual && !Double.isNaN(x) && !Double.isNaN(y);
+
+ }
+
+ /**
+ * Returns true if both arguments are NaN or if they are equal as defined
+ * by {@link #equals(double, double, int) equals(x, y, maxUlps)}.
+ *
+ * @param x first value
+ * @param y second value
+ * @param maxUlps {@code (maxUlps - 1)} is the number of floating point values between {@code x} and {@code y}.
+ * @return {@code true} if both arguments are NaN or if there are less than {@code maxUlps} floating point values
+ * between {@code x} and {@code y}.
+ * @since 2.2
+ */
+ public static boolean equalsIncludingNaN(double x, double y, int maxUlps) {
+ return (x != x || y != y) ? !(x != x ^ y != y) : equals(x, y, maxUlps);
+ }
+
+ /**
+ * Rounds the given value to the specified number of decimal places.
+ * The value is rounded using the {@link BigDecimal#ROUND_HALF_UP} method.
+ *
+ * @param x Value to round.
+ * @param scale Number of digits to the right of the decimal point.
+ * @return the rounded value.
+ * @since 1.1 (previously in {@code MathUtils}, moved as of version 3.0)
+ */
+ public static double round(double x, int scale) {
+ return round(x, scale, BigDecimal.ROUND_HALF_UP);
+ }
+
+ /**
+ * Rounds the given value to the specified number of decimal places.
+ * The value is rounded using the given method which is any method defined
+ * in {@link BigDecimal}.
+ * If {@code x} is infinite or {@code NaN}, then the value of {@code x} is
+ * returned unchanged, regardless of the other parameters.
+ *
+ * @param x Value to round.
+ * @param scale Number of digits to the right of the decimal point.
+ * @param roundingMtd Rounding method as defined in {@link BigDecimal}.
+ * @return the rounded value.
+ * @throws ArithmeticException if {@code roundingMethod == ROUND_UNNECESSARY} and the specified scaling operation
+ * would require rounding.
+ * @throws IllegalArgumentException if {@code roundingMethod} does not represent a valid rounding mode.
+ * @since 1.1 (previously in {@code MathUtils}, moved as of version 3.0)
+ */
+ public static double round(double x, int scale, int roundingMtd) {
+ try {
+ final double rounded = (new BigDecimal(Double.toString(x))
+ .setScale(scale, roundingMtd))
+ .doubleValue();
+ // MATH-1089: negative values rounded to zero should result in negative zero
+ return rounded == POSITIVE_ZERO ? POSITIVE_ZERO * x : rounded;
+ }
+ catch (NumberFormatException ex) {
+ if (Double.isInfinite(x))
+ return x;
+ else
+ return Double.NaN;
+ }
+ }
+
+ /**
+ * Rounds the given value to the specified number of decimal places.
+ * The value is rounded using the {@link BigDecimal#ROUND_HALF_UP} method.
+ *
+ * @param x Value to round.
+ * @param scale Number of digits to the right of the decimal point.
+ * @return the rounded value.
+ * @since 1.1 (previously in {@code MathUtils}, moved as of version 3.0)
+ */
+ public static float round(float x, int scale) {
+ return round(x, scale, BigDecimal.ROUND_HALF_UP);
+ }
+
+ /**
+ * Rounds the given value to the specified number of decimal places.
+ * The value is rounded using the given method which is any method defined
+ * in {@link BigDecimal}.
+ *
+ * @param x Value to round.
+ * @param scale Number of digits to the right of the decimal point.
+ * @param roundingMtd Rounding method as defined in {@link BigDecimal}.
+ * @return the rounded value.
+ * @throws MathArithmeticException if an exact operation is required but result is not exact
+ * @throws MathIllegalArgumentException if {@code roundingMethod} is not a valid rounding method.
+ * @since 1.1 (previously in {@code MathUtils}, moved as of version 3.0)
+ */
+ public static float round(float x, int scale, int roundingMtd)
+ throws MathArithmeticException, MathIllegalArgumentException {
+ final float sign = Math.copySign(1f, x);
+ final float factor = (float)Math.pow(10.0f, scale) * sign;
+ return (float)roundUnscaled(x * factor, sign, roundingMtd) / factor;
+ }
+
+ /**
+ * Rounds the given non-negative value to the "nearest" integer. Nearest is
+ * determined by the rounding method specified. Rounding methods are defined
+ * in {@link BigDecimal}.
+ *
+ * @param unscaled Value to round.
+ * @param sign Sign of the original, scaled value.
+ * @param roundingMtd Rounding method, as defined in {@link BigDecimal}.
+ * @return the rounded value.
+ * @throws MathArithmeticException if an exact operation is required but result is not exact
+ * @throws MathIllegalArgumentException if {@code roundingMethod} is not a valid rounding method.
+ * @since 1.1 (previously in {@code MathUtils}, moved as of version 3.0)
+ */
+ private static double roundUnscaled(double unscaled, double sign, int roundingMtd)
+ throws MathArithmeticException, MathIllegalArgumentException {
+ switch (roundingMtd) {
+ case BigDecimal.ROUND_CEILING:
+ if (sign == -1)
+ unscaled = Math.floor(Math.nextAfter(unscaled, Double.NEGATIVE_INFINITY));
+ else
+ unscaled = Math.ceil(Math.nextAfter(unscaled, Double.POSITIVE_INFINITY));
+ break;
+ case BigDecimal.ROUND_DOWN:
+ unscaled = Math.floor(Math.nextAfter(unscaled, Double.NEGATIVE_INFINITY));
+ break;
+ case BigDecimal.ROUND_FLOOR:
+ if (sign == -1)
+ unscaled = Math.ceil(Math.nextAfter(unscaled, Double.POSITIVE_INFINITY));
+ else
+ unscaled = Math.floor(Math.nextAfter(unscaled, Double.NEGATIVE_INFINITY));
+ break;
+ case BigDecimal.ROUND_HALF_DOWN: {
+ unscaled = Math.nextAfter(unscaled, Double.NEGATIVE_INFINITY);
+ double fraction = unscaled - Math.floor(unscaled);
+ if (fraction > 0.5)
+ unscaled = Math.ceil(unscaled);
+ else
+ unscaled = Math.floor(unscaled);
+ break;
+ }
+ case BigDecimal.ROUND_HALF_EVEN: {
+ double fraction = unscaled - Math.floor(unscaled);
+ if (fraction > 0.5)
+ unscaled = Math.ceil(unscaled);
+ else if (fraction < 0.5)
+ unscaled = Math.floor(unscaled);
+ else {
+ // The following equality test is intentional and needed for rounding purposes
+ if (Math.floor(unscaled) / 2.0 == Math.floor(Math.floor(unscaled) / 2.0)) { // even
+ unscaled = Math.floor(unscaled);
+ }
+ else { // odd
+ unscaled = Math.ceil(unscaled);
+ }
+ }
+ break;
+ }
+ case BigDecimal.ROUND_HALF_UP: {
+ unscaled = Math.nextAfter(unscaled, Double.POSITIVE_INFINITY);
+ double fraction = unscaled - Math.floor(unscaled);
+ if (fraction >= 0.5)
+ unscaled = Math.ceil(unscaled);
+ else
+ unscaled = Math.floor(unscaled);
+ break;
+ }
+ case BigDecimal.ROUND_UNNECESSARY:
+ if (unscaled != Math.floor(unscaled))
+ throw new MathArithmeticException();
+ break;
+ case BigDecimal.ROUND_UP:
+ // do not round if the discarded fraction is equal to zero
+ if (unscaled != Math.floor(unscaled))
+ unscaled = Math.ceil(Math.nextAfter(unscaled, Double.POSITIVE_INFINITY));
+ break;
+ default:
+ throw new MathIllegalArgumentException(INVALID_ROUNDING_METHOD,
+ roundingMtd,
+ "ROUND_CEILING", BigDecimal.ROUND_CEILING,
+ "ROUND_DOWN", BigDecimal.ROUND_DOWN,
+ "ROUND_FLOOR", BigDecimal.ROUND_FLOOR,
+ "ROUND_HALF_DOWN", BigDecimal.ROUND_HALF_DOWN,
+ "ROUND_HALF_EVEN", BigDecimal.ROUND_HALF_EVEN,
+ "ROUND_HALF_UP", BigDecimal.ROUND_HALF_UP,
+ "ROUND_UNNECESSARY", BigDecimal.ROUND_UNNECESSARY,
+ "ROUND_UP", BigDecimal.ROUND_UP);
+ }
+ return unscaled;
+ }
+
+ /**
+ * Computes a number {@code delta} close to {@code originalDelta} with
+ * the property that <pre><code>
+ * x + delta - x
+ * </code></pre>
+ * is exactly machine-representable.
+ * This is useful when computing numerical derivatives, in order to reduce
+ * roundoff errors.
+ *
+ * @param x Value.
+ * @param originalDelta Offset value.
+ * @return a number {@code delta} so that {@code x + delta} and {@code x} differ by a representable floating number.
+ */
+ public static double representableDelta(double x, double originalDelta) {
+ return x + originalDelta - x;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/934f6ac2/modules/ml/src/main/java/org/apache/ignite/ml/math/Tracer.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/Tracer.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/Tracer.java
index d334575..d343ce8 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/Tracer.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/Tracer.java
@@ -58,9 +58,9 @@ public class Tracer {
return new ColorMapper() {
/** {@inheritDoc} */
@Override public Color apply(Double d) {
- int r = (int) Math.round(255 * d);
+ int r = (int)Math.round(255 * d);
int g = 0;
- int b = (int) Math.round(255 * (1 - d));
+ int b = (int)Math.round(255 * (1 - d));
return new Color(r, g, b);
}
@@ -195,8 +195,8 @@ public class Tracer {
/**
* Saves given vector as CSV file.
*
- * @param vec Vector to save.
- * @param fmt Format to use.
+ * @param vec Vector to save.
+ * @param fmt Format to use.
* @param filePath Path of the file to save to.
*/
public static void saveAsCsv(Vector vec, String fmt, String filePath) throws IOException {
@@ -208,8 +208,8 @@ public class Tracer {
/**
* Saves given matrix as CSV file.
*
- * @param mtx Matrix to save.
- * @param fmt Format to use.
+ * @param mtx Matrix to save.
+ * @param fmt Format to use.
* @param filePath Path of the file to save to.
*/
public static void saveAsCsv(Matrix mtx, String fmt, String filePath) throws IOException {
@@ -232,7 +232,7 @@ public class Tracer {
* Shows given matrix in the browser with D3-based visualization.
*
* @param mtx Matrix to show.
- * @param cm Optional color mapper. If not provided - red-to-blue (R_B) mapper will be used.
+ * @param cm Optional color mapper. If not provided - red-to-blue (R_B) mapper will be used.
* @throws IOException Thrown in case of any errors.
*/
public static void showHtml(Matrix mtx, ColorMapper cm) throws IOException {
@@ -263,7 +263,7 @@ public class Tracer {
}
/**
- * @param d Value of {@link Matrix} or {@link Vector} element.
+ * @param d Value of {@link Matrix} or {@link Vector} element.
* @param clr {@link Color} to paint.
* @return JSON representation for given value and color.
*/
@@ -280,7 +280,7 @@ public class Tracer {
* Shows given vector in the browser with D3-based visualization.
*
* @param vec Vector to show.
- * @param cm Optional color mapper. If not provided - red-to-blue (R_B) mapper will be used.
+ * @param cm Optional color mapper. If not provided - red-to-blue (R_B) mapper will be used.
* @throws IOException Thrown in case of any errors.
*/
public static void showHtml(Vector vec, ColorMapper cm) throws IOException {
@@ -366,7 +366,7 @@ public class Tracer {
* Gets JavaScript array presentation of this vector.
*
* @param vec Vector to JavaScript-ify.
- * @param cm Color mapper to user.
+ * @param cm Color mapper to user.
*/
private static String mkJsArrayString(Vector vec, ColorMapper cm) {
boolean first = true;
@@ -393,7 +393,7 @@ public class Tracer {
* Gets JavaScript array presentation of this vector.
*
* @param mtx Matrix to JavaScript-ify.
- * @param cm Color mapper to user.
+ * @param cm Color mapper to user.
*/
private static String mkJsArrayString(Matrix mtx, ColorMapper cm) {
boolean first = true;
http://git-wip-us.apache.org/repos/asf/ignite/blob/934f6ac2/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/CholeskyDecomposition.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/CholeskyDecomposition.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/CholeskyDecomposition.java
index 6053e1c..84028fe 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/CholeskyDecomposition.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/CholeskyDecomposition.java
@@ -17,12 +17,16 @@
package org.apache.ignite.ml.math.decompositions;
+import org.apache.ignite.ml.math.Destroyable;
import org.apache.ignite.ml.math.Matrix;
import org.apache.ignite.ml.math.Vector;
import org.apache.ignite.ml.math.exceptions.CardinalityException;
import org.apache.ignite.ml.math.exceptions.NonPositiveDefiniteMatrixException;
import org.apache.ignite.ml.math.exceptions.NonSymmetricMatrixException;
+import static org.apache.ignite.ml.math.util.MatrixUtil.like;
+import static org.apache.ignite.ml.math.util.MatrixUtil.likeVector;
+
/**
* Calculates the Cholesky decomposition of a matrix.
* <p>
@@ -31,7 +35,7 @@ import org.apache.ignite.ml.math.exceptions.NonSymmetricMatrixException;
* @see <a href="http://mathworld.wolfram.com/CholeskyDecomposition.html">MathWorld</a>
* @see <a href="http://en.wikipedia.org/wiki/Cholesky_decomposition">Wikipedia</a>
*/
-public class CholeskyDecomposition extends DecompositionSupport {
+public class CholeskyDecomposition implements Destroyable {
/**
* Default threshold above which off-diagonal elements are considered too different
* and matrix not symmetric.
http://git-wip-us.apache.org/repos/asf/ignite/blob/934f6ac2/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/EigenDecomposition.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/EigenDecomposition.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/EigenDecomposition.java
index 698cbef..d0e91a5 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/EigenDecomposition.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/EigenDecomposition.java
@@ -17,17 +17,21 @@
package org.apache.ignite.ml.math.decompositions;
+import org.apache.ignite.ml.math.Destroyable;
import org.apache.ignite.ml.math.Matrix;
import org.apache.ignite.ml.math.Vector;
import org.apache.ignite.ml.math.functions.Functions;
+import static org.apache.ignite.ml.math.util.MatrixUtil.like;
+import static org.apache.ignite.ml.math.util.MatrixUtil.likeVector;
+
/**
* This class provides EigenDecomposition of given matrix. The class is based on
* class with similar name from <a href="http://mahout.apache.org/">Apache Mahout</a> library.
*
* @see <a href=http://mathworld.wolfram.com/EigenDecomposition.html>MathWorld</a>
*/
-public class EigenDecomposition extends DecompositionSupport {
+public class EigenDecomposition implements Destroyable {
/** Row and column dimension (square matrix). */
private final int n;
http://git-wip-us.apache.org/repos/asf/ignite/blob/934f6ac2/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/LUDecomposition.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/LUDecomposition.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/LUDecomposition.java
index 02a3123..4c388b3 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/LUDecomposition.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/LUDecomposition.java
@@ -17,11 +17,16 @@
package org.apache.ignite.ml.math.decompositions;
+import org.apache.ignite.ml.math.Destroyable;
import org.apache.ignite.ml.math.Matrix;
import org.apache.ignite.ml.math.Vector;
import org.apache.ignite.ml.math.exceptions.CardinalityException;
import org.apache.ignite.ml.math.exceptions.SingularMatrixException;
+import static org.apache.ignite.ml.math.util.MatrixUtil.copy;
+import static org.apache.ignite.ml.math.util.MatrixUtil.like;
+import static org.apache.ignite.ml.math.util.MatrixUtil.likeVector;
+
/**
* Calculates the LU-decomposition of a square matrix.
* <p>
@@ -29,8 +34,10 @@ import org.apache.ignite.ml.math.exceptions.SingularMatrixException;
*
* @see <a href="http://mathworld.wolfram.com/LUDecomposition.html">MathWorld</a>
* @see <a href="http://en.wikipedia.org/wiki/LU_decomposition">Wikipedia</a>
+ *
+ * TODO: Maybe we should make this class (and other decompositions) Externalizable.
*/
-public class LUDecomposition extends DecompositionSupport {
+public class LUDecomposition implements Destroyable {
/** Default bound to determine effective singularity in LU decomposition. */
private static final double DEFAULT_TOO_SMALL = 1e-11;
http://git-wip-us.apache.org/repos/asf/ignite/blob/934f6ac2/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/QRDecomposition.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/QRDecomposition.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/QRDecomposition.java
index 39215e8..5ffa574 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/QRDecomposition.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/QRDecomposition.java
@@ -17,16 +17,21 @@
package org.apache.ignite.ml.math.decompositions;
+import org.apache.ignite.ml.math.Destroyable;
import org.apache.ignite.ml.math.Matrix;
import org.apache.ignite.ml.math.Vector;
+import org.apache.ignite.ml.math.exceptions.SingularMatrixException;
import org.apache.ignite.ml.math.functions.Functions;
+import static org.apache.ignite.ml.math.util.MatrixUtil.copy;
+import static org.apache.ignite.ml.math.util.MatrixUtil.like;
+
/**
* For an {@code m x n} matrix {@code A} with {@code m >= n}, the QR decomposition
* is an {@code m x n} orthogonal matrix {@code Q} and an {@code n x n} upper
* triangular matrix {@code R} so that {@code A = Q*R}.
*/
-public class QRDecomposition extends DecompositionSupport {
+public class QRDecomposition implements Destroyable {
/** */
private final Matrix q;
/** */
@@ -41,6 +46,8 @@ public class QRDecomposition extends DecompositionSupport {
private final int rows;
/** */
private final int cols;
+ /** */
+ private double threshold;
/**
* @param v Value to be checked for being an ordinary double.
@@ -52,10 +59,21 @@ public class QRDecomposition extends DecompositionSupport {
/**
* Constructs a new QR decomposition object computed by Householder reflections.
+ * Threshold for singularity check used in this case is 0.
*
* @param mtx A rectangular matrix.
*/
public QRDecomposition(Matrix mtx) {
+ this(mtx, 0.0);
+ }
+
+ /**
+ * Constructs a new QR decomposition object computed by Householder reflections.
+ *
+ * @param mtx A rectangular matrix.
+ * @param threshold Value used for detecting singularity of {@code R} matrix in decomposition.
+ */
+ public QRDecomposition(Matrix mtx, double threshold) {
assert mtx != null;
rows = mtx.rowSize();
@@ -71,6 +89,7 @@ public class QRDecomposition extends DecompositionSupport {
boolean fullRank = true;
r = like(mtx, min, cols);
+ this.threshold = threshold;
for (int i = 0; i < min; i++) {
Vector qi = qTmp.viewColumn(i);
@@ -155,18 +174,20 @@ public class QRDecomposition extends DecompositionSupport {
throw new IllegalArgumentException("Matrix row dimensions must agree.");
int cols = mtx.columnSize();
-
+ Matrix r = getR();
+ checkSingular(r, threshold, true);
Matrix x = like(mType, this.cols, cols);
Matrix qt = getQ().transpose();
Matrix y = qt.times(mtx);
- Matrix r = getR();
-
- for (int k = Math.min(this.cols, rows) - 1; k > 0; k--) {
+ for (int k = Math.min(this.cols, rows) - 1; k >= 0; k--) {
// X[k,] = Y[k,] / R[k,k], note that X[k,] starts with 0 so += is same as =
x.viewRow(k).map(y.viewRow(k), Functions.plusMult(1 / r.get(k, k)));
+ if (k == 0)
+ continue;
+
// Y[0:(k-1),] -= R[0:(k-1),k] * X[k,]
Vector rCol = r.viewColumn(k).viewPart(0, k);
@@ -178,9 +199,48 @@ public class QRDecomposition extends DecompositionSupport {
}
/**
+ * Least squares solution of {@code A*X = B}; {@code returns X}.
+ *
+ * @param vec A vector with as many rows as {@code A}.
+ * @return {@code X<} that minimizes the two norm of {@code Q*R*X - B}.
+ * @throws IllegalArgumentException if {@code B.rows() != A.rows()}.
+ */
+ public Vector solve(Vector vec) {
+ Matrix res = solve(vec.likeMatrix(vec.size(), 1).assignColumn(0, vec));
+ return vec.like(res.rowSize()).assign(res.viewColumn(0));
+ }
+
+ /**
* Returns a rough string rendition of a QR.
*/
@Override public String toString() {
return String.format("QR(%d x %d, fullRank=%s)", rows, cols, hasFullRank());
}
+
+ /**
+ * Check singularity.
+ *
+ * @param r R matrix.
+ * @param min Singularity threshold.
+ * @param raise Whether to raise a {@link SingularMatrixException} if any element of the diagonal fails the check.
+ * @return {@code true} if any element of the diagonal is smaller or equal to {@code min}.
+ * @throws SingularMatrixException if the matrix is singular and {@code raise} is {@code true}.
+ */
+ private static boolean checkSingular(Matrix r, double min, boolean raise) {
+ // TODO: Not a very fast approach for distributed matrices. would be nice if we could independently check
+ // parts on different nodes for singularity and do fold with 'or'.
+
+ final int len = r.columnSize();
+ for (int i = 0; i < len; i++) {
+ final double d = r.getX(i, i);
+ if (Math.abs(d) <= min)
+ if (raise)
+ throw new SingularMatrixException("Number is too small (%f, while " +
+ "threshold is %f). Index of diagonal element is (%d, %d)", d, min, i, i);
+ else
+ return true;
+
+ }
+ return false;
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/934f6ac2/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/SingularValueDecomposition.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/SingularValueDecomposition.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/SingularValueDecomposition.java
index 1b04e4f..68aeb6d 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/SingularValueDecomposition.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/SingularValueDecomposition.java
@@ -18,8 +18,11 @@
package org.apache.ignite.ml.math.decompositions;
import org.apache.ignite.ml.math.Algebra;
+import org.apache.ignite.ml.math.Destroyable;
import org.apache.ignite.ml.math.Matrix;
+import static org.apache.ignite.ml.math.util.MatrixUtil.like;
+
/**
* Compute a singular value decomposition (SVD) of {@code (l x k)} matrix {@code m}.
* <p>This decomposition can be thought
@@ -33,7 +36,7 @@ import org.apache.ignite.ml.math.Matrix;
* <p>See also: <a href="https://en.wikipedia.org/wiki/Singular_value_decomposition">Wikipedia article on SVD</a>.</p>
* <p>Note: complex case is currently not supported.</p>
*/
-public class SingularValueDecomposition extends DecompositionSupport {
+public class SingularValueDecomposition implements Destroyable {
// U and V.
/** */
private final double[][] u;
http://git-wip-us.apache.org/repos/asf/ignite/blob/934f6ac2/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/CardinalityException.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/CardinalityException.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/CardinalityException.java
index f03e5d8..e8a073d 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/CardinalityException.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/CardinalityException.java
@@ -17,12 +17,10 @@
package org.apache.ignite.ml.math.exceptions;
-import org.apache.ignite.IgniteException;
-
/**
* Indicates a cardinality mismatch in matrix or vector operations.
*/
-public class CardinalityException extends IgniteException {
+public class CardinalityException extends MathIllegalArgumentException {
/** */
private static final long serialVersionUID = 0L;
@@ -33,6 +31,6 @@ public class CardinalityException extends IgniteException {
* @param act Actual cardinality.
*/
public CardinalityException(int exp, int act) {
- super("Cardinality violation [expected=" + exp + ", actual=" + act + "]");
+ super("Cardinality violation [expected=%d, actual=%d]", exp, act);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/934f6ac2/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/InsufficientDataException.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/InsufficientDataException.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/InsufficientDataException.java
new file mode 100644
index 0000000..a57997d
--- /dev/null
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/InsufficientDataException.java
@@ -0,0 +1,44 @@
+/*
+ * 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.ml.math.exceptions;
+
+/**
+ * This class is based on the corresponding class from Apache Common Math lib.
+ * Exception to be thrown when there is insufficient data to perform a computation.
+ */
+public class InsufficientDataException extends MathIllegalArgumentException {
+ /** Serializable version Id. */
+ private static final long serialVersionUID = -2629324471511903359L;
+
+ /** */
+ private static final String INSUFFICIENT_DATA = "Insufficient data.";
+
+ /**
+ * Construct the exception.
+ */
+ public InsufficientDataException() {
+ this(INSUFFICIENT_DATA);
+ }
+
+ /**
+ * Construct the exception.
+ */
+ public InsufficientDataException(String msg, Object... args) {
+ super(msg, args);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/934f6ac2/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/MathArithmeticException.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/MathArithmeticException.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/MathArithmeticException.java
new file mode 100644
index 0000000..f48f3c5
--- /dev/null
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/MathArithmeticException.java
@@ -0,0 +1,47 @@
+/*
+ * 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.ml.math.exceptions;
+
+/**
+ * This class is based on the corresponding class from Apache Common Math lib.
+ * Base class for arithmetic exceptions.
+ * It is used for all the exceptions that have the semantics of the standard
+ * {@link ArithmeticException}, but must also provide a localized
+ * message.
+ */
+public class MathArithmeticException extends MathRuntimeException {
+ /** Serializable version Id. */
+ private static final long serialVersionUID = -6024911025449780478L;
+
+ /**
+ * Default constructor.
+ */
+ public MathArithmeticException() {
+ this("arithmetic exception");
+ }
+
+ /**
+ * Constructor with a specific message.
+ *
+ * @param format Message pattern providing the specific context of the error.
+ * @param args Arguments.
+ */
+ public MathArithmeticException(String format, Object... args) {
+ super(format, args);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/934f6ac2/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/MathIllegalArgumentException.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/MathIllegalArgumentException.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/MathIllegalArgumentException.java
new file mode 100644
index 0000000..eac685d
--- /dev/null
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/MathIllegalArgumentException.java
@@ -0,0 +1,37 @@
+/*
+ * 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.ml.math.exceptions;
+
+/**
+ * Base class for all preconditions violation exceptions.
+ * In most cases, this class should not be instantiated directly: it should
+ * serve as a base class to create all the exceptions that have the semantics
+ * of the standard {@link IllegalArgumentException}.
+ */
+public class MathIllegalArgumentException extends MathRuntimeException {
+ /** Serializable version Id. */
+ private static final long serialVersionUID = -6024911025449780478L;
+
+ /**
+ * @param format Message format string explaining the cause of the error.
+ * @param args Arguments.
+ */
+ public MathIllegalArgumentException(String format, Object... args) {
+ super(String.format(format, args));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/934f6ac2/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/MathRuntimeException.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/MathRuntimeException.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/MathRuntimeException.java
new file mode 100644
index 0000000..865428e
--- /dev/null
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/MathRuntimeException.java
@@ -0,0 +1,47 @@
+/*
+ * 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.ml.math.exceptions;
+
+import org.apache.ignite.IgniteException;
+
+/**
+ * This class is based on the corresponding class from Apache Common Math lib.
+ * In most cases, this class should not be instantiated directly: it should
+ * serve as a base class for implementing exception classes that describe a
+ * specific "problem".
+ */
+public class MathRuntimeException extends IgniteException {
+ /** Serializable version Id. */
+ private static final long serialVersionUID = 20120926L;
+
+ /**
+ * @param format Message pattern explaining the cause of the error.
+ * @param args Arguments.
+ */
+ public MathRuntimeException(String format, Object... args) {
+ this(null, format, args);
+ }
+
+ /**
+ * @param cause Root cause.
+ * @param format Message pattern explaining the cause of the error.
+ * @param args Arguments.
+ */
+ public MathRuntimeException(Throwable cause, String format, Object... args) {
+ super(String.format(format, args), cause);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/934f6ac2/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/NoDataException.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/NoDataException.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/NoDataException.java
new file mode 100644
index 0000000..46d64aa
--- /dev/null
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/NoDataException.java
@@ -0,0 +1,45 @@
+/*
+ * 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.ml.math.exceptions;
+
+/**
+ * This class is based on the corresponding class from Apache Common Math lib.
+ * Exception to be thrown when the required data is missing.
+ */
+public class NoDataException extends MathIllegalArgumentException {
+ /** Serializable version Id. */
+ private static final long serialVersionUID = -3629324471511904459L;
+
+ /** */
+ private static final String NO_DATA = "No data.";
+
+ /**
+ * Construct the exception.
+ */
+ public NoDataException() {
+ this(NO_DATA);
+ }
+
+ /**
+ * Construct the exception with a specific message.
+ *
+ * @param msg Message.
+ */
+ public NoDataException(String msg) {
+ super(msg);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/934f6ac2/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/NonPositiveDefiniteMatrixException.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/NonPositiveDefiniteMatrixException.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/NonPositiveDefiniteMatrixException.java
index b0cf294..2e588dc 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/NonPositiveDefiniteMatrixException.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/NonPositiveDefiniteMatrixException.java
@@ -17,12 +17,10 @@
package org.apache.ignite.ml.math.exceptions;
-import org.apache.ignite.IgniteException;
-
/**
* This exception is used to indicate error condition of matrix elements failing the positivity check.
*/
-public class NonPositiveDefiniteMatrixException extends IgniteException {
+public class NonPositiveDefiniteMatrixException extends MathIllegalArgumentException {
/**
* Construct an exception.
*
@@ -31,7 +29,7 @@ public class NonPositiveDefiniteMatrixException extends IgniteException {
* @param threshold Absolute positivity threshold.
*/
public NonPositiveDefiniteMatrixException(double wrong, int idx, double threshold) {
- super("Matrix must be positive, wrong element located on diagonal with index "
- + idx + " and has value " + wrong + " with this threshold " + threshold);
+ super("Matrix must be positive, wrong element located on diagonal with index %d and has value %f with this threshold %f",
+ idx, wrong, threshold);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/934f6ac2/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/NonSquareMatrixException.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/NonSquareMatrixException.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/NonSquareMatrixException.java
new file mode 100644
index 0000000..5a4c207
--- /dev/null
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/NonSquareMatrixException.java
@@ -0,0 +1,33 @@
+/*
+ * 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.ml.math.exceptions;
+
+/**
+ * Indicates that given matrix is not a square matrix.
+ */
+public class NonSquareMatrixException extends CardinalityException {
+ /**
+ * Creates new square size violation exception.
+ *
+ * @param exp Expected cardinality.
+ * @param act Actual cardinality.
+ */
+ public NonSquareMatrixException(int exp, int act) {
+ super(exp, act);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/934f6ac2/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/NullArgumentException.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/NullArgumentException.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/NullArgumentException.java
new file mode 100644
index 0000000..58a6fa3
--- /dev/null
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/NullArgumentException.java
@@ -0,0 +1,27 @@
+/*
+ * 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.ml.math.exceptions;
+
+/**
+ * This class is based on the corresponding class from Apache Common Math lib.
+ * All conditions checks that fail due to a {@code null} argument must throw
+ * this exception.
+ * This class is meant to signal a precondition violation ("null is an illegal
+ * argument").
+ */
+public class NullArgumentException extends NullPointerException {
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/934f6ac2/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/SingularMatrixException.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/SingularMatrixException.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/SingularMatrixException.java
index 789b686..c7acc80 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/SingularMatrixException.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/SingularMatrixException.java
@@ -17,14 +17,17 @@
package org.apache.ignite.ml.math.exceptions;
-import org.apache.ignite.IgniteException;
-
/**
* Exception to be thrown when a non-singular matrix is expected.
*/
-public class SingularMatrixException extends IgniteException {
+public class SingularMatrixException extends MathIllegalArgumentException {
/** */
public SingularMatrixException() {
super("Regular (or non-singular) matrix expected.");
}
+
+ /** */
+ public SingularMatrixException(String format, Object... args) {
+ super(format, args);
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/934f6ac2/modules/ml/src/main/java/org/apache/ignite/ml/math/functions/Functions.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/functions/Functions.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/functions/Functions.java
index 2f97067..e86a5eb 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/functions/Functions.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/functions/Functions.java
@@ -133,6 +133,11 @@ public final class Functions {
return (a, b) -> a - b * constant;
}
+ /** Function that returns passed constant. */
+ public static IgniteDoubleFunction<Double> constant(Double c) {
+ return a -> c;
+ }
+
/**
* Function that returns {@code Math.pow(a, b)}.
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/934f6ac2/modules/ml/src/main/java/org/apache/ignite/ml/math/util/MatrixUtil.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/util/MatrixUtil.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/util/MatrixUtil.java
new file mode 100644
index 0000000..9277ae4
--- /dev/null
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/util/MatrixUtil.java
@@ -0,0 +1,121 @@
+/*
+ * 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.ml.math.util;
+
+import org.apache.ignite.ml.math.Matrix;
+import org.apache.ignite.ml.math.Vector;
+import org.apache.ignite.ml.math.impls.matrix.CacheMatrix;
+import org.apache.ignite.ml.math.impls.matrix.DenseLocalOnHeapMatrix;
+import org.apache.ignite.ml.math.impls.matrix.MatrixView;
+import org.apache.ignite.ml.math.impls.matrix.PivotedMatrixView;
+import org.apache.ignite.ml.math.impls.matrix.RandomMatrix;
+import org.apache.ignite.ml.math.impls.vector.DenseLocalOnHeapVector;
+
+/**
+ * Utility class for various matrix operations.
+ */
+public class MatrixUtil {
+ /**
+ * Create the like matrix with read-only matrices support.
+ *
+ * @param matrix Matrix for like.
+ * @return Like matrix.
+ */
+ public static Matrix like(Matrix matrix) {
+ if (isCopyLikeSupport(matrix))
+ return new DenseLocalOnHeapMatrix(matrix.rowSize(), matrix.columnSize());
+ else
+ return matrix.like(matrix.rowSize(), matrix.columnSize());
+ }
+
+ /**
+ * Create the identity matrix like a given matrix.
+ *
+ * @param matrix Matrix for like.
+ * @return Identity matrix.
+ */
+ public static Matrix identityLike(Matrix matrix, int n) {
+ Matrix res = like(matrix, n, n);
+ // TODO: Maybe we should introduce API for walking(and changing) matrix in
+ // a fastest possible visiting order.
+ for (int i = 0; i < n; i++)
+ res.setX(i, i, 1.0);
+ return res;
+ }
+
+ /**
+ * Create the like matrix with specified size with read-only matrices support.
+ *
+ * @param matrix Matrix for like.
+ * @return Like matrix.
+ */
+ public static Matrix like(Matrix matrix, int rows, int cols) {
+ if (isCopyLikeSupport(matrix))
+ return new DenseLocalOnHeapMatrix(rows, cols);
+ else
+ return matrix.like(rows, cols);
+ }
+
+ /**
+ * Create the like vector with read-only matrices support.
+ *
+ * @param matrix Matrix for like.
+ * @param crd Cardinality of the vector.
+ * @return Like vector.
+ */
+ public static Vector likeVector(Matrix matrix, int crd) {
+ if (isCopyLikeSupport(matrix))
+ return new DenseLocalOnHeapVector(crd);
+ else
+ return matrix.likeVector(crd);
+ }
+
+ /**
+ * Create the like vector with read-only matrices support.
+ *
+ * @param matrix Matrix for like.
+ * @return Like vector.
+ */
+ public static Vector likeVector(Matrix matrix) {
+ return likeVector(matrix, matrix.rowSize());
+ }
+
+ /**
+ * Create the copy of matrix with read-only matrices support.
+ *
+ * @param matrix Matrix for copy.
+ * @return Copy.
+ */
+ public static Matrix copy(Matrix matrix) {
+ if (isCopyLikeSupport(matrix)) {
+ DenseLocalOnHeapMatrix cp = new DenseLocalOnHeapMatrix(matrix.rowSize(), matrix.columnSize());
+
+ cp.assign(matrix);
+
+ return cp;
+ }
+ else
+ return matrix.copy();
+ }
+
+ /** */
+ private static boolean isCopyLikeSupport(Matrix matrix) {
+ return matrix instanceof RandomMatrix || matrix instanceof MatrixView || matrix instanceof CacheMatrix ||
+ matrix instanceof PivotedMatrixView;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/934f6ac2/modules/ml/src/main/java/org/apache/ignite/ml/regressions/AbstractMultipleLinearRegression.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/regressions/AbstractMultipleLinearRegression.java b/modules/ml/src/main/java/org/apache/ignite/ml/regressions/AbstractMultipleLinearRegression.java
new file mode 100644
index 0000000..d558dc0
--- /dev/null
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/regressions/AbstractMultipleLinearRegression.java
@@ -0,0 +1,358 @@
+/*
+ * 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.ml.regressions;
+
+import org.apache.ignite.ml.math.Matrix;
+import org.apache.ignite.ml.math.Vector;
+import org.apache.ignite.ml.math.exceptions.CardinalityException;
+import org.apache.ignite.ml.math.exceptions.InsufficientDataException;
+import org.apache.ignite.ml.math.exceptions.MathIllegalArgumentException;
+import org.apache.ignite.ml.math.exceptions.NoDataException;
+import org.apache.ignite.ml.math.exceptions.NonSquareMatrixException;
+import org.apache.ignite.ml.math.exceptions.NullArgumentException;
+import org.apache.ignite.ml.math.functions.Functions;
+import org.apache.ignite.ml.math.util.MatrixUtil;
+
+/**
+ * This class is based on the corresponding class from Apache Common Math lib.
+ * Abstract base class for implementations of MultipleLinearRegression.
+ */
+public abstract class AbstractMultipleLinearRegression implements MultipleLinearRegression {
+ /** X sample data. */
+ private Matrix xMatrix;
+
+ /** Y sample data. */
+ private Vector yVector;
+
+ /** Whether or not the regression model includes an intercept. True means no intercept. */
+ private boolean noIntercept = false;
+
+ /**
+ * @return the X sample data.
+ */
+ protected Matrix getX() {
+ return xMatrix;
+ }
+
+ /**
+ * @return the Y sample data.
+ */
+ protected Vector getY() {
+ return yVector;
+ }
+
+ /**
+ * @return true if the model has no intercept term; false otherwise
+ */
+ public boolean isNoIntercept() {
+ return noIntercept;
+ }
+
+ /**
+ * @param noIntercept true means the model is to be estimated without an intercept term
+ */
+ public void setNoIntercept(boolean noIntercept) {
+ this.noIntercept = noIntercept;
+ }
+
+ /**
+ * <p>Loads model x and y sample data from a flat input array, overriding any previous sample.
+ * </p>
+ * <p>Assumes that rows are concatenated with y values first in each row. For example, an input
+ * <code>data</code> array containing the sequence of values (1, 2, 3, 4, 5, 6, 7, 8, 9) with
+ * <code>nobs = 3</code> and <code>nvars = 2</code> creates a regression dataset with two
+ * independent variables, as below:
+ * <pre>
+ * y x[0] x[1]
+ * --------------
+ * 1 2 3
+ * 4 5 6
+ * 7 8 9
+ * </pre>
+ * </p>
+ * <p>Note that there is no need to add an initial unitary column (column of 1's) when
+ * specifying a model including an intercept term. If {@link #isNoIntercept()} is <code>true</code>,
+ * the X matrix will be created without an initial column of "1"s; otherwise this column will
+ * be added.
+ * </p>
+ * <p>Throws IllegalArgumentException if any of the following preconditions fail:
+ * <ul><li><code>data</code> cannot be null</li>
+ * <li><code>data.length = nobs * (nvars + 1)</li>
+ * <li><code>nobs > nvars</code></li></ul>
+ * </p>
+ *
+ * @param data input data array
+ * @param nobs number of observations (rows)
+ * @param nvars number of independent variables (columns, not counting y)
+ * @param like matrix(maybe empty) indicating how data should be stored
+ * @throws NullArgumentException if the data array is null
+ * @throws CardinalityException if the length of the data array is not equal to <code>nobs * (nvars + 1)</code>
+ * @throws InsufficientDataException if <code>nobs</code> is less than <code>nvars + 1</code>
+ */
+ public void newSampleData(double[] data, int nobs, int nvars, Matrix like) {
+ if (data == null)
+ throw new NullArgumentException();
+ if (data.length != nobs * (nvars + 1))
+ throw new CardinalityException(nobs * (nvars + 1), data.length);
+ if (nobs <= nvars)
+ throw new InsufficientDataException(RegressionsErrorMessages.INSUFFICIENT_OBSERVED_POINTS_IN_SAMPLE);
+ double[] y = new double[nobs];
+ final int cols = noIntercept ? nvars : nvars + 1;
+ double[][] x = new double[nobs][cols];
+ int pointer = 0;
+ for (int i = 0; i < nobs; i++) {
+ y[i] = data[pointer++];
+ if (!noIntercept)
+ x[i][0] = 1.0d;
+ for (int j = noIntercept ? 0 : 1; j < cols; j++)
+ x[i][j] = data[pointer++];
+ }
+ xMatrix = MatrixUtil.like(like, nobs, cols).assign(x);
+ yVector = MatrixUtil.likeVector(like, y.length).assign(y);
+ }
+
+ /**
+ * Loads new y sample data, overriding any previous data.
+ *
+ * @param y the array representing the y sample
+ * @throws NullArgumentException if y is null
+ * @throws NoDataException if y is empty
+ */
+ protected void newYSampleData(Vector y) {
+ if (y == null)
+ throw new NullArgumentException();
+ if (y.size() == 0)
+ throw new NoDataException();
+ // TODO: Should we copy here?
+ yVector = y;
+ }
+
+ /**
+ * <p>Loads new x sample data, overriding any previous data.
+ * </p>
+ * The input <code>x</code> array should have one row for each sample
+ * observation, with columns corresponding to independent variables.
+ * For example, if <pre>
+ * <code> x = new double[][] {{1, 2}, {3, 4}, {5, 6}} </code></pre>
+ * then <code>setXSampleData(x) </code> results in a model with two independent
+ * variables and 3 observations:
+ * <pre>
+ * x[0] x[1]
+ * ----------
+ * 1 2
+ * 3 4
+ * 5 6
+ * </pre>
+ * </p>
+ * <p>Note that there is no need to add an initial unitary column (column of 1's) when
+ * specifying a model including an intercept term.
+ * </p>
+ *
+ * @param x the rectangular array representing the x sample
+ * @throws NullArgumentException if x is null
+ * @throws NoDataException if x is empty
+ * @throws CardinalityException if x is not rectangular
+ */
+ protected void newXSampleData(Matrix x) {
+ if (x == null)
+ throw new NullArgumentException();
+ if (x.rowSize() == 0)
+ throw new NoDataException();
+ if (noIntercept)
+ // TODO: Should we copy here?
+ xMatrix = x;
+ else { // Augment design matrix with initial unitary column
+ xMatrix = MatrixUtil.like(x, x.rowSize(), x.columnSize() + 1);
+ xMatrix.viewColumn(0).map(Functions.constant(1.0));
+ xMatrix.viewPart(0, x.rowSize(), 1, x.columnSize()).assign(x);
+ }
+ }
+
+ /**
+ * Validates sample data. Checks that
+ * <ul><li>Neither x nor y is null or empty;</li>
+ * <li>The length (i.e. number of rows) of x equals the length of y</li>
+ * <li>x has at least one more row than it has columns (i.e. there is
+ * sufficient data to estimate regression coefficients for each of the
+ * columns in x plus an intercept.</li>
+ * </ul>
+ *
+ * @param x the n x k matrix representing the x data
+ * @param y the n-sized vector representing the y data
+ * @throws NullArgumentException if {@code x} or {@code y} is null
+ * @throws CardinalityException if {@code x} and {@code y} do not have the same length
+ * @throws NoDataException if {@code x} or {@code y} are zero-length
+ * @throws MathIllegalArgumentException if the number of rows of {@code x} is not larger than the number of columns
+ * + 1
+ */
+ protected void validateSampleData(Matrix x, Vector y) throws MathIllegalArgumentException {
+ if ((x == null) || (y == null))
+ throw new NullArgumentException();
+ if (x.rowSize() != y.size())
+ throw new CardinalityException(y.size(), x.rowSize());
+ if (x.rowSize() == 0) { // Must be no y data either
+ throw new NoDataException();
+ }
+ if (x.columnSize() + 1 > x.rowSize()) {
+ throw new MathIllegalArgumentException(
+ RegressionsErrorMessages.NOT_ENOUGH_DATA_FOR_NUMBER_OF_PREDICTORS,
+ x.rowSize(), x.columnSize());
+ }
+ }
+
+ /**
+ * Validates that the x data and covariance matrix have the same
+ * number of rows and that the covariance matrix is square.
+ *
+ * @param x the [n,k] array representing the x sample
+ * @param covariance the [n,n] array representing the covariance matrix
+ * @throws CardinalityException if the number of rows in x is not equal to the number of rows in covariance
+ * @throws NonSquareMatrixException if the covariance matrix is not square
+ */
+ protected void validateCovarianceData(double[][] x, double[][] covariance) {
+ if (x.length != covariance.length)
+ throw new CardinalityException(x.length, covariance.length);
+ if (covariance.length > 0 && covariance.length != covariance[0].length)
+ throw new NonSquareMatrixException(covariance.length, covariance[0].length);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override public double[] estimateRegressionParameters() {
+ Vector b = calculateBeta();
+ return b.getStorage().data();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override public double[] estimateResiduals() {
+ Vector b = calculateBeta();
+ Vector e = yVector.minus(xMatrix.times(b));
+ return e.getStorage().data();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override public Matrix estimateRegressionParametersVariance() {
+ return calculateBetaVariance();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override public double[] estimateRegressionParametersStandardErrors() {
+ Matrix betaVariance = estimateRegressionParametersVariance();
+ double sigma = calculateErrorVariance();
+ int len = betaVariance.rowSize();
+ double[] res = new double[len];
+ for (int i = 0; i < len; i++)
+ res[i] = Math.sqrt(sigma * betaVariance.getX(i, i));
+ return res;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override public double estimateRegressandVariance() {
+ return calculateYVariance();
+ }
+
+ /**
+ * Estimates the variance of the error.
+ *
+ * @return estimate of the error variance
+ */
+ public double estimateErrorVariance() {
+ return calculateErrorVariance();
+
+ }
+
+ /**
+ * Estimates the standard error of the regression.
+ *
+ * @return regression standard error
+ */
+ public double estimateRegressionStandardError() {
+ return Math.sqrt(estimateErrorVariance());
+ }
+
+ /**
+ * Calculates the beta of multiple linear regression in matrix notation.
+ *
+ * @return beta
+ */
+ protected abstract Vector calculateBeta();
+
+ /**
+ * Calculates the beta variance of multiple linear regression in matrix
+ * notation.
+ *
+ * @return beta variance
+ */
+ protected abstract Matrix calculateBetaVariance();
+
+ /**
+ * Calculates the variance of the y values.
+ *
+ * @return Y variance
+ */
+ protected double calculateYVariance() {
+ // Compute initial estimate using definitional formula
+ int vSize = yVector.size();
+ double xbar = yVector.sum() / vSize;
+ // Compute correction factor in second pass
+ final double corr = yVector.foldMap((val, acc) -> acc + val - xbar, Functions.IDENTITY, 0.0);
+ final double mean = xbar - corr;
+ return yVector.foldMap(Functions.PLUS, val -> (val - mean) * (val - mean), 0.0) / (vSize - 1);
+ }
+
+ /**
+ * <p>Calculates the variance of the error term.</p>
+ * Uses the formula <pre>
+ * var(u) = u · u / (n - k)
+ * </pre>
+ * where n and k are the row and column dimensions of the design
+ * matrix X.
+ *
+ * @return error variance estimate
+ */
+ protected double calculateErrorVariance() {
+ Vector residuals = calculateResiduals();
+ return residuals.dot(residuals) /
+ (xMatrix.rowSize() - xMatrix.columnSize());
+ }
+
+ /**
+ * Calculates the residuals of multiple linear regression in matrix
+ * notation.
+ *
+ * <pre>
+ * u = y - X * b
+ * </pre>
+ *
+ * @return The residuals [n,1] matrix
+ */
+ protected Vector calculateResiduals() {
+ Vector b = calculateBeta();
+ return yVector.minus(xMatrix.times(b));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/934f6ac2/modules/ml/src/main/java/org/apache/ignite/ml/regressions/MultipleLinearRegression.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/regressions/MultipleLinearRegression.java b/modules/ml/src/main/java/org/apache/ignite/ml/regressions/MultipleLinearRegression.java
new file mode 100644
index 0000000..2fc4dde
--- /dev/null
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/regressions/MultipleLinearRegression.java
@@ -0,0 +1,71 @@
+/*
+ * 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.ml.regressions;
+
+import org.apache.ignite.ml.math.Matrix;
+
+/**
+ * This class is based on the corresponding class from Apache Common Math lib. * The multiple linear regression can be
+ * represented in matrix-notation.
+ * <pre>
+ * y=X*b+u
+ * </pre>
+ * where y is an <code>n-vector</code> <b>regressand</b>, X is a <code>[n,k]</code> matrix whose <code>k</code> columns
+ * are called <b>regressors</b>, b is <code>k-vector</code> of <b>regression parameters</b> and <code>u</code> is an
+ * <code>n-vector</code> of <b>error terms</b> or <b>residuals</b>.
+ * <p>
+ * The notation is quite standard in literature, cf eg <a href="http://www.econ.queensu.ca/ETM">Davidson and MacKinnon,
+ * Econometrics Theory and Methods, 2004</a>. </p>
+ */
+public interface MultipleLinearRegression {
+ /**
+ * Estimates the regression parameters b.
+ *
+ * @return The [k,1] array representing b
+ */
+ public double[] estimateRegressionParameters();
+
+ /**
+ * Estimates the variance of the regression parameters, ie Var(b).
+ *
+ * @return The k x k matrix representing the variance of b
+ */
+ public Matrix estimateRegressionParametersVariance();
+
+ /**
+ * Estimates the residuals, ie u = y - X*b.
+ *
+ * @return The [n,1] array representing the residuals
+ */
+ public double[] estimateResiduals();
+
+ /**
+ * Returns the variance of the regressand, ie Var(y).
+ *
+ * @return The double representing the variance of y
+ */
+ public double estimateRegressandVariance();
+
+ /**
+ * Returns the standard errors of the regression parameters.
+ *
+ * @return standard errors of estimated regression parameters
+ */
+ public double[] estimateRegressionParametersStandardErrors();
+
+}
[27/50] [abbrv] ignite git commit: IGNITE-4995 Fixed javadoc.
Posted by sb...@apache.org.
IGNITE-4995 Fixed javadoc.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c64ad784
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c64ad784
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c64ad784
Branch: refs/heads/ignite-5009
Commit: c64ad7845340b0010d0c7f41ee09f9507fbf3b31
Parents: 97c2a3c
Author: Andrey Novikov <an...@gridgain.com>
Authored: Wed May 3 23:07:23 2017 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Wed May 3 23:07:23 2017 +0700
----------------------------------------------------------------------
.../org/apache/ignite/console/agent/handlers/ClusterListener.java | 2 +-
.../org/apache/ignite/console/agent/handlers/DemoListener.java | 2 +-
.../java/org/apache/ignite/console/agent/rest/RestExecutor.java | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c64ad784/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/ClusterListener.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/ClusterListener.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/ClusterListener.java
index 23b8fc7..939b35a 100644
--- a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/ClusterListener.java
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/ClusterListener.java
@@ -44,7 +44,7 @@ import static org.apache.ignite.console.agent.AgentUtils.toJSON;
import static org.apache.ignite.internal.processors.rest.GridRestResponse.STATUS_SUCCESS;
/**
- *
+ * API to retranslate topology from Ignite cluster available by node-uri.
*/
public class ClusterListener {
/** */
http://git-wip-us.apache.org/repos/asf/ignite/blob/c64ad784/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/DemoListener.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/DemoListener.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/DemoListener.java
index c496817..ce42032 100644
--- a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/DemoListener.java
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/DemoListener.java
@@ -37,7 +37,7 @@ import static org.apache.ignite.console.agent.AgentUtils.safeCallback;
import static org.apache.ignite.console.agent.AgentUtils.toJSON;
/**
- *
+ * API to retranslate topology from Ignite demo cluster.
*/
public class DemoListener {
/** */
http://git-wip-us.apache.org/repos/asf/ignite/blob/c64ad784/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/rest/RestExecutor.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/rest/RestExecutor.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/rest/RestExecutor.java
index d651aca..904b2b8 100644
--- a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/rest/RestExecutor.java
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/rest/RestExecutor.java
@@ -39,7 +39,7 @@ import static org.apache.ignite.internal.processors.rest.GridRestResponse.STATUS
import static org.apache.ignite.internal.processors.rest.GridRestResponse.STATUS_SUCCESS;
/**
- *
+ * API to translate REST requests to Ignite cluster.
*/
public class RestExecutor {
/** */
[13/50] [abbrv] ignite git commit: IGNITE-5120 Fixed LGPL build.
Posted by sb...@apache.org.
IGNITE-5120 Fixed LGPL build.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/777078d3
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/777078d3
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/777078d3
Branch: refs/heads/ignite-5009
Commit: 777078d377ba2f94b8f41086ecf0ad6056cdace5
Parents: 6ab579c
Author: Alexey Kuznetsov <ak...@gridgain.com>
Authored: Sat Apr 29 21:01:47 2017 +0700
Committer: Alexey Kuznetsov <ak...@gridgain.com>
Committed: Sat Apr 29 21:01:47 2017 +0700
----------------------------------------------------------------------
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/777078d3/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 722f5eb..5fd1005 100644
--- a/pom.xml
+++ b/pom.xml
@@ -198,9 +198,9 @@
<profile>
<id>lgpl</id>
<modules>
+ <module>modules/hibernate-core</module>
<module>modules/hibernate-4.2</module>
<module>modules/hibernate-5.1</module>
- <module>modules/hibernate-core</module>
<module>modules/geospatial</module>
<module>modules/schedule</module>
</modules>
[12/50] [abbrv] ignite git commit: IGNITE-4995 Minor code cleanup.
Posted by sb...@apache.org.
IGNITE-4995 Minor code cleanup.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/eb6a1697
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/eb6a1697
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/eb6a1697
Branch: refs/heads/ignite-5009
Commit: eb6a1697f5b31827edb780e0cf001e9bb3acac9e
Parents: fcc41ac
Author: Alexey Kuznetsov <ak...@gridgain.com>
Authored: Sat Apr 29 20:27:33 2017 +0700
Committer: Alexey Kuznetsov <ak...@gridgain.com>
Committed: Sat Apr 29 20:27:33 2017 +0700
----------------------------------------------------------------------
modules/web-console/frontend/app/app.config.js | 4 +++-
.../app/components/cluster-select/cluster-select.pug | 3 ++-
modules/web-console/frontend/app/helpers/jade/mixins.pug | 8 +-------
.../web-console/frontend/app/modules/sql/sql.controller.js | 2 +-
4 files changed, 7 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/eb6a1697/modules/web-console/frontend/app/app.config.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/app.config.js b/modules/web-console/frontend/app/app.config.js
index cf527e6..1772453 100644
--- a/modules/web-console/frontend/app/app.config.js
+++ b/modules/web-console/frontend/app/app.config.js
@@ -20,10 +20,12 @@ import angular from 'angular';
const nonNil = _.negate(_.isNil);
const nonEmpty = _.negate(_.isEmpty);
+const id8 = (uuid) => uuid.substring(0, 8).toUpperCase();
_.mixin({
nonNil,
- nonEmpty
+ nonEmpty,
+ id8
});
import alertTemplateUrl from 'views/templates/alert.tpl.pug';
http://git-wip-us.apache.org/repos/asf/ignite/blob/eb6a1697/modules/web-console/frontend/app/components/cluster-select/cluster-select.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/cluster-select/cluster-select.pug b/modules/web-console/frontend/app/components/cluster-select/cluster-select.pug
index 9c1ab75..c290838 100644
--- a/modules/web-console/frontend/app/components/cluster-select/cluster-select.pug
+++ b/modules/web-console/frontend/app/components/cluster-select/cluster-select.pug
@@ -35,6 +35,7 @@ ul.nav.navbar-nav(ng-if='!IgniteDemoMode' ng-switch='ctrl.clusters.length' style
div(ng-click='item.click()')
i.icon-cluster.pull-left(style='margin: 0; padding-left: 10px;')
div: a {{item.name}}
-i.icon-help(bs-tooltip='' data-placement='bottom' data-html=true style='padding-right: 20px; line-height: 25px'
+i.icon-help(ng-if='!IgniteDemoMode' bs-tooltip='' data-placement='bottom' data-html=true style='line-height: 25px'
data-title='Multi-Cluster Support<br/>\
<a href="https://apacheignite-tools.readme.io/docs/multi-cluster-support" target="_blank">More info</a>')
+span(ng-if='!IgniteDemoMode' style='padding-right: 20px')
http://git-wip-us.apache.org/repos/asf/ignite/blob/eb6a1697/modules/web-console/frontend/app/helpers/jade/mixins.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/helpers/jade/mixins.pug b/modules/web-console/frontend/app/helpers/jade/mixins.pug
index 672b8f8..73aa7c5 100644
--- a/modules/web-console/frontend/app/helpers/jade/mixins.pug
+++ b/modules/web-console/frontend/app/helpers/jade/mixins.pug
@@ -15,10 +15,10 @@
limitations under the License.
include ./form
-include ../../primitives/tooltip/index
include ../../primitives/btn-group/index
include ../../primitives/datepicker/index
include ../../primitives/dropdown/index
+include ../../primitives/tooltip/index
include ../../primitives/ui-grid-settings/index
//- Mixin for advanced options toggle.
@@ -209,12 +209,6 @@ mixin url(lbl, model, name, required, placeholder, tip)
if block
block
-//- Mixin for text field.
-mixin url(lbl, model, name, required, placeholder, tip)
- +ignite-form-field-url(lbl, model, name, required, placeholder, tip)
- if block
- block
-
//- Mixin for password field.
mixin password(lbl, model, name, required, placeholder, tip)
+ignite-form-field-password(lbl, model, name, false, required, placeholder, tip)
http://git-wip-us.apache.org/repos/asf/ignite/blob/eb6a1697/modules/web-console/frontend/app/modules/sql/sql.controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/sql/sql.controller.js b/modules/web-console/frontend/app/modules/sql/sql.controller.js
index b3ca91b..c86ab6b 100644
--- a/modules/web-console/frontend/app/modules/sql/sql.controller.js
+++ b/modules/web-console/frontend/app/modules/sql/sql.controller.js
@@ -1478,8 +1478,8 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
$scope.scan = (paragraph, local = false) => {
const cacheName = paragraph.cacheName;
- const filter = paragraph.filter;
const caseSensitive = !!paragraph.caseSensitive;
+ const filter = paragraph.filter;
const pageSize = paragraph.pageSize;
$scope.actionAvailable(paragraph, false) && _chooseNode(cacheName, local)
[07/50] [abbrv] ignite git commit: .NET: Cleanup unused
SqlOnheapRowCacheSize mentions
Posted by sb...@apache.org.
.NET: Cleanup unused SqlOnheapRowCacheSize mentions
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/73d4e115
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/73d4e115
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/73d4e115
Branch: refs/heads/ignite-5009
Commit: 73d4e1152409026d96346fe5f5dfbc6194b97c9c
Parents: dc4b21e
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Fri Apr 28 13:59:12 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Fri Apr 28 13:59:12 2017 +0300
----------------------------------------------------------------------
.../Cache/Configuration/CacheConfiguration.cs | 3 ---
.../dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd | 5 -----
2 files changed, 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/73d4e115/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
index 9c95c40..1ee7c97 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
@@ -108,9 +108,6 @@ namespace Apache.Ignite.Core.Cache.Configuration
/// <summary> Default timeout after which long query warning will be printed. </summary>
public static readonly TimeSpan DefaultLongQueryWarningTimeout = TimeSpan.FromMilliseconds(3000);
- /// <summary> Default size for onheap SQL row cache size. </summary>
- public const int DefaultSqlOnheapRowCacheSize = 10*1024;
-
/// <summary> Default value for keep portable in store behavior .</summary>
public const bool DefaultKeepVinaryInStore = true;
http://git-wip-us.apache.org/repos/asf/ignite/blob/73d4e115/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
index 295457a..253a33e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
@@ -684,11 +684,6 @@
<xs:documentation>If true all the SQL table and field names will be escaped with double quotes like ({ "tableName"."fieldsName"}). This enforces case sensitivity for field names and also allows having special characters in table and field names.</xs:documentation>
</xs:annotation>
</xs:attribute>
- <xs:attribute name="sqlOnheapRowCacheSize" type="xs:int">
- <xs:annotation>
- <xs:documentation>Number of SQL rows which will be cached onheap to avoid deserialization on each SQL index access. This setting only makes sense when offheap is enabled for this cache.</xs:documentation>
- </xs:annotation>
- </xs:attribute>
<xs:attribute name="readThrough" type="xs:boolean">
<xs:annotation>
<xs:documentation>Whether read-through should be enabled for cache operations.</xs:documentation>
[23/50] [abbrv] ignite git commit: Hibernate module deploy fix
Posted by sb...@apache.org.
Hibernate module deploy fix
(cherry picked from commit ff08c8e)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/28870dc7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/28870dc7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/28870dc7
Branch: refs/heads/ignite-5009
Commit: 28870dc711d23693179e3f25dc31259ce2c92361
Parents: 2436b93
Author: Anton Vinogradov <av...@apache.org>
Authored: Wed May 3 12:49:18 2017 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Wed May 3 12:54:09 2017 +0300
----------------------------------------------------------------------
modules/hibernate-core/pom.xml | 8 --------
1 file changed, 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/28870dc7/modules/hibernate-core/pom.xml
----------------------------------------------------------------------
diff --git a/modules/hibernate-core/pom.xml b/modules/hibernate-core/pom.xml
index 014405e..624dcc8 100644
--- a/modules/hibernate-core/pom.xml
+++ b/modules/hibernate-core/pom.xml
@@ -71,14 +71,6 @@
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
</plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-deploy-plugin</artifactId>
- <version>2.8.2</version>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
</plugins>
</build>
</project>
[38/50] [abbrv] ignite git commit: IGNITE-5162: ODBC: minor removal
of a dead code.
Posted by sb...@apache.org.
IGNITE-5162: ODBC: minor removal of a dead code.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7d288c76
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7d288c76
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7d288c76
Branch: refs/heads/ignite-5009
Commit: 7d288c7671fadea9345c8842fbf1a26c21eaa5f6
Parents: c7f09d8
Author: devozerov <vo...@gridgain.com>
Authored: Thu May 4 13:35:35 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Thu May 4 13:35:35 2017 +0300
----------------------------------------------------------------------
.../ignite/internal/processors/odbc/OdbcMessageParser.java | 5 -----
1 file changed, 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7d288c76/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcMessageParser.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcMessageParser.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcMessageParser.java
index d999501..517a1a4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcMessageParser.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcMessageParser.java
@@ -81,11 +81,6 @@ public class OdbcMessageParser {
OdbcHandshakeRequest res = new OdbcHandshakeRequest(longVersion);
- SqlListenerProtocolVersion version = res.version();
-
- if (version == SqlListenerProtocolVersion.UNKNOWN)
- return res;
-
res.distributedJoins(reader.readBoolean());
res.enforceJoinOrder(reader.readBoolean());
[14/50] [abbrv] ignite git commit: IGNITE-5120: Fixed build of
Hibernate module.
Posted by sb...@apache.org.
IGNITE-5120: Fixed build of Hibernate module.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/cd46d46c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/cd46d46c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/cd46d46c
Branch: refs/heads/ignite-5009
Commit: cd46d46ca91e1921bff2036c450af071496d1c68
Parents: 777078d
Author: oleg-ostanin <oo...@gridgain.com>
Authored: Sat Apr 29 22:04:19 2017 +0300
Committer: devozerov <pp...@gmail.com>
Committed: Sat Apr 29 22:04:19 2017 +0300
----------------------------------------------------------------------
modules/hibernate-core/pom.xml | 8 ++++++++
pom.xml | 2 +-
2 files changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/cd46d46c/modules/hibernate-core/pom.xml
----------------------------------------------------------------------
diff --git a/modules/hibernate-core/pom.xml b/modules/hibernate-core/pom.xml
index 91ec68b..9131ad3 100644
--- a/modules/hibernate-core/pom.xml
+++ b/modules/hibernate-core/pom.xml
@@ -71,6 +71,14 @@
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <version>2.8.2</version>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
</plugins>
</build>
</project>
http://git-wip-us.apache.org/repos/asf/ignite/blob/cd46d46c/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 5fd1005..8d388a5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -80,6 +80,7 @@
<module>modules/twitter</module>
<module>modules/mqtt</module>
<module>modules/zookeeper</module>
+ <module>modules/hibernate-core</module>
<module>modules/camel</module>
<module>modules/storm</module>
<module>modules/osgi-paxlogging</module>
@@ -198,7 +199,6 @@
<profile>
<id>lgpl</id>
<modules>
- <module>modules/hibernate-core</module>
<module>modules/hibernate-4.2</module>
<module>modules/hibernate-5.1</module>
<module>modules/geospatial</module>
[24/50] [abbrv] ignite git commit: IGNITE-4989 Assertion error in
BPlusTree#finishTail - Fixes #1894.
Posted by sb...@apache.org.
IGNITE-4989 Assertion error in BPlusTree#finishTail - Fixes #1894.
Signed-off-by: Sergi Vladykin <se...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/85f5309d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/85f5309d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/85f5309d
Branch: refs/heads/ignite-5009
Commit: 85f5309db0b12f3dc1c843463537518e05c0fd80
Parents: 28870dc
Author: EdShangGG <es...@gridgain.com>
Authored: Wed May 3 15:07:54 2017 +0300
Committer: Sergi Vladykin <se...@gmail.com>
Committed: Wed May 3 15:07:54 2017 +0300
----------------------------------------------------------------------
.../cache/database/tree/BPlusTree.java | 6 +-
.../processors/database/BPlusTreeSelfTest.java | 75 ++++++++++++++++++++
2 files changed, 80 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/85f5309d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/BPlusTree.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/BPlusTree.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/BPlusTree.java
index 648f35a..a4c09d5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/BPlusTree.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/BPlusTree.java
@@ -443,6 +443,10 @@ public abstract class BPlusTree<L, T extends L> extends DataStructure implements
throws IgniteCheckedException {
assert lvl == 0 : lvl; // Leaf.
+ // Check the triangle invariant.
+ if (io.getForward(leafAddr) != r.fwdId)
+ return RETRY;
+
final int cnt = io.getCount(leafAddr);
assert cnt <= Short.MAX_VALUE: cnt;
@@ -3384,7 +3388,7 @@ public abstract class BPlusTree<L, T extends L> extends DataStructure implements
if (tail.lvl == 0) {
// At the bottom level we can't have a tail without a sibling, it means we have higher levels.
- assert tail.sibling != null;
+ assert tail.sibling != null : tail;
return NOT_FOUND; // Lock upper level, we are at the bottom now.
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/85f5309d/modules/core/src/test/java/org/apache/ignite/internal/processors/database/BPlusTreeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/BPlusTreeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/BPlusTreeSelfTest.java
index 0254c4c..a46242c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/BPlusTreeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/BPlusTreeSelfTest.java
@@ -27,8 +27,10 @@ import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicLongArray;
+import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.locks.Lock;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.configuration.MemoryPolicyConfiguration;
@@ -1225,6 +1227,79 @@ public class BPlusTreeSelfTest extends GridCommonAbstractTest {
}
/**
+ *
+ */
+ public void testConcurrentGrowDegenerateTreeAndConcurrentRemove() throws Exception {
+ //calculate tree size when split happens
+ final TestTree t = createTestTree(true);
+ long i = 0;
+
+ for (; ; i++) {
+ t.put(i);
+
+ if (t.rootLevel() > 0) //split happened
+ break;
+ }
+
+ final long treeStartSize = i;
+
+ final AtomicReference<Throwable> failed = new AtomicReference<>();
+
+ for (int k = 0; k < 100; k++) {
+ final TestTree tree = createTestTree(true);
+
+ final AtomicBoolean start = new AtomicBoolean();
+
+ final AtomicInteger ready = new AtomicInteger();
+
+ Thread first = new Thread(new Runnable() {
+ @Override public void run() {
+ ready.incrementAndGet();
+
+ while (!start.get()); //waiting without blocking
+
+ try {
+ tree.remove(treeStartSize / 2L);
+ }
+ catch (Throwable th) {
+ failed.set(th);
+ }
+ }
+ });
+
+ Thread second = new Thread(new Runnable() {
+ @Override public void run() {
+ ready.incrementAndGet();
+
+ while (!start.get()); //waiting without blocking
+
+ try {
+ tree.put(treeStartSize + 1);
+ }
+ catch (Throwable th) {
+ failed.set(th);
+ }
+ }
+ });
+
+ for (int j = 0; j < treeStartSize; j++)
+ tree.put((long)j);
+
+ first.start();
+ second.start();
+
+ while (ready.get() != 2);
+
+ start.set(true);
+
+ first.join();
+ second.join();
+
+ assertNull(failed.get());
+ }
+ }
+
+ /**
* @param canGetRow Can get row from inner page.
* @throws Exception If failed.
*/
[11/50] [abbrv] ignite git commit: Merge branches 'ignite-2.0' and
'master' of https://git-wip-us.apache.org/repos/asf/ignite
Posted by sb...@apache.org.
Merge branches 'ignite-2.0' and 'master' of https://git-wip-us.apache.org/repos/asf/ignite
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/fcc41ac4
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/fcc41ac4
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/fcc41ac4
Branch: refs/heads/ignite-5009
Commit: fcc41ac4be7c74890c948ed1d545054dda905f4d
Parents: 7297e1d 6ab579c
Author: Alexey Kuznetsov <ak...@gridgain.com>
Authored: Sat Apr 29 14:51:28 2017 +0700
Committer: Alexey Kuznetsov <ak...@gridgain.com>
Committed: Sat Apr 29 14:51:28 2017 +0700
----------------------------------------------------------------------
RELEASE_NOTES.txt | 36 ++++++++++++++++++++
.../org/apache/ignite/igfs/IgfsMetrics.java | 2 +-
.../visor/query/VisorQueryConfiguration.java | 12 -------
.../CacheMemoryPolicyConfigurationTest.java | 12 +++++--
.../MemoryPolicyInitializationTest.java | 18 ++++++----
.../Cache/Configuration/CacheConfiguration.cs | 3 --
.../IgniteConfigurationSection.xsd | 5 ---
.../commands/cache/VisorCacheCommand.scala | 1 -
.../web-console/backend/app/browsersHandler.js | 4 +--
modules/web-console/backend/app/mongo.js | 3 --
.../app/modules/agent/AgentManager.service.js | 20 +++++------
.../generator/ConfigurationGenerator.js | 3 --
.../generator/PlatformGenerator.js | 3 +-
.../generator/defaults/Cache.service.js | 2 --
.../generator/defaults/IGFS.service.js | 1 -
.../states/configuration/caches/query.pug | 6 ----
.../modules/states/configuration/igfs/misc.pug | 2 --
.../agent/handlers/DatabaseListener.java | 24 ++++++-------
pom.xml | 2 +-
19 files changed, 84 insertions(+), 75 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/fcc41ac4/pom.xml
----------------------------------------------------------------------
[19/50] [abbrv] ignite git commit: IGNITE-5127 Fixed validation of
url fields. Refactored mixins.
Posted by sb...@apache.org.
IGNITE-5127 Fixed validation of url fields. Refactored mixins.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/843b3f7d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/843b3f7d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/843b3f7d
Branch: refs/heads/ignite-5009
Commit: 843b3f7d45512e3d8c2f34c3151b233201712227
Parents: e7826aa
Author: Vasiliy Sisko <vs...@gridgain.com>
Authored: Wed May 3 11:12:40 2017 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Wed May 3 11:13:21 2017 +0700
----------------------------------------------------------------------
.../app/helpers/jade/form/form-field-text.pug | 55 +++-----------------
.../frontend/app/helpers/jade/mixins.pug | 14 +++--
2 files changed, 18 insertions(+), 51 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/843b3f7d/modules/web-console/frontend/app/helpers/jade/form/form-field-text.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/helpers/jade/form/form-field-text.pug b/modules/web-console/frontend/app/helpers/jade/form/form-field-text.pug
index 5a7aa2e..8207271 100644
--- a/modules/web-console/frontend/app/helpers/jade/form/form-field-text.pug
+++ b/modules/web-console/frontend/app/helpers/jade/form/form-field-text.pug
@@ -14,12 +14,11 @@
See the License for the specific language governing permissions and
limitations under the License.
-mixin ignite-field-input(type, name, model, disabled, required, placeholder)
+mixin ignite-form-field-input(name, model, disabled, required, placeholder)
input.form-control(
id=`{{ ${name} }}Input`
name=`{{ ${name} }}`
placeholder=placeholder
- type=type
data-ng-model=model
@@ -28,61 +27,21 @@ mixin ignite-field-input(type, name, model, disabled, required, placeholder)
data-ng-focus='tableReset()'
data-ignite-form-panel-field=''
- )&attributes(attributes ? attributes.attributes ? attributes.attributes : attributes: {})
-
-mixin ignite-form-field-input(name, model, disabled, required, placeholder)
- +ignite-field-input('text', name, model, disabled, required, placeholder)
+ )&attributes(attributes ? attributes.attributes ? attributes.attributes : attributes : {})
-mixin ignite-form-field-url-input(name, model, disabled, required, placeholder)
- +ignite-field-input('url', name, model, disabled, required, placeholder)
-
-mixin ignite-form-field-text(label, model, name, disabled, required, placeholder, tip)
- -var errLbl = label.substring(0, label.length - 1)
+mixin ignite-form-field-text(lbl, model, name, disabled, required, placeholder, tip)
+ -var errLbl = lbl.substring(0, lbl.length - 1)
.ignite-form-field
- +ignite-form-field__label(label, name, required)
+ +ignite-form-field__label(lbl, name, required)
.ignite-form-field__control
+tooltip(tip, tipOpts)
if block
block
- +form-field-feedback(name, 'required', errLbl + ' could not be empty!')
+ if required
+ +form-field-feedback(name, 'required', `${errLbl} could not be empty!`)
.input-tip
+ignite-form-field-input(name, model, disabled, required, placeholder)(attributes=attributes)
-
-mixin ignite-form-field-url(label, model, name, required, placeholder, tip)
- -var errLbl = label.substring(0, label.length - 1)
-
- .ignite-form-field
- +ignite-form-field__label(label, name, required)
- .ignite-form-field__control
- +tooltip(tip, tipOpts)
-
- if block
- block
-
- +form-field-feedback(name, 'required', errLbl + ' could not be empty!')
- +form-field-feedback(name, 'url', errLbl + ' should be a valid URL!')
-
- .input-tip
- +ignite-form-field-url-input(name, model, false, required, placeholder)(attributes=attributes)
-
-mixin ignite-form-field-url(label, model, name, required, placeholder, tip)
- -var errLbl = label.substring(0, label.length - 1)
-
- .ignite-form-field
- +ignite-form-field__label(label, name, required)
- .ignite-form-field__control
- if tip
- i.tipField.icon-help(bs-tooltip='' data-title=tip)
-
- if block
- block
-
- +form-field-feedback(name, 'required', errLbl + ' could not be empty!')
- +form-field-feedback(name, 'url', errLbl + ' should be a valid URL!')
-
- .input-tip
- +ignite-form-field-url-input(name, model, false, required, placeholder)(attributes=attributes)
http://git-wip-us.apache.org/repos/asf/ignite/blob/843b3f7d/modules/web-console/frontend/app/helpers/jade/mixins.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/helpers/jade/mixins.pug b/modules/web-console/frontend/app/helpers/jade/mixins.pug
index 73aa7c5..ae80ec8 100644
--- a/modules/web-console/frontend/app/helpers/jade/mixins.pug
+++ b/modules/web-console/frontend/app/helpers/jade/mixins.pug
@@ -203,12 +203,16 @@ mixin text(lbl, model, name, required, placeholder, tip)
if block
block
-//- Mixin for text field.
+//- Mixin for url field.
mixin url(lbl, model, name, required, placeholder, tip)
- +ignite-form-field-url(lbl, model, name, required, placeholder, tip)
+ -var errLbl = lbl.substring(0, lbl.length - 1)
+
+ +ignite-form-field-text(lbl, model, name, 'false', required, placeholder, tip)(type='url')
if block
block
+ +form-field-feedback(name, 'url', errLbl + ' should be a valid URL!')
+
//- Mixin for password field.
mixin password(lbl, model, name, required, placeholder, tip)
+ignite-form-field-password(lbl, model, name, false, required, placeholder, tip)
@@ -371,11 +375,15 @@ mixin table-url-field(name, model, items, valid, save, newItem)
-var onBlur = `${valid} && (${save}); ${resetOnBlur};`
div(ignite-on-focus-out=onBlur)
+ +form-field-feedback(name, 'url', 'URL should be valid!')
+
if block
block
.input-tip
- +ignite-form-field-url-input(name, model, false, 'true', 'Enter URL')(
+ +ignite-form-field-input(name, model, false, 'true', 'Enter URL')(
+ type='url'
+
data-ignite-unique=items
data-ignite-form-field-input-autofocus='true'
[43/50] [abbrv] ignite git commit: IGNITE-5118 Added prefix to pojo
class if have same name with java built-in classes.
Posted by sb...@apache.org.
IGNITE-5118 Added prefix to pojo class if have same name with java built-in classes.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/988ca322
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/988ca322
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/988ca322
Branch: refs/heads/ignite-5009
Commit: 988ca32241651e629ae740c9bbd998c10f3148a7
Parents: 174528f
Author: Vasiliy Sisko <vs...@gridgain.com>
Authored: Thu May 4 21:15:32 2017 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Thu May 4 21:15:32 2017 +0700
----------------------------------------------------------------------
modules/web-console/frontend/controllers/domains-controller.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/988ca322/modules/web-console/frontend/controllers/domains-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/controllers/domains-controller.js b/modules/web-console/frontend/controllers/domains-controller.js
index ea5e389..d7237b9 100644
--- a/modules/web-console/frontend/controllers/domains-controller.js
+++ b/modules/web-console/frontend/controllers/domains-controller.js
@@ -596,7 +596,7 @@ export default ['domainsController', [
};
function isValidJavaIdentifier(s) {
- return JavaTypes.validIdentifier(s) && !JavaTypes.isKeyword(s) &&
+ return JavaTypes.validIdentifier(s) && !JavaTypes.isKeyword(s) && JavaTypes.nonBuiltInClass(s) &&
SqlTypes.validIdentifier(s) && !SqlTypes.isKeyword(s);
}
[42/50] [abbrv] ignite git commit: Merge remote-tracking branch
'origin/master'
Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/master'
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/174528fa
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/174528fa
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/174528fa
Branch: refs/heads/ignite-5009
Commit: 174528fa12ce70d2029e079a4b763acac5a6be49
Parents: 4e5a82d a8fcb0b
Author: devozerov <vo...@gridgain.com>
Authored: Thu May 4 15:37:16 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Thu May 4 15:37:16 2017 +0300
----------------------------------------------------------------------
modules/docker/2.0.0/Dockerfile | 46 ++++++++++++++++++++++++++++++++
modules/docker/2.0.0/run.sh | 51 ++++++++++++++++++++++++++++++++++++
modules/docker/Dockerfile | 2 +-
3 files changed, 98 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
[03/50] [abbrv] ignite git commit: IGNITE-5077 - Support service
security permissions
Posted by sb...@apache.org.
IGNITE-5077 - Support service security permissions
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6236b5f7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6236b5f7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6236b5f7
Branch: refs/heads/ignite-5009
Commit: 6236b5f7721f92acceb1b3b814d6ce0987178033
Parents: c9a11d4
Author: dkarachentsev <dk...@gridgain.com>
Authored: Fri Apr 28 11:46:23 2017 +0300
Committer: dkarachentsev <dk...@gridgain.com>
Committed: Fri Apr 28 11:46:23 2017 +0300
----------------------------------------------------------------------
.../processors/security/SecurityContext.java | 9 ++++++
.../service/GridServiceProcessor.java | 11 +++++++
.../security/SecurityBasicPermissionSet.java | 17 +++++++++++
.../plugin/security/SecurityPermission.java | 13 ++++++--
.../plugin/security/SecurityPermissionSet.java | 8 +++++
.../security/SecurityPermissionSetBuilder.java | 19 ++++++++++++
.../SecurityPermissionSetBuilderTest.java | 32 ++++++++++++++++----
.../junits/spi/GridSpiAbstractTest.java | 5 +++
8 files changed, 106 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6236b5f7/modules/core/src/main/java/org/apache/ignite/internal/processors/security/SecurityContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/security/SecurityContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/security/SecurityContext.java
index ef46713..bf5894e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/security/SecurityContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/security/SecurityContext.java
@@ -48,6 +48,15 @@ public interface SecurityContext {
public boolean cacheOperationAllowed(String cacheName, SecurityPermission perm);
/**
+ * Checks whether service operation is allowed.
+ *
+ * @param srvcName Service name.
+ * @param perm Permission to check.
+ * @return {@code True} if task operation is allowed.
+ */
+ public boolean serviceOperationAllowed(String srvcName, SecurityPermission perm);
+
+ /**
* Checks whether system-wide permission is allowed (excluding Visor task operations).
*
* @param perm Permission to check.
http://git-wip-us.apache.org/repos/asf/ignite/blob/6236b5f7/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
index 0c8f857..dda4328 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
@@ -91,6 +91,7 @@ import org.apache.ignite.lang.IgniteCallable;
import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.marshaller.Marshaller;
+import org.apache.ignite.plugin.security.SecurityPermission;
import org.apache.ignite.resources.IgniteInstanceResource;
import org.apache.ignite.resources.JobContextResource;
import org.apache.ignite.resources.LoggerResource;
@@ -490,6 +491,8 @@ public class GridServiceProcessor extends GridProcessorAdapter implements Ignite
validate(cfg);
+ ctx.security().authorize(cfg.getName(), SecurityPermission.SERVICE_DEPLOY, null);
+
if (!state.srvcCompatibility) {
Marshaller marsh = ctx.config().getMarshaller();
@@ -624,6 +627,8 @@ public class GridServiceProcessor extends GridProcessorAdapter implements Ignite
* @return Future.
*/
public IgniteInternalFuture<?> cancel(String name) {
+ ctx.security().authorize(name, SecurityPermission.SERVICE_CANCEL, null);
+
while (true) {
try {
GridFutureAdapter<?> fut = new GridFutureAdapter<>();
@@ -761,6 +766,8 @@ public class GridServiceProcessor extends GridProcessorAdapter implements Ignite
*/
@SuppressWarnings("unchecked")
public <T> T service(String name) {
+ ctx.security().authorize(name, SecurityPermission.SERVICE_INVOKE, null);
+
Collection<ServiceContextImpl> ctxs;
synchronized (locSvcs) {
@@ -825,6 +832,8 @@ public class GridServiceProcessor extends GridProcessorAdapter implements Ignite
@SuppressWarnings("unchecked")
public <T> T serviceProxy(ClusterGroup prj, String name, Class<? super T> svcItf, boolean sticky, long timeout)
throws IgniteException {
+ ctx.security().authorize(name, SecurityPermission.SERVICE_INVOKE, null);
+
if (hasLocalNode(prj)) {
ServiceContextImpl ctx = serviceContext(name);
@@ -864,6 +873,8 @@ public class GridServiceProcessor extends GridProcessorAdapter implements Ignite
*/
@SuppressWarnings("unchecked")
public <T> Collection<T> services(String name) {
+ ctx.security().authorize(name, SecurityPermission.SERVICE_INVOKE, null);
+
Collection<ServiceContextImpl> ctxs;
synchronized (locSvcs) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/6236b5f7/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityBasicPermissionSet.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityBasicPermissionSet.java b/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityBasicPermissionSet.java
index 5b50c56..7521dff 100644
--- a/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityBasicPermissionSet.java
+++ b/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityBasicPermissionSet.java
@@ -38,6 +38,9 @@ public class SecurityBasicPermissionSet implements SecurityPermissionSet {
/** Task permissions. */
private Map<String, Collection<SecurityPermission>> taskPerms = new HashMap<>();
+ /** Service permissions. */
+ private Map<String, Collection<SecurityPermission>> srvcPerms = new HashMap<>();
+
/** System permissions. */
private Collection<SecurityPermission> sysPerms = new ArrayList<>();
@@ -63,6 +66,15 @@ public class SecurityBasicPermissionSet implements SecurityPermissionSet {
}
/**
+ * Setter for set service permission map.
+ *
+ * @param srvcPerms Service permissions.
+ */
+ public void setServicePermissions(Map<String, Collection<SecurityPermission>> srvcPerms) {
+ this.srvcPerms = srvcPerms;
+ }
+
+ /**
* Setter for set collection system permission.
*
* @param sysPerms System permissions.
@@ -91,6 +103,11 @@ public class SecurityBasicPermissionSet implements SecurityPermissionSet {
}
/** {@inheritDoc} */
+ @Override public Map<String, Collection<SecurityPermission>> servicePermissions() {
+ return srvcPerms;
+ }
+
+ /** {@inheritDoc} */
@Nullable @Override public Collection<SecurityPermission> systemPermissions() {
return sysPerms;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6236b5f7/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityPermission.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityPermission.java b/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityPermission.java
index 9f63c1e..5436161 100644
--- a/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityPermission.java
+++ b/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityPermission.java
@@ -21,7 +21,7 @@ import org.jetbrains.annotations.Nullable;
/**
* Supported security permissions within grid. Permissions
- * are specified on per-cache or per-task level.
+ * are specified on per-cache, per-task or per-service level.
*/
public enum SecurityPermission {
/** Cache {@code read} permission. */
@@ -55,7 +55,16 @@ public enum SecurityPermission {
ADMIN_CACHE,
/** Visor admin operations permissions. */
- ADMIN_OPS;
+ ADMIN_OPS,
+
+ /** Service deploy permission. */
+ SERVICE_DEPLOY,
+
+ /** Service cancel permission. */
+ SERVICE_CANCEL,
+
+ /** Service invoke permission. */
+ SERVICE_INVOKE;
/** Enumerated values. */
private static final SecurityPermission[] VALS = values();
http://git-wip-us.apache.org/repos/asf/ignite/blob/6236b5f7/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityPermissionSet.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityPermissionSet.java b/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityPermissionSet.java
index 2415fad..96340d8 100644
--- a/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityPermissionSet.java
+++ b/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityPermissionSet.java
@@ -58,6 +58,14 @@ public interface SecurityPermissionSet extends Serializable {
public Map<String, Collection<SecurityPermission>> cachePermissions();
/**
+ * Map of service names to service permissions. Wildcards are allowed at the
+ * end of service names.
+ *
+ * @return Map of service names to service permissions.
+ */
+ public Map<String, Collection<SecurityPermission>> servicePermissions();
+
+ /**
* Collection of system-wide permissions (events enable/disable, Visor task execution).
*
* @return Collection of system-wide permissions.
http://git-wip-us.apache.org/repos/asf/ignite/blob/6236b5f7/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityPermissionSetBuilder.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityPermissionSetBuilder.java b/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityPermissionSetBuilder.java
index 61ad77c..cf38c0f 100644
--- a/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityPermissionSetBuilder.java
+++ b/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityPermissionSetBuilder.java
@@ -57,6 +57,9 @@ public class SecurityPermissionSetBuilder {
/** Task permissions.*/
private Map<String, Collection<SecurityPermission>> taskPerms = new HashMap<>();
+ /** Service permissions.*/
+ private Map<String, Collection<SecurityPermission>> srvcPerms = new HashMap<>();
+
/** System permissions.*/
private List<SecurityPermission> sysPerms = new ArrayList<>();
@@ -100,6 +103,21 @@ public class SecurityPermissionSetBuilder {
}
/**
+ * Append permission set form {@link org.apache.ignite.IgniteServices service} with {@code name}.
+ *
+ * @param name String for map some service to permission set.
+ * @param perms Permissions.
+ * @return SecurityPermissionSetBuilder refer to same permission builder.
+ */
+ public SecurityPermissionSetBuilder appendServicePermissions(String name, SecurityPermission... perms) {
+ validate(toCollection("SERVICE_"), perms);
+
+ append(srvcPerms, name, toCollection(perms));
+
+ return this;
+ }
+
+ /**
* Append permission set form {@link org.apache.ignite.IgniteCache cache} with {@code name}.
*
* @param name String for map some cache to permission set.
@@ -215,6 +233,7 @@ public class SecurityPermissionSetBuilder {
permSet.setDefaultAllowAll(dfltAllowAll);
permSet.setCachePermissions(unmodifiableMap(cachePerms));
permSet.setTaskPermissions(unmodifiableMap(taskPerms));
+ permSet.setServicePermissions(unmodifiableMap(srvcPerms));
permSet.setSystemPermissions(unmodifiableList(sysPerms));
return permSet;
http://git-wip-us.apache.org/repos/asf/ignite/blob/6236b5f7/modules/core/src/test/java/org/apache/ignite/plugin/security/SecurityPermissionSetBuilderTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/plugin/security/SecurityPermissionSetBuilderTest.java b/modules/core/src/test/java/org/apache/ignite/plugin/security/SecurityPermissionSetBuilderTest.java
index f63f9a7..5443cfd 100644
--- a/modules/core/src/test/java/org/apache/ignite/plugin/security/SecurityPermissionSetBuilderTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/plugin/security/SecurityPermissionSetBuilderTest.java
@@ -28,6 +28,8 @@ import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import static org.apache.ignite.plugin.security.SecurityPermission.CACHE_PUT;
import static org.apache.ignite.plugin.security.SecurityPermission.CACHE_READ;
import static org.apache.ignite.plugin.security.SecurityPermission.CACHE_REMOVE;
+import static org.apache.ignite.plugin.security.SecurityPermission.SERVICE_DEPLOY;
+import static org.apache.ignite.plugin.security.SecurityPermission.SERVICE_INVOKE;
import static org.apache.ignite.plugin.security.SecurityPermission.TASK_CANCEL;
import static org.apache.ignite.plugin.security.SecurityPermission.TASK_EXECUTE;
import static org.apache.ignite.plugin.security.SecurityPermission.EVENTS_ENABLE;
@@ -41,6 +43,7 @@ public class SecurityPermissionSetBuilderTest extends GridCommonAbstractTest {
/**
*
*/
+ @SuppressWarnings({"ThrowableNotThrown", "ArraysAsListWithZeroOrOneArgument"})
public void testPermissionBuilder() {
SecurityBasicPermissionSet exp = new SecurityBasicPermissionSet();
@@ -56,13 +59,18 @@ public class SecurityPermissionSetBuilderTest extends GridCommonAbstractTest {
exp.setTaskPermissions(permTask);
+ Map<String, Collection<SecurityPermission>> permSrvc = new HashMap<>();
+ permSrvc.put("service1", Arrays.asList(SERVICE_DEPLOY));
+ permSrvc.put("service2", Arrays.asList(SERVICE_INVOKE));
+
+ exp.setServicePermissions(permSrvc);
+
exp.setSystemPermissions(Arrays.asList(ADMIN_VIEW, EVENTS_ENABLE));
final SecurityPermissionSetBuilder permsBuilder = new SecurityPermissionSetBuilder();
assertThrows(log, new Callable<Object>() {
- @Override
- public Object call() throws Exception {
+ @Override public Object call() throws Exception {
permsBuilder.appendCachePermissions("cache", ADMIN_VIEW);
return null;
}
@@ -71,8 +79,7 @@ public class SecurityPermissionSetBuilderTest extends GridCommonAbstractTest {
);
assertThrows(log, new Callable<Object>() {
- @Override
- public Object call() throws Exception {
+ @Override public Object call() throws Exception {
permsBuilder.appendTaskPermissions("task", CACHE_READ);
return null;
}
@@ -81,8 +88,7 @@ public class SecurityPermissionSetBuilderTest extends GridCommonAbstractTest {
);
assertThrows(log, new Callable<Object>() {
- @Override
- public Object call() throws Exception {
+ @Override public Object call() throws Exception {
permsBuilder.appendSystemPermissions(TASK_EXECUTE, CACHE_PUT);
return null;
}
@@ -90,6 +96,15 @@ public class SecurityPermissionSetBuilderTest extends GridCommonAbstractTest {
"you can assign permission only start with [EVENTS_, ADMIN_], but you try TASK_EXECUTE"
);
+ assertThrows(log, new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ permsBuilder.appendSystemPermissions(SERVICE_INVOKE, CACHE_REMOVE);
+ return null;
+ }
+ }, IgniteException.class,
+ "you can assign permission only start with [EVENTS_, ADMIN_], but you try SERVICE_INVOKE"
+ );
+
permsBuilder.appendCachePermissions(
"cache1", CACHE_PUT, CACHE_REMOVE
).appendCachePermissions(
@@ -98,12 +113,17 @@ public class SecurityPermissionSetBuilderTest extends GridCommonAbstractTest {
"task1", TASK_CANCEL
).appendTaskPermissions(
"task2", TASK_EXECUTE
+ ).appendServicePermissions(
+ "service1", SERVICE_DEPLOY
+ ).appendServicePermissions(
+ "service2", SERVICE_INVOKE
).appendSystemPermissions(ADMIN_VIEW, EVENTS_ENABLE);
SecurityPermissionSet actual = permsBuilder.build();
assertEquals(exp.cachePermissions(), actual.cachePermissions());
assertEquals(exp.taskPermissions(), actual.taskPermissions());
+ assertEquals(exp.servicePermissions(), actual.servicePermissions());
assertEquals(exp.systemPermissions(), actual.systemPermissions());
assertEquals(exp.defaultAllowAll(), actual.defaultAllowAll());
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6236b5f7/modules/core/src/test/java/org/apache/ignite/testframework/junits/spi/GridSpiAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/spi/GridSpiAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/spi/GridSpiAbstractTest.java
index 091abd7..101d016 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/spi/GridSpiAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/spi/GridSpiAbstractTest.java
@@ -721,6 +721,11 @@ public abstract class GridSpiAbstractTest<T extends IgniteSpi> extends GridAbstr
}
/** {@inheritDoc} */
+ @Override public Map<String, Collection<SecurityPermission>> servicePermissions() {
+ return Collections.emptyMap();
+ }
+
+ /** {@inheritDoc} */
@Nullable @Override public Collection<SecurityPermission> systemPermissions() {
return null;
}
[45/50] [abbrv] ignite git commit: IGNITE-5071 Added table name
property for query entity.
Posted by sb...@apache.org.
IGNITE-5071 Added table name property for query entity.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/94c1d758
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/94c1d758
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/94c1d758
Branch: refs/heads/ignite-5009
Commit: 94c1d758940fc4d82d855760f7b514d329e46daa
Parents: 8cd9fbe
Author: Vasiliy Sisko <vs...@gridgain.com>
Authored: Thu May 4 22:33:29 2017 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Thu May 4 22:33:29 2017 +0700
----------------------------------------------------------------------
modules/web-console/backend/app/mongo.js | 1 +
.../generator/ConfigurationGenerator.js | 3 ++-
.../states/configuration/domains/general.pug | 4 ++--
.../states/configuration/domains/query.pug | 2 ++
.../frontend/controllers/domains-controller.js | 24 ++++++++++++++------
.../views/configuration/domains-import.tpl.pug | 11 +++++----
6 files changed, 31 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/94c1d758/modules/web-console/backend/app/mongo.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/app/mongo.js b/modules/web-console/backend/app/mongo.js
index 80be010..077044c 100644
--- a/modules/web-console/backend/app/mongo.js
+++ b/modules/web-console/backend/app/mongo.js
@@ -105,6 +105,7 @@ module.exports.factory = function(passportMongo, settings, pluginMongo, mongoose
caches: [{type: ObjectId, ref: 'Cache'}],
queryMetadata: {type: String, enum: ['Annotations', 'Configuration']},
kind: {type: String, enum: ['query', 'store', 'both']},
+ tableName: String,
databaseSchema: String,
databaseTable: String,
keyType: String,
http://git-wip-us.apache.org/repos/asf/ignite/blob/94c1d758/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js b/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
index d5aecdb..8bc74a9 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
@@ -1342,7 +1342,8 @@ export default class IgniteConfigurationGenerator {
const fields = _.map(domain.fields,
(e) => ({name: e.name, className: javaTypes.fullClassName(e.className)}));
- cfg.mapProperty('fields', fields, 'fields', true)
+ cfg.stringProperty('tableName')
+ .mapProperty('fields', fields, 'fields', true)
.mapProperty('aliases', 'aliases');
const indexes = _.map(domain.indexes, (index) =>
http://git-wip-us.apache.org/repos/asf/ignite/blob/94c1d758/modules/web-console/frontend/app/modules/states/configuration/domains/general.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/domains/general.pug b/modules/web-console/frontend/app/modules/states/configuration/domains/general.pug
index 6432adf..a6d3fc2 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/domains/general.pug
+++ b/modules/web-console/frontend/app/modules/states/configuration/domains/general.pug
@@ -18,6 +18,7 @@ include /app/helpers/jade/mixins
-var form = 'general'
-var model = 'backupItem'
+-var generatePojo = `${model}.generatePojo`
.panel.panel-default(ng-form=form novalidate)
.panel-heading(bs-collapse-toggle)
@@ -32,7 +33,7 @@ include /app/helpers/jade/mixins
.panel-body
.col-sm-6
.settings-row
- +checkbox('Generate POJO classes', `${model}.generatePojo`, '"generatePojo"', 'If selected then POJO classes will be generated from database tables')
+ +checkbox('Generate POJO classes', generatePojo, '"generatePojo"', 'If selected then POJO classes will be generated from database tables')
.settings-row
+caches(model, 'Select caches to associate domain model with cache')
.settings-row
@@ -42,7 +43,6 @@ include /app/helpers/jade/mixins
<li>Java annotations like @QuerySqlField</li>\
<li>Configuration via QueryEntity class</li>\
</ul>')
- -var generatePojo = `${model}.generatePojo`
.settings-row
+java-class-typeahead('Key type:', `${model}.keyType`, '"keyType"', 'javaBuiltInClasses', 'true', 'true', '{{ ' + generatePojo + ' ? "Full class name for Key" : "Key type name" }}', 'Key class used to store key in cache', generatePojo)
.settings-row
http://git-wip-us.apache.org/repos/asf/ignite/blob/94c1d758/modules/web-console/frontend/app/modules/states/configuration/domains/query.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/domains/query.pug b/modules/web-console/frontend/app/modules/states/configuration/domains/query.pug
index a057f59..aff3c73 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/domains/query.pug
+++ b/modules/web-console/frontend/app/modules/states/configuration/domains/query.pug
@@ -66,6 +66,8 @@ mixin table-index-item-edit(prefix, index, sortAvailable, idAddition)
label Not available for annotated types
div(ng-if=`${model}.queryMetadata === 'Configuration'`)
.settings-row
+ +text('Table name:', `${model}.tableName`, '"tableName"', 'false', 'Enter table name', 'Table name for this query entity')
+ .settings-row
+ignite-form-group(ng-model=queryFields ng-form=queryFieldsForm)
ignite-form-field-label(id='queryFields')
| Fields
http://git-wip-us.apache.org/repos/asf/ignite/blob/94c1d758/modules/web-console/frontend/controllers/domains-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/controllers/domains-controller.js b/modules/web-console/frontend/controllers/domains-controller.js
index d7237b9..3c8830b 100644
--- a/modules/web-console/frontend/controllers/domains-controller.js
+++ b/modules/web-console/frontend/controllers/domains-controller.js
@@ -63,7 +63,8 @@ export default ['domainsController', [
$scope.ui.generatePojo = true;
$scope.ui.builtinKeys = true;
$scope.ui.usePrimitives = true;
- $scope.ui.generateAliases = true;
+ $scope.ui.generateTypeAliases = true;
+ $scope.ui.generateFieldAliases = true;
$scope.ui.generatedCachesClusters = [];
function _mapCaches(caches) {
@@ -857,7 +858,15 @@ export default ['domainsController', [
containDup = true;
}
- const valType = generatePojo ? _toJavaPackage(packageName) + '.' + typeName : tableName;
+ let valType = tableName;
+ let typeAlias;
+
+ if (generatePojo) {
+ if ($scope.ui.generateTypeAliases && tableName.toLowerCase() !== typeName.toLowerCase())
+ typeAlias = tableName;
+
+ valType = _toJavaPackage(packageName) + '.' + typeName;
+ }
let _containKey = false;
@@ -868,7 +877,7 @@ export default ['domainsController', [
const dbName = fld.databaseFieldName;
- if ($scope.ui.generateAliases &&
+ if (generatePojo && $scope.ui.generateFieldAliases &&
SqlTypes.validIdentifier(dbName) && !SqlTypes.isKeyword(dbName) &&
!_.find(aliases, {field: fld.javaFieldName}) &&
fld.javaFieldName.toUpperCase() !== dbName.toUpperCase())
@@ -916,6 +925,7 @@ export default ['domainsController', [
newDomain.confirm = true;
}
+ newDomain.tableName = typeAlias;
newDomain.keyType = valType + 'Key';
newDomain.valueType = valType;
newDomain.queryMetadata = 'Configuration';
@@ -1024,7 +1034,7 @@ export default ['domainsController', [
function checkDuplicate() {
if (containDup) {
Confirm.confirm('Some tables have the same name.<br/>' +
- 'Name of types for that tables will contain schema name too.')
+ 'Name of types for that tables will contain schema name too.')
.then(() => checkOverwrite());
}
else
@@ -1035,7 +1045,7 @@ export default ['domainsController', [
checkDuplicate();
else {
Confirm.confirm('Some tables have no primary key.<br/>' +
- 'You will need to configure key type and key fields for such tables after import complete.')
+ 'You will need to configure key type and key fields for such tables after import complete.')
.then(() => checkDuplicate());
}
}
@@ -1816,8 +1826,8 @@ export default ['domainsController', [
// Found duplicate.
if (idx >= 0 && idx !== curIdx) {
return !stopEdit && ErrorPopover.show(LegacyTable.tableFieldId(curIdx,
- 'FieldName' + indexIdx + (curIdx >= 0 ? '-' : '')),
- 'Field with such name already exists in index!', $scope.ui, 'query');
+ 'FieldName' + indexIdx + (curIdx >= 0 ? '-' : '')),
+ 'Field with such name already exists in index!', $scope.ui, 'query');
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/94c1d758/modules/web-console/frontend/views/configuration/domains-import.tpl.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/configuration/domains-import.tpl.pug b/modules/web-console/frontend/views/configuration/domains-import.tpl.pug
index 1289bb3..20a7b85 100644
--- a/modules/web-console/frontend/views/configuration/domains-import.tpl.pug
+++ b/modules/web-console/frontend/views/configuration/domains-import.tpl.pug
@@ -153,6 +153,7 @@ mixin td-ellipses-lbl(w, lbl)
button.btn.btn-primary(ng-click='applyDefaults()') Apply
.import-domain-model-wizard-page(ng-show='importDomain.action == "options"')
-var form = 'optionsForm'
+ -var generatePojo = 'ui.generatePojo'
form.form-horizontal(name=form novalidate)
.settings-row
@@ -160,10 +161,12 @@ mixin td-ellipses-lbl(w, lbl)
.settings-row
+checkbox('Use primitive types for NOT NULL table columns', 'ui.usePrimitives', '"domainUsePrimitives"', 'Use primitive types like "int", "long", "double" for POJOs fields generation in case of NOT NULL columns')
.settings-row
- +checkbox('Generate aliases for query fields', 'ui.generateAliases', '"domainGenerateAliases"', 'Generate aliases for query fields with database field names when database field name differ from Java field name')
- .settings-row
- +checkbox('Generate POJO classes', 'ui.generatePojo', '"domainGeneratePojo"', 'If selected then POJO classes will be generated from database tables')
- .settings-row.settings-row_small-label(ng-show='ui.generatePojo')
+ +checkbox('Generate POJO classes', generatePojo, '"domainGeneratePojo"', 'If selected then POJO classes will be generated from database tables')
+ .settings-row(ng-show=generatePojo)
+ +checkbox('Generate aliases for query entity', 'ui.generateTypeAliases', '"domainGenerateTypeAliases"', 'Generate aliases for query entity if table name is invalid Java identifier')
+ .settings-row(ng-show=generatePojo)
+ +checkbox('Generate aliases for query fields', 'ui.generateFieldAliases', '"domainGenerateFieldAliases"', 'Generate aliases for query fields with database field names when database field name differ from Java field name')
+ .settings-row.settings-row_small-label(ng-show=generatePojo)
+java-package('Package:', 'ui.packageName', '"domainPackageName"', true, true, 'Package that will be used for POJOs generation')(data-container='.modal-domain-import')
.settings-row.settings-row_small-label
+ignite-form-field-dropdown('Clusters:', 'ui.generatedCachesClusters', '"generatedCachesClusters"', false, false, true,
[16/50] [abbrv] ignite git commit: IGNITE-5080 - Fixes in
SecurityBasicPermissionSet
Posted by sb...@apache.org.
IGNITE-5080 - Fixes in SecurityBasicPermissionSet
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2f7172cb
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2f7172cb
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2f7172cb
Branch: refs/heads/ignite-5009
Commit: 2f7172cb5c7af8e61cba00d6ec5e4d6f76b635e4
Parents: eb6a169
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Fri Apr 28 14:53:33 2017 +0200
Committer: Valentin Kulichenko <va...@ing.be>
Committed: Tue May 2 12:55:37 2017 +0200
----------------------------------------------------------------------
.../security/SecurityBasicPermissionSet.java | 89 ++++++++++++++------
1 file changed, 65 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2f7172cb/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityBasicPermissionSet.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityBasicPermissionSet.java b/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityBasicPermissionSet.java
index 7521dff..44166d9 100644
--- a/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityBasicPermissionSet.java
+++ b/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityBasicPermissionSet.java
@@ -17,10 +17,12 @@
package org.apache.ignite.plugin.security;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.ArrayList;
import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.A;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.jetbrains.annotations.Nullable;
@@ -33,16 +35,20 @@ public class SecurityBasicPermissionSet implements SecurityPermissionSet {
private static final long serialVersionUID = 0L;
/** Cache permissions. */
- private Map<String, Collection<SecurityPermission>> cachePerms = new HashMap<>();
+ @GridToStringInclude
+ private Map<String, Collection<SecurityPermission>> cachePermissions = new HashMap<>();
/** Task permissions. */
- private Map<String, Collection<SecurityPermission>> taskPerms = new HashMap<>();
+ @GridToStringInclude
+ private Map<String, Collection<SecurityPermission>> taskPermissions = new HashMap<>();
/** Service permissions. */
- private Map<String, Collection<SecurityPermission>> srvcPerms = new HashMap<>();
+ @GridToStringInclude
+ private Map<String, Collection<SecurityPermission>> servicePermissions = new HashMap<>();
/** System permissions. */
- private Collection<SecurityPermission> sysPerms = new ArrayList<>();
+ @GridToStringInclude
+ private Collection<SecurityPermission> systemPermissions;
/** Default allow all. */
private boolean dfltAllowAll;
@@ -50,37 +56,43 @@ public class SecurityBasicPermissionSet implements SecurityPermissionSet {
/**
* Setter for set cache permission map.
*
- * @param cachePerms Cache permissions.
+ * @param cachePermissions Cache permissions.
*/
- public void setCachePermissions(Map<String, Collection<SecurityPermission>> cachePerms) {
- this.cachePerms = cachePerms;
+ public void setCachePermissions(Map<String, Collection<SecurityPermission>> cachePermissions) {
+ A.notNull(cachePermissions, "cachePermissions");
+
+ this.cachePermissions = cachePermissions;
}
/**
* Setter for set task permission map.
*
- * @param taskPerms Task permissions.
+ * @param taskPermissions Task permissions.
*/
- public void setTaskPermissions(Map<String, Collection<SecurityPermission>> taskPerms) {
- this.taskPerms = taskPerms;
+ public void setTaskPermissions(Map<String, Collection<SecurityPermission>> taskPermissions) {
+ A.notNull(taskPermissions, "taskPermissions");
+
+ this.taskPermissions = taskPermissions;
}
/**
* Setter for set service permission map.
*
- * @param srvcPerms Service permissions.
+ * @param servicePermissions Service permissions.
*/
- public void setServicePermissions(Map<String, Collection<SecurityPermission>> srvcPerms) {
- this.srvcPerms = srvcPerms;
+ public void setServicePermissions(Map<String, Collection<SecurityPermission>> servicePermissions) {
+ A.notNull(taskPermissions, "servicePermissions");
+
+ this.servicePermissions = servicePermissions;
}
/**
- * Setter for set collection system permission.
+ * Setter for set collection system permission.
*
- * @param sysPerms System permissions.
+ * @param systemPermissions System permissions.
*/
- public void setSystemPermissions(Collection<SecurityPermission> sysPerms) {
- this.sysPerms = sysPerms;
+ public void setSystemPermissions(Collection<SecurityPermission> systemPermissions) {
+ this.systemPermissions = systemPermissions;
}
/**
@@ -94,22 +106,22 @@ public class SecurityBasicPermissionSet implements SecurityPermissionSet {
/** {@inheritDoc} */
@Override public Map<String, Collection<SecurityPermission>> cachePermissions() {
- return cachePerms;
+ return cachePermissions;
}
/** {@inheritDoc} */
@Override public Map<String, Collection<SecurityPermission>> taskPermissions() {
- return taskPerms;
+ return taskPermissions;
}
/** {@inheritDoc} */
@Override public Map<String, Collection<SecurityPermission>> servicePermissions() {
- return srvcPerms;
+ return servicePermissions;
}
/** {@inheritDoc} */
@Nullable @Override public Collection<SecurityPermission> systemPermissions() {
- return sysPerms;
+ return systemPermissions;
}
/** {@inheritDoc} */
@@ -118,6 +130,35 @@ public class SecurityBasicPermissionSet implements SecurityPermissionSet {
}
/** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ if (this == o)
+ return true;
+
+ if (!(o instanceof SecurityBasicPermissionSet))
+ return false;
+
+ SecurityBasicPermissionSet other = (SecurityBasicPermissionSet)o;
+
+ return dfltAllowAll == other.dfltAllowAll &&
+ F.eq(cachePermissions, other.cachePermissions) &&
+ F.eq(taskPermissions, other.taskPermissions) &&
+ F.eq(servicePermissions, other.servicePermissions) &&
+ F.eq(systemPermissions, other.systemPermissions);
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ int res = (dfltAllowAll ? 1 : 0);
+
+ res = 31 * res + (cachePermissions != null ? cachePermissions.hashCode() : 0);
+ res = 31 * res + (taskPermissions != null ? taskPermissions.hashCode() : 0);
+ res = 31 * res + (servicePermissions != null ? servicePermissions.hashCode() : 0);
+ res = 31 * res + (systemPermissions != null ? systemPermissions.hashCode() : 0);
+
+ return res;
+ }
+
+ /** {@inheritDoc} */
@Override public String toString() {
return S.toString(SecurityBasicPermissionSet.class, this);
}
[31/50] [abbrv] ignite git commit: IGNITE-5147 Fixed generation of
project structure view.
Posted by sb...@apache.org.
IGNITE-5147 Fixed generation of project structure view.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8be68138
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8be68138
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8be68138
Branch: refs/heads/ignite-5009
Commit: 8be68138c7911f2001eddd3c16cc968601e90777
Parents: 934f6ac
Author: Vasiliy Sisko <vs...@gridgain.com>
Authored: Thu May 4 09:53:54 2017 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Thu May 4 09:53:54 2017 +0700
----------------------------------------------------------------------
.../app/modules/states/configuration/summary/summary.controller.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/8be68138/modules/web-console/frontend/app/modules/states/configuration/summary/summary.controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/summary/summary.controller.js b/modules/web-console/frontend/app/modules/states/configuration/summary/summary.controller.js
index 0089528..71b5a82 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/summary/summary.controller.js
+++ b/modules/web-console/frontend/app/modules/states/configuration/summary/summary.controller.js
@@ -276,7 +276,7 @@ export default [
}
_.forEach(cache.domains, (domain) => {
- if (!_.isEmpty(domain.keyFields)) {
+ if (domain.generatePojo && _.nonEmpty(domain.keyFields)) {
if (JavaTypes.nonBuiltInClass(domain.keyType))
addClass(domain.keyType);
[09/50] [abbrv] ignite git commit: Moved hibernate-core to lgpl
profile.
Posted by sb...@apache.org.
Moved hibernate-core to lgpl profile.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e80773bf
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e80773bf
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e80773bf
Branch: refs/heads/ignite-5009
Commit: e80773bf271394bf5883eae6f4197df01e0befcd
Parents: 0e8e5dd
Author: oleg-ostanin <oo...@gridgain.com>
Authored: Fri Apr 28 17:05:56 2017 +0300
Committer: oleg-ostanin <oo...@gridgain.com>
Committed: Fri Apr 28 17:26:04 2017 +0300
----------------------------------------------------------------------
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e80773bf/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 9a672cc..722f5eb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -91,7 +91,6 @@
<module>modules/flink</module>
<module>modules/kubernetes</module>
<module>modules/zeromq</module>
- <module>modules/hibernate-core</module>
<module>modules/rocketmq</module>
</modules>
@@ -201,6 +200,7 @@
<modules>
<module>modules/hibernate-4.2</module>
<module>modules/hibernate-5.1</module>
+ <module>modules/hibernate-core</module>
<module>modules/geospatial</module>
<module>modules/schedule</module>
</modules>
[21/50] [abbrv] ignite git commit: Merge remote-tracking branch
'origin/master'
Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/master'
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1a339481
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1a339481
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1a339481
Branch: refs/heads/ignite-5009
Commit: 1a339481b6a7e04051e011bfacec9eb143d143b2
Parents: 4c1dab4 843b3f7
Author: devozerov <vo...@gridgain.com>
Authored: Wed May 3 11:24:22 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed May 3 11:24:22 2017 +0300
----------------------------------------------------------------------
.../app/helpers/jade/form/form-field-text.pug | 55 +++-----------------
.../frontend/app/helpers/jade/mixins.pug | 14 +++--
2 files changed, 18 insertions(+), 51 deletions(-)
----------------------------------------------------------------------
[22/50] [abbrv] ignite git commit: IGNITE-5143 Fixed agent watch
logic.
Posted by sb...@apache.org.
IGNITE-5143 Fixed agent watch logic.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2436b934
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2436b934
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2436b934
Branch: refs/heads/ignite-5009
Commit: 2436b93411dc84c10672b86534ad23816db4c03a
Parents: 1a33948
Author: Andrey Novikov <an...@gridgain.com>
Authored: Wed May 3 16:50:16 2017 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Wed May 3 16:50:16 2017 +0700
----------------------------------------------------------------------
.../web-console/backend/app/browsersHandler.js | 6 +-
.../app/modules/agent/AgentManager.service.js | 73 ++++++++++++++++----
.../frontend/app/modules/demo/Demo.module.js | 2 +-
.../frontend/app/modules/sql/sql.controller.js | 8 +--
.../frontend/controllers/domains-controller.js | 2 +-
5 files changed, 69 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2436b934/modules/web-console/backend/app/browsersHandler.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/app/browsersHandler.js b/modules/web-console/backend/app/browsersHandler.js
index 4a03abe..66ac5f8 100644
--- a/modules/web-console/backend/app/browsersHandler.js
+++ b/modules/web-console/backend/app/browsersHandler.js
@@ -115,15 +115,15 @@ module.exports.factory = (_, socketio, configure, errors) => {
acc.hasDemo |= _.get(agentSock, 'demo.enabled');
if (agentSock.cluster) {
- acc.clusters.add({
+ acc.clusters.push({
id: agentSock.cluster.id
});
}
return acc;
- }, {count: 0, hasDemo: false, clusters: new Set()});
+ }, {count: 0, hasDemo: false, clusters: []});
- stat.clusters = Array.from(stat.clusters);
+ stat.clusters = _.uniqWith(stat.clusters, _.isEqual);
return stat;
})
http://git-wip-us.apache.org/repos/asf/ignite/blob/2436b934/modules/web-console/frontend/app/modules/agent/AgentManager.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/agent/AgentManager.service.js b/modules/web-console/frontend/app/modules/agent/AgentManager.service.js
index db8b493..cb77832 100644
--- a/modules/web-console/frontend/app/modules/agent/AgentManager.service.js
+++ b/modules/web-console/frontend/app/modules/agent/AgentManager.service.js
@@ -41,7 +41,7 @@ export default class IgniteAgentManager {
this.clusters = [];
- $root.$on('$stateChangeSuccess', _.bind(this.stopWatch, this));
+ $root.$on('$stateChangeSuccess', () => this.stopWatch());
/**
* Connection to backend.
@@ -128,20 +128,29 @@ export default class IgniteAgentManager {
}
/**
+ * @param states
* @returns {Promise}
*/
- awaitAgent() {
- this.latchAwaitAgent = this.$q.defer();
+ awaitConnectionState(...states) {
+ this.latchAwaitStates = this.$q.defer();
this.offAwaitAgent = this.$root.$watch(() => this.connectionState, (state) => {
- if (state === State.CONNECTED) {
+ if (_.includes(states, state)) {
this.offAwaitAgent();
- this.latchAwaitAgent.resolve();
+ this.latchAwaitStates.resolve();
}
});
- return this.latchAwaitAgent.promise;
+ return this.latchAwaitStates.promise;
+ }
+
+ awaitCluster() {
+ return this.awaitConnectionState(State.CONNECTED);
+ }
+
+ awaitAgent() {
+ return this.awaitConnectionState(State.CONNECTED, State.CLUSTER_DISCONNECTED);
}
/**
@@ -149,7 +158,7 @@ export default class IgniteAgentManager {
* @param {String} [backState]
* @returns {Promise}
*/
- startWatch(backText, backState) {
+ startAgentWatch(backText, backState) {
const self = this;
self.backText = backText;
@@ -163,27 +172,65 @@ export default class IgniteAgentManager {
self.offStateWatch = this.$root.$watch(() => self.connectionState, (state) => {
switch (state) {
+ case State.CONNECTED:
+ case State.CLUSTER_DISCONNECTED:
+ this.AgentModal.hide();
+
+ break;
+
case State.AGENT_DISCONNECTED:
this.AgentModal.agentDisconnected(self.backText, self.backState);
break;
- case State.CLUSTER_DISCONNECTED:
- self.AgentModal.clusterDisconnected(self.backText, self.backState);
+ default:
+ // Connection to backend is not established yet.
+ }
+ });
- break;
+ return self.awaitAgent();
+ }
+
+ /**
+ * @param {String} backText
+ * @param {String} [backState]
+ * @returns {Promise}
+ */
+ startClusterWatch(backText, backState) {
+ const self = this;
+ self.backText = backText;
+ self.backState = backState;
+
+ if (_.nonEmpty(self.clusters) && _.get(self.cluster, 'disconnect') === true) {
+ self.cluster = _.head(self.clusters);
+
+ self.connectionState = State.CONNECTED;
+ }
+
+ self.offStateWatch = this.$root.$watch(() => self.connectionState, (state) => {
+ switch (state) {
case State.CONNECTED:
this.AgentModal.hide();
break;
+ case State.AGENT_DISCONNECTED:
+ this.AgentModal.agentDisconnected(self.backText, self.backState);
+
+ break;
+
+ case State.CLUSTER_DISCONNECTED:
+ self.AgentModal.clusterDisconnected(self.backText, self.backState);
+
+ break;
+
default:
// Connection to backend is not established yet.
}
});
- return self.awaitAgent();
+ return self.awaitCluster();
}
stopWatch() {
@@ -194,10 +241,10 @@ export default class IgniteAgentManager {
this.AgentModal.hide();
- if (this.latchAwaitAgent) {
+ if (this.latchAwaitStates) {
this.offAwaitAgent();
- this.latchAwaitAgent.reject('Agent watch stopped.');
+ this.latchAwaitStates.reject('Agent watch stopped.');
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2436b934/modules/web-console/frontend/app/modules/demo/Demo.module.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/demo/Demo.module.js b/modules/web-console/frontend/app/modules/demo/Demo.module.js
index 99ea2cb..1de45cd 100644
--- a/modules/web-console/frontend/app/modules/demo/Demo.module.js
+++ b/modules/web-console/frontend/app/modules/demo/Demo.module.js
@@ -165,7 +165,7 @@ angular
return dialog.$promise
.then(dialog.show)
- .then(() => Promise.race([agentMgr.awaitAgent(), closePromise.promise]))
+ .then(() => Promise.race([agentMgr.awaitCluster(), closePromise.promise]))
.then(() => scope.hasAgents = true);
}
};
http://git-wip-us.apache.org/repos/asf/ignite/blob/2436b934/modules/web-console/frontend/app/modules/sql/sql.controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/sql/sql.controller.js b/modules/web-console/frontend/app/modules/sql/sql.controller.js
index c86ab6b..3806351 100644
--- a/modules/web-console/frontend/app/modules/sql/sql.controller.js
+++ b/modules/web-console/frontend/app/modules/sql/sql.controller.js
@@ -887,7 +887,7 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
.catch((err) => Messages.showError(err));
const _startWatch = () =>
- agentMgr.startWatch('Back to Configuration', 'base.configuration.clusters')
+ agentMgr.startClusterWatch('Back to Configuration', 'base.configuration.clusters')
.then(() => Loading.start('sqlLoading'))
.then(_refreshFn)
.then(() => Loading.finish('sqlLoading'))
@@ -1336,12 +1336,12 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
const _executeRefresh = (paragraph) => {
const args = paragraph.queryArgs;
- agentMgr.awaitAgent()
+ agentMgr.awaitCluster()
.then(() => _closeOldQuery(paragraph))
.then(() => args.localNid || _chooseNode(args.cacheName, false))
.then((nid) => agentMgr.querySql(nid, args.cacheName, args.query, args.nonCollocatedJoins,
args.enforceJoinOrder, false, !!args.localNid, args.pageSize))
- .then(_processQueryResult.bind(this, paragraph, false))
+ .then((res) => _processQueryResult(paragraph, false, res))
.catch((err) => paragraph.setError(err));
};
@@ -1467,7 +1467,7 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
return agentMgr.querySql(nid, args.cacheName, args.query, false, !!paragraph.enforceJoinOrder, false, false, args.pageSize);
})
- .then(_processQueryResult.bind(this, paragraph, true))
+ .then((res) => _processQueryResult(paragraph, true, res))
.catch((err) => {
paragraph.setError(err);
http://git-wip-us.apache.org/repos/asf/ignite/blob/2436b934/modules/web-console/frontend/controllers/domains-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/controllers/domains-controller.js b/modules/web-console/frontend/controllers/domains-controller.js
index 57050a0..ea5e389 100644
--- a/modules/web-console/frontend/controllers/domains-controller.js
+++ b/modules/web-console/frontend/controllers/domains-controller.js
@@ -461,7 +461,7 @@ export default ['domainsController', [
$scope.importDomain.loadingOptions = LOADING_JDBC_DRIVERS;
- agentMgr.startWatch('Back to Domain models', 'import domain model from database')
+ agentMgr.startAgentWatch('Back to Domain models', 'import domain model from database')
.then(() => {
ActivitiesData.post({
group: 'configuration',
[25/50] [abbrv] ignite git commit: IGNITE-5132: Fixed PutGet example.
Posted by sb...@apache.org.
IGNITE-5132: Fixed PutGet example.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ed72663f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ed72663f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ed72663f
Branch: refs/heads/ignite-5009
Commit: ed72663ff8e6b6f46d77c91471400ec1c9ff0dfa
Parents: 85f5309
Author: Igor Sapego <is...@gridgain.com>
Authored: Tue May 2 20:20:49 2017 +0300
Committer: Igor Sapego <is...@gridgain.com>
Committed: Wed May 3 16:14:20 2017 +0300
----------------------------------------------------------------------
.../common/os/win/include/ignite/common/concurrent_os.h | 2 +-
.../cpp/examples/putget-example/config/example-cache.xml | 10 +---------
.../putget-example/project/vs/putget-example.vcxproj | 3 +++
.../project/vs/putget-example.vcxproj.filters | 8 ++++++++
.../cpp/examples/putget-example/src/putget_example.cpp | 2 +-
.../query-example/project/vs/query-example.vcxproj | 3 +++
.../project/vs/query-example.vcxproj.filters | 8 ++++++++
7 files changed, 25 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ed72663f/modules/platforms/cpp/common/os/win/include/ignite/common/concurrent_os.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/os/win/include/ignite/common/concurrent_os.h b/modules/platforms/cpp/common/os/win/include/ignite/common/concurrent_os.h
index 54f611b..0822ba7 100644
--- a/modules/platforms/cpp/common/os/win/include/ignite/common/concurrent_os.h
+++ b/modules/platforms/cpp/common/os/win/include/ignite/common/concurrent_os.h
@@ -35,7 +35,7 @@ namespace ignite
/**
* Static class to manage memory visibility semantics.
*/
- class Memory
+ class IGNITE_IMPORT_EXPORT Memory
{
public:
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/ed72663f/modules/platforms/cpp/examples/putget-example/config/example-cache.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/examples/putget-example/config/example-cache.xml b/modules/platforms/cpp/examples/putget-example/config/example-cache.xml
index 28b726c..af523cd 100644
--- a/modules/platforms/cpp/examples/putget-example/config/example-cache.xml
+++ b/modules/platforms/cpp/examples/putget-example/config/example-cache.xml
@@ -35,18 +35,10 @@
Partitioned cache example configuration with binary objects enabled.
-->
<bean class="org.apache.ignite.configuration.CacheConfiguration">
+ <property name="name" value="atomic"/>
<property name="atomicityMode" value="ATOMIC"/>
<property name="backups" value="1"/>
</bean>
-
- <!--
- Partitioned cache example configuration.
- -->
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="name" value="tx"/>
- <property name="atomicityMode" value="TRANSACTIONAL"/>
- <property name="backups" value="1"/>
- </bean>
</list>
</property>
http://git-wip-us.apache.org/repos/asf/ignite/blob/ed72663f/modules/platforms/cpp/examples/putget-example/project/vs/putget-example.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/examples/putget-example/project/vs/putget-example.vcxproj b/modules/platforms/cpp/examples/putget-example/project/vs/putget-example.vcxproj
index 555e15a..8842f3a 100644
--- a/modules/platforms/cpp/examples/putget-example/project/vs/putget-example.vcxproj
+++ b/modules/platforms/cpp/examples/putget-example/project/vs/putget-example.vcxproj
@@ -101,6 +101,9 @@ copy "$(ProjectDir)..\..\..\..\project\vs\$(Platform)\$(Configuration)\ignite.co
<ClInclude Include="..\..\..\include\ignite\examples\address.h" />
<ClInclude Include="..\..\..\include\ignite\examples\organization.h" />
</ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\config\example-cache.xml" />
+ </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
http://git-wip-us.apache.org/repos/asf/ignite/blob/ed72663f/modules/platforms/cpp/examples/putget-example/project/vs/putget-example.vcxproj.filters
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/examples/putget-example/project/vs/putget-example.vcxproj.filters b/modules/platforms/cpp/examples/putget-example/project/vs/putget-example.vcxproj.filters
index 1bcaff5..3bb8a8f 100644
--- a/modules/platforms/cpp/examples/putget-example/project/vs/putget-example.vcxproj.filters
+++ b/modules/platforms/cpp/examples/putget-example/project/vs/putget-example.vcxproj.filters
@@ -13,6 +13,9 @@
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
+ <Filter Include="Config">
+ <UniqueIdentifier>{487c5422-915c-4851-892d-c1599ea69e0c}</UniqueIdentifier>
+ </Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\src\putget_example.cpp">
@@ -27,4 +30,9 @@
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\config\example-cache.xml">
+ <Filter>Config</Filter>
+ </None>
+ </ItemGroup>
</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/ed72663f/modules/platforms/cpp/examples/putget-example/src/putget_example.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/examples/putget-example/src/putget_example.cpp b/modules/platforms/cpp/examples/putget-example/src/putget_example.cpp
index 8bf9c8c..f7bd894 100644
--- a/modules/platforms/cpp/examples/putget-example/src/putget_example.cpp
+++ b/modules/platforms/cpp/examples/putget-example/src/putget_example.cpp
@@ -100,7 +100,7 @@ int main()
std::cout << std::endl;
// Get cache instance.
- Cache<int, Organization> cache = grid.GetCache<int, Organization>(NULL);
+ Cache<int, Organization> cache = grid.GetCache<int, Organization>("atomic");
// Clear cache.
cache.Clear();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ed72663f/modules/platforms/cpp/examples/query-example/project/vs/query-example.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/examples/query-example/project/vs/query-example.vcxproj b/modules/platforms/cpp/examples/query-example/project/vs/query-example.vcxproj
index ff8e5be..22aa2b9 100644
--- a/modules/platforms/cpp/examples/query-example/project/vs/query-example.vcxproj
+++ b/modules/platforms/cpp/examples/query-example/project/vs/query-example.vcxproj
@@ -102,6 +102,9 @@ copy "$(ProjectDir)..\..\..\..\project\vs\$(Platform)\$(Configuration)\ignite.co
<ClInclude Include="..\..\..\include\ignite\examples\organization.h" />
<ClInclude Include="..\..\..\include\ignite\examples\person.h" />
</ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\config\query-example.xml" />
+ </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
http://git-wip-us.apache.org/repos/asf/ignite/blob/ed72663f/modules/platforms/cpp/examples/query-example/project/vs/query-example.vcxproj.filters
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/examples/query-example/project/vs/query-example.vcxproj.filters b/modules/platforms/cpp/examples/query-example/project/vs/query-example.vcxproj.filters
index 219d3f4..506b255 100644
--- a/modules/platforms/cpp/examples/query-example/project/vs/query-example.vcxproj.filters
+++ b/modules/platforms/cpp/examples/query-example/project/vs/query-example.vcxproj.filters
@@ -18,10 +18,18 @@
<Filter Include="Header Files">
<UniqueIdentifier>{b355095f-b4e2-4324-9516-854828c876ff}</UniqueIdentifier>
</Filter>
+ <Filter Include="Config">
+ <UniqueIdentifier>{89a5a9cc-a2c9-4d11-9044-869c3af6a2fd}</UniqueIdentifier>
+ </Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\src\query_example.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\config\query-example.xml">
+ <Filter>Config</Filter>
+ </None>
+ </ItemGroup>
</Project>
\ No newline at end of file
[05/50] [abbrv] ignite git commit: IGNITE-4082 Fixed tests runner.
Posted by sb...@apache.org.
IGNITE-4082 Fixed tests runner.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/25f0f75d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/25f0f75d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/25f0f75d
Branch: refs/heads/ignite-5009
Commit: 25f0f75df2541c164b4164e6430f50f52abd5c92
Parents: 6236b5f
Author: Ilya Borisov <kl...@gmail.com>
Authored: Fri Apr 28 17:04:59 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Apr 28 17:04:59 2017 +0700
----------------------------------------------------------------------
modules/web-console/frontend/test/karma.conf.babel.js | 6 ++++++
1 file changed, 6 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/25f0f75d/modules/web-console/frontend/test/karma.conf.babel.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/test/karma.conf.babel.js b/modules/web-console/frontend/test/karma.conf.babel.js
index 992c4d0..aa6b11c 100644
--- a/modules/web-console/frontend/test/karma.conf.babel.js
+++ b/modules/web-console/frontend/test/karma.conf.babel.js
@@ -20,6 +20,12 @@ import path from 'path';
const basePath = path.resolve('./');
+// Webpack chunk plugin has to be removed during test runs due to incompatibility issues,
+// otherwise tests would not run at all.
+// https://github.com/webpack-contrib/karma-webpack/issues/24#issuecomment-257613167
+const chunkPluginIndex = webpack.plugins.findIndex((plugin) => plugin.chunkNames);
+webpack.plugins.splice(chunkPluginIndex, 1);
+
export default (config) => {
config.set({
// Base path that will be used to resolve all patterns (eg. files, exclude).
[18/50] [abbrv] ignite git commit: Merge branch 'ignite-2.0'
Posted by sb...@apache.org.
Merge branch 'ignite-2.0'
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e7826aa8
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e7826aa8
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e7826aa8
Branch: refs/heads/ignite-5009
Commit: e7826aa89a5bbcf2023a7fed300fb62b31c07df2
Parents: 56ec995 a04aa10
Author: devozerov <vo...@gridgain.com>
Authored: Tue May 2 16:51:51 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Tue May 2 16:51:51 2017 +0300
----------------------------------------------------------------------
examples/rest/http-rest-example.php | 4 ++--
modules/hibernate-core/pom.xml | 8 ++++++++
pom.xml | 2 +-
3 files changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e7826aa8/modules/hibernate-core/pom.xml
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e7826aa8/pom.xml
----------------------------------------------------------------------
[41/50] [abbrv] ignite git commit: IGNITE-5167: ODBC: extracted
handler/parser interfaces.
Posted by sb...@apache.org.
IGNITE-5167: ODBC: extracted handler/parser interfaces.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4e5a82d6
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4e5a82d6
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4e5a82d6
Branch: refs/heads/ignite-5009
Commit: 4e5a82d657fb690d90aea33617ec05fffdb024c2
Parents: 7d288c7
Author: devozerov <vo...@gridgain.com>
Authored: Thu May 4 15:36:41 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Thu May 4 15:36:41 2017 +0300
----------------------------------------------------------------------
.../processors/odbc/OdbcConnectionData.java | 60 ---
.../processors/odbc/OdbcHandshakeRequest.java | 83 ---
.../processors/odbc/OdbcHandshakeResult.java | 73 ---
.../processors/odbc/OdbcMessageParser.java | 313 -----------
.../processors/odbc/OdbcNioListener.java | 37 +-
.../processors/odbc/OdbcRequestHandler.java | 530 ------------------
.../internal/processors/odbc/OdbcResponse.java | 96 ----
.../internal/processors/odbc/OdbcUtils.java | 2 +-
.../odbc/SqlListenerConnectionContext.java | 56 ++
.../odbc/SqlListenerHandshakeRequest.java | 83 +++
.../odbc/SqlListenerHandshakeResult.java | 73 +++
.../odbc/SqlListenerMessageParser.java | 39 ++
.../odbc/SqlListenerProtocolVersion.java | 4 +-
.../processors/odbc/SqlListenerRequest.java | 17 +
.../odbc/SqlListenerRequestHandler.java | 31 ++
.../processors/odbc/SqlListenerResponse.java | 96 ++++
.../odbc/escape/OdbcEscapeParseResult.java | 73 ---
.../processors/odbc/escape/OdbcEscapeToken.java | 61 ---
.../processors/odbc/escape/OdbcEscapeType.java | 112 ----
.../processors/odbc/escape/OdbcEscapeUtils.java | 440 ---------------
.../processors/odbc/odbc/OdbcMessageParser.java | 322 +++++++++++
.../odbc/odbc/OdbcRequestHandler.java | 540 +++++++++++++++++++
.../odbc/odbc/escape/OdbcEscapeParseResult.java | 73 +++
.../odbc/odbc/escape/OdbcEscapeToken.java | 61 +++
.../odbc/odbc/escape/OdbcEscapeType.java | 112 ++++
.../odbc/odbc/escape/OdbcEscapeUtils.java | 441 +++++++++++++++
.../resources/META-INF/classnames.properties | 2 +-
.../odbc/OdbcEscapeSequenceSelfTest.java | 2 +-
.../cpp/odbc-test/src/configuration_test.cpp | 3 +-
.../cpp/odbc-test/src/queries_test.cpp | 62 +--
.../odbc/include/ignite/odbc/protocol_version.h | 14 +-
.../src/system/ui/dsn_configuration_window.cpp | 32 +-
.../platforms/cpp/odbc/src/protocol_version.cpp | 16 +-
33 files changed, 1980 insertions(+), 1979 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e5a82d6/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcConnectionData.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcConnectionData.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcConnectionData.java
deleted file mode 100644
index 28a903d..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcConnectionData.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.odbc;
-
-import org.apache.ignite.internal.GridKernalContext;
-import org.apache.ignite.internal.util.GridSpinBusyLock;
-
-/**
- * Connection-related data.
- */
-class OdbcConnectionData {
- /** Request handler. */
- private final OdbcRequestHandler handler;
-
- /** Message parser. */
- private final OdbcMessageParser parser;
-
- /**
- * Constructor.
- *
- * @param ctx Context.
- * @param busyLock Shutdown busy lock.
- * @param maxCursors Maximum cursors.
- */
- public OdbcConnectionData(GridKernalContext ctx, GridSpinBusyLock busyLock, int maxCursors) {
- handler = new OdbcRequestHandler(ctx, busyLock, maxCursors);
- parser = new OdbcMessageParser(ctx);
- }
-
- /**
- * Handler getter.
- * @return Request handler for the connection.
- */
- public OdbcRequestHandler getHandler() {
- return handler;
- }
-
- /**
- * Parser getter
- * @return Message parser for the connection.
- */
- public OdbcMessageParser getParser() {
- return parser;
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e5a82d6/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcHandshakeRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcHandshakeRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcHandshakeRequest.java
deleted file mode 100644
index 7d337b7..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcHandshakeRequest.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.odbc;
-
-import org.apache.ignite.internal.util.typedef.internal.S;
-
-/**
- * ODBC handshake request.
- */
-public class OdbcHandshakeRequest extends SqlListenerRequest {
- /** Protocol version. */
- private final SqlListenerProtocolVersion ver;
-
- /** Distributed joins flag. */
- private boolean distributedJoins = false;
-
- /** Enforce join order flag. */
- private boolean enforceJoinOrder = false;
-
- /**
- * @param ver Long value for protocol version.
- */
- public OdbcHandshakeRequest(long ver) {
- super(HANDSHAKE);
-
- this.ver = SqlListenerProtocolVersion.fromLong(ver);
- }
-
- /**
- * @return Protocol version.
- */
- public SqlListenerProtocolVersion version() {
- return ver;
- }
-
- /**
- * @return Distributed joins flag.
- */
- public boolean distributedJoins() {
- return distributedJoins;
- }
-
- /**
- * @param distributedJoins Distributed joins flag.
- */
- public void distributedJoins(boolean distributedJoins) {
- this.distributedJoins = distributedJoins;
- }
-
- /**
- * @return Enforce join order flag.
- */
- public boolean enforceJoinOrder() {
- return enforceJoinOrder;
- }
-
- /**
- * @param enforceJoinOrder Enforce join order flag.
- */
- public void enforceJoinOrder(boolean enforceJoinOrder) {
- this.enforceJoinOrder = enforceJoinOrder;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(OdbcHandshakeRequest.class, this);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e5a82d6/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcHandshakeResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcHandshakeResult.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcHandshakeResult.java
deleted file mode 100644
index 74c5bd4..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcHandshakeResult.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.odbc;
-
-import org.apache.ignite.internal.util.typedef.internal.S;
-
-/**
- * ODBC handshake result.
- */
-public class OdbcHandshakeResult {
- /** Handshake accepted. */
- private final boolean accepted;
-
- /** Apache Ignite version when protocol version has been introduced. */
- private final String protoVerSince;
-
- /** Current Apache Ignite version. */
- private final String curVer;
-
- /**
- * Constructor.
- *
- * @param accepted Indicates whether handshake accepted or not.
- * @param protoVerSince Apache Ignite version when protocol version has been introduced.
- * @param curVer Current Apache Ignite version.
- */
- public OdbcHandshakeResult(boolean accepted, String protoVerSince, String curVer) {
- this.accepted = accepted;
- this.protoVerSince = protoVerSince;
- this.curVer = curVer;
- }
-
- /**
- * @return Query ID.
- */
- public boolean accepted() {
- return accepted;
- }
-
- /**
- * @return Apache Ignite version when protocol version has been introduced.
- */
- public String protocolVersionSince() {
- return protoVerSince;
- }
-
- /**
- * @return Current Apache Ignite version.
- */
- public String currentVersion() {
- return curVer;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(OdbcHandshakeResult.class, this);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e5a82d6/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcMessageParser.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcMessageParser.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcMessageParser.java
deleted file mode 100644
index 517a1a4..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcMessageParser.java
+++ /dev/null
@@ -1,313 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.odbc;
-
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.internal.GridKernalContext;
-import org.apache.ignite.internal.binary.BinaryReaderExImpl;
-import org.apache.ignite.internal.binary.BinaryWriterExImpl;
-import org.apache.ignite.internal.binary.GridBinaryMarshaller;
-import org.apache.ignite.internal.binary.streams.BinaryHeapInputStream;
-import org.apache.ignite.internal.binary.streams.BinaryHeapOutputStream;
-import org.apache.ignite.internal.binary.streams.BinaryInputStream;
-import org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl;
-
-import java.util.Collection;
-
-/**
- * ODBC message parser.
- */
-public class OdbcMessageParser {
- /** Initial output stream capacity. */
- private static final int INIT_CAP = 1024;
-
- /** Marshaller. */
- private final GridBinaryMarshaller marsh;
-
- /** Logger. */
- private final IgniteLogger log;
-
- /** Protocol version confirmation flag. */
- private boolean verConfirmed = false;
-
- /**
- * @param ctx Context.
- */
- public OdbcMessageParser(final GridKernalContext ctx) {
- CacheObjectBinaryProcessorImpl cacheObjProc = (CacheObjectBinaryProcessorImpl)ctx.cacheObjects();
-
- this.marsh = cacheObjProc.marshaller();
-
- this.log = ctx.log(getClass());
- }
-
- /**
- * Decode OdbcRequest from byte array.
- *
- * @param msg Message.
- * @return Assembled ODBC request.
- */
- public SqlListenerRequest decode(byte[] msg) {
- assert msg != null;
-
- BinaryInputStream stream = new BinaryHeapInputStream(msg);
-
- BinaryReaderExImpl reader = new BinaryReaderExImpl(null, stream, null, true);
-
- byte cmd = reader.readByte();
-
- // This is a special case because we can not decode protocol messages until
- // we has not confirmed that the remote client uses the same protocol version.
- if (!verConfirmed) {
- if (cmd == SqlListenerRequest.HANDSHAKE)
- {
- long longVersion = reader.readLong();
-
- OdbcHandshakeRequest res = new OdbcHandshakeRequest(longVersion);
-
- res.distributedJoins(reader.readBoolean());
- res.enforceJoinOrder(reader.readBoolean());
-
- return res;
- }
- else
- throw new IgniteException("Unexpected ODBC command " +
- "(first message is not a handshake request): [cmd=" + cmd + ']');
- }
-
- SqlListenerRequest res;
-
- switch (cmd) {
- case SqlListenerRequest.QRY_EXEC: {
- String cache = reader.readString();
- String sql = reader.readString();
- int argsNum = reader.readInt();
-
- Object[] params = new Object[argsNum];
-
- for (int i = 0; i < argsNum; ++i)
- params[i] = reader.readObjectDetached();
-
- res = new SqlListenerQueryExecuteRequest(cache, sql, params);
-
- break;
- }
-
- case SqlListenerRequest.QRY_FETCH: {
- long queryId = reader.readLong();
- int pageSize = reader.readInt();
-
- res = new SqlListenerQueryFetchRequest(queryId, pageSize);
-
- break;
- }
-
- case SqlListenerRequest.QRY_CLOSE: {
- long queryId = reader.readLong();
-
- res = new SqlListenerQueryCloseRequest(queryId);
-
- break;
- }
-
- case SqlListenerRequest.META_COLS: {
- String cache = reader.readString();
- String table = reader.readString();
- String column = reader.readString();
-
- res = new OdbcQueryGetColumnsMetaRequest(cache, table, column);
-
- break;
- }
-
- case SqlListenerRequest.META_TBLS: {
- String catalog = reader.readString();
- String schema = reader.readString();
- String table = reader.readString();
- String tableType = reader.readString();
-
- res = new OdbcQueryGetTablesMetaRequest(catalog, schema, table, tableType);
-
- break;
- }
-
- case SqlListenerRequest.META_PARAMS: {
- String cacheName = reader.readString();
- String sqlQuery = reader.readString();
-
- res = new OdbcQueryGetParamsMetaRequest(cacheName, sqlQuery);
-
- break;
- }
-
- default:
- throw new IgniteException("Unknown ODBC command: [cmd=" + cmd + ']');
- }
-
- return res;
- }
-
- /**
- * Encode OdbcResponse to byte array.
- *
- * @param msg Message.
- * @return Byte array.
- */
- public byte[] encode(OdbcResponse msg) {
- assert msg != null;
-
- // Creating new binary writer
- BinaryWriterExImpl writer = marsh.writer(new BinaryHeapOutputStream(INIT_CAP));
-
- // Writing status.
- writer.writeByte((byte) msg.status());
-
- if (msg.status() != OdbcResponse.STATUS_SUCCESS) {
- writer.writeString(msg.error());
-
- return writer.array();
- }
-
- Object res0 = msg.response();
-
- if (res0 == null)
- return writer.array();
- if (res0 instanceof OdbcHandshakeResult) {
- OdbcHandshakeResult res = (OdbcHandshakeResult) res0;
-
- if (log.isDebugEnabled())
- log.debug("Handshake result: " + (res.accepted() ? "accepted" : "rejected"));
-
- verConfirmed = res.accepted();
-
- if (res.accepted()) {
- verConfirmed = true;
-
- writer.writeBoolean(true);
- }
- else {
- writer.writeBoolean(false);
- writer.writeString(res.protocolVersionSince());
- writer.writeString(res.currentVersion());
- }
- }
- else if (res0 instanceof SqlListenerQueryExecuteResult) {
- SqlListenerQueryExecuteResult res = (SqlListenerQueryExecuteResult) res0;
-
- if (log.isDebugEnabled())
- log.debug("Resulting query ID: " + res.getQueryId());
-
- writer.writeLong(res.getQueryId());
-
- Collection<SqlListenerColumnMeta> metas = res.getColumnsMetadata();
-
- assert metas != null;
-
- writer.writeInt(metas.size());
-
- for (SqlListenerColumnMeta meta : metas)
- meta.write(writer);
- }
- else if (res0 instanceof SqlListenerQueryFetchResult) {
- SqlListenerQueryFetchResult res = (SqlListenerQueryFetchResult) res0;
-
- if (log.isDebugEnabled())
- log.debug("Resulting query ID: " + res.queryId());
-
- writer.writeLong(res.queryId());
-
- Collection<?> items0 = res.items();
-
- assert items0 != null;
-
- writer.writeBoolean(res.last());
-
- writer.writeInt(items0.size());
-
- for (Object row0 : items0) {
- if (row0 != null) {
- Collection<?> row = (Collection<?>)row0;
-
- writer.writeInt(row.size());
-
- for (Object obj : row) {
- if (obj == null) {
- writer.writeObjectDetached(null);
- continue;
- }
-
- Class<?> cls = obj.getClass();
-
- if (cls == java.sql.Time.class)
- writer.writeTime((java.sql.Time)obj);
- else if (cls == java.sql.Timestamp.class)
- writer.writeTimestamp((java.sql.Timestamp)obj);
- else if (cls == java.sql.Date.class)
- writer.writeDate((java.util.Date)obj);
- else
- writer.writeObjectDetached(obj);
- }
- }
- }
- }
- else if (res0 instanceof SqlListenerQueryCloseResult) {
- SqlListenerQueryCloseResult res = (SqlListenerQueryCloseResult) res0;
-
- if (log.isDebugEnabled())
- log.debug("Resulting query ID: " + res.getQueryId());
-
- writer.writeLong(res.getQueryId());
- }
- else if (res0 instanceof OdbcQueryGetColumnsMetaResult) {
- OdbcQueryGetColumnsMetaResult res = (OdbcQueryGetColumnsMetaResult) res0;
-
- Collection<SqlListenerColumnMeta> columnsMeta = res.meta();
-
- assert columnsMeta != null;
-
- writer.writeInt(columnsMeta.size());
-
- for (SqlListenerColumnMeta columnMeta : columnsMeta)
- columnMeta.write(writer);
- }
- else if (res0 instanceof OdbcQueryGetTablesMetaResult) {
- OdbcQueryGetTablesMetaResult res = (OdbcQueryGetTablesMetaResult) res0;
-
- Collection<OdbcTableMeta> tablesMeta = res.meta();
-
- assert tablesMeta != null;
-
- writer.writeInt(tablesMeta.size());
-
- for (OdbcTableMeta tableMeta : tablesMeta)
- tableMeta.writeBinary(writer);
- }
- else if (res0 instanceof OdbcQueryGetParamsMetaResult) {
- OdbcQueryGetParamsMetaResult res = (OdbcQueryGetParamsMetaResult) res0;
-
- byte[] typeIds = res.typeIds();
-
- writer.writeObjectDetached(typeIds);
- }
- else
- assert false : "Should not reach here.";
-
- return writer.array();
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e5a82d6/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcNioListener.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcNioListener.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcNioListener.java
index b0146e5..423c413 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcNioListener.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcNioListener.java
@@ -19,6 +19,8 @@ package org.apache.ignite.internal.processors.odbc;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.processors.odbc.odbc.OdbcMessageParser;
+import org.apache.ignite.internal.processors.odbc.odbc.OdbcRequestHandler;
import org.apache.ignite.internal.util.GridSpinBusyLock;
import org.apache.ignite.internal.util.nio.GridNioServerListenerAdapter;
import org.apache.ignite.internal.util.nio.GridNioSession;
@@ -32,7 +34,7 @@ import java.util.concurrent.atomic.AtomicLong;
*/
public class OdbcNioListener extends GridNioServerListenerAdapter<byte[]> {
/** Connection-related metadata key. */
- private static final int CONN_DATA_META_KEY = GridNioSessionMetaKey.nextUniqueKey();
+ private static final int CONN_CTX_META_KEY = GridNioSessionMetaKey.nextUniqueKey();
/** Request ID generator. */
private static final AtomicLong REQ_ID_GEN = new AtomicLong();
@@ -67,18 +69,21 @@ public class OdbcNioListener extends GridNioServerListenerAdapter<byte[]> {
/** {@inheritDoc} */
@Override public void onConnected(GridNioSession ses) {
if (log.isDebugEnabled())
- log.debug("ODBC client connected: " + ses.remoteAddress());
+ log.debug("SQL client connected: " + ses.remoteAddress());
- ses.addMeta(CONN_DATA_META_KEY, new OdbcConnectionData(ctx, busyLock, maxCursors));
+ OdbcRequestHandler handler = new OdbcRequestHandler(ctx, busyLock, maxCursors);
+ OdbcMessageParser parser = new OdbcMessageParser(ctx);
+
+ ses.addMeta(CONN_CTX_META_KEY, new SqlListenerConnectionContext(handler, parser));
}
/** {@inheritDoc} */
@Override public void onDisconnected(GridNioSession ses, @Nullable Exception e) {
if (log.isDebugEnabled()) {
if (e == null)
- log.debug("ODBC client disconnected: " + ses.remoteAddress());
+ log.debug("SQL client disconnected: " + ses.remoteAddress());
else
- log.debug("ODBC client disconnected due to an error [addr=" + ses.remoteAddress() + ", err=" + e + ']');
+ log.debug("SQL client disconnected due to an error [addr=" + ses.remoteAddress() + ", err=" + e + ']');
}
}
@@ -86,13 +91,11 @@ public class OdbcNioListener extends GridNioServerListenerAdapter<byte[]> {
@Override public void onMessage(GridNioSession ses, byte[] msg) {
assert msg != null;
- long reqId = REQ_ID_GEN.incrementAndGet();
-
- OdbcConnectionData connData = ses.meta(CONN_DATA_META_KEY);
+ SqlListenerConnectionContext connData = ses.meta(CONN_CTX_META_KEY);
assert connData != null;
- OdbcMessageParser parser = connData.getParser();
+ SqlListenerMessageParser parser = connData.parser();
SqlListenerRequest req;
@@ -100,7 +103,7 @@ public class OdbcNioListener extends GridNioServerListenerAdapter<byte[]> {
req = parser.decode(msg);
}
catch (Exception e) {
- log.error("Failed to parse message [id=" + reqId + ", err=" + e + ']');
+ log.error("Failed to parse SQL client request [err=" + e + ']');
ses.close();
@@ -109,24 +112,26 @@ public class OdbcNioListener extends GridNioServerListenerAdapter<byte[]> {
assert req != null;
+ req.requestId(REQ_ID_GEN.incrementAndGet());
+
try {
long startTime = 0;
if (log.isDebugEnabled()) {
startTime = System.nanoTime();
- log.debug("ODBC request received [id=" + reqId + ", addr=" + ses.remoteAddress() +
+ log.debug("SQL client request received [reqId=" + req.requestId() + ", addr=" + ses.remoteAddress() +
", req=" + req + ']');
}
- OdbcRequestHandler handler = connData.getHandler();
+ SqlListenerRequestHandler handler = connData.handler();
- OdbcResponse resp = handler.handle(reqId, req);
+ SqlListenerResponse resp = handler.handle(req);
if (log.isDebugEnabled()) {
long dur = (System.nanoTime() - startTime) / 1000;
- log.debug("ODBC request processed [id=" + reqId + ", dur(mcs)=" + dur +
+ log.debug("SQL client request processed [reqId=" + req.requestId() + ", dur(mcs)=" + dur +
", resp=" + resp.status() + ']');
}
@@ -135,9 +140,9 @@ public class OdbcNioListener extends GridNioServerListenerAdapter<byte[]> {
ses.send(outMsg);
}
catch (Exception e) {
- log.error("Failed to process ODBC request [id=" + reqId + ", err=" + e + ']');
+ log.error("Failed to process SQL client request [reqId=" + req.requestId() + ", err=" + e + ']');
- ses.send(parser.encode(new OdbcResponse(OdbcResponse.STATUS_FAILED, e.toString())));
+ ses.send(parser.encode(new SqlListenerResponse(SqlListenerResponse.STATUS_FAILED, e.toString())));
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e5a82d6/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcRequestHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcRequestHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcRequestHandler.java
deleted file mode 100644
index d98c366..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcRequestHandler.java
+++ /dev/null
@@ -1,530 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.odbc;
-
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.cache.query.QueryCursor;
-import org.apache.ignite.cache.query.SqlFieldsQuery;
-import org.apache.ignite.internal.GridKernalContext;
-import org.apache.ignite.internal.binary.GridBinaryMarshaller;
-import org.apache.ignite.internal.processors.cache.QueryCursorImpl;
-import org.apache.ignite.internal.processors.odbc.escape.OdbcEscapeUtils;
-import org.apache.ignite.internal.processors.query.GridQueryFieldMetadata;
-import org.apache.ignite.internal.processors.query.GridQueryTypeDescriptor;
-import org.apache.ignite.internal.util.GridSpinBusyLock;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lang.IgniteBiTuple;
-import org.apache.ignite.lang.IgniteProductVersion;
-
-import java.sql.ParameterMetaData;
-import java.sql.PreparedStatement;
-import java.sql.Types;
-import java.util.*;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.atomic.AtomicLong;
-
-import static org.apache.ignite.internal.processors.odbc.SqlListenerRequest.*;
-
-/**
- * SQL query handler.
- */
-public class OdbcRequestHandler {
- /** Query ID sequence. */
- private static final AtomicLong QRY_ID_GEN = new AtomicLong();
-
- /** Kernel context. */
- private final GridKernalContext ctx;
-
- /** Logger. */
- private final IgniteLogger log;
-
- /** Busy lock. */
- private final GridSpinBusyLock busyLock;
-
- /** Maximum allowed cursors. */
- private final int maxCursors;
-
- /** Current queries cursors. */
- private final ConcurrentHashMap<Long, IgniteBiTuple<QueryCursor, Iterator>> qryCursors = new ConcurrentHashMap<>();
-
- /** Distributed joins flag. */
- private boolean distributedJoins = false;
-
- /** Enforce join order flag. */
- private boolean enforceJoinOrder = false;
-
- /**
- * Constructor.
- *
- * @param ctx Context.
- * @param busyLock Shutdown latch.
- * @param maxCursors Maximum allowed cursors.
- */
- public OdbcRequestHandler(GridKernalContext ctx, GridSpinBusyLock busyLock, int maxCursors) {
- this.ctx = ctx;
- this.busyLock = busyLock;
- this.maxCursors = maxCursors;
-
- log = ctx.log(OdbcRequestHandler.class);
- }
-
- /**
- * Handle request.
- *
- * @param reqId Request ID.
- * @param req Request.
- * @return Response.
- */
- public OdbcResponse handle(long reqId, SqlListenerRequest req) {
- assert req != null;
-
- if (!busyLock.enterBusy())
- return new OdbcResponse(OdbcResponse.STATUS_FAILED,
- "Failed to handle ODBC request because node is stopping: " + req);
-
- try {
- switch (req.command()) {
- case HANDSHAKE:
- return performHandshake(reqId, (OdbcHandshakeRequest)req);
-
- case QRY_EXEC:
- return executeQuery(reqId, (SqlListenerQueryExecuteRequest)req);
-
- case QRY_FETCH:
- return fetchQuery(reqId, (SqlListenerQueryFetchRequest)req);
-
- case QRY_CLOSE:
- return closeQuery(reqId, (SqlListenerQueryCloseRequest)req);
-
- case META_COLS:
- return getColumnsMeta(reqId, (OdbcQueryGetColumnsMetaRequest)req);
-
- case META_TBLS:
- return getTablesMeta(reqId, (OdbcQueryGetTablesMetaRequest)req);
-
- case META_PARAMS:
- return getParamsMeta(reqId, (OdbcQueryGetParamsMetaRequest)req);
- }
-
- return new OdbcResponse(OdbcResponse.STATUS_FAILED, "Unsupported ODBC request: " + req);
- }
- finally {
- busyLock.leaveBusy();
- }
- }
-
- /**
- * {@link OdbcHandshakeRequest} command handler.
- *
- * @param reqId Request ID.
- * @param req Handshake request.
- * @return Response.
- */
- private OdbcResponse performHandshake(long reqId, OdbcHandshakeRequest req) {
- try {
- SqlListenerProtocolVersion version = req.version();
-
- if (version == SqlListenerProtocolVersion.UNKNOWN) {
- IgniteProductVersion ver = ctx.grid().version();
-
- String verStr = Byte.toString(ver.major()) + '.' + ver.minor() + '.' + ver.maintenance();
-
- OdbcHandshakeResult res = new OdbcHandshakeResult(false, OdbcUtils.VER_LATEST.since(), verStr);
-
- return new OdbcResponse(res);
- }
-
- OdbcHandshakeResult res = new OdbcHandshakeResult(true, null, null);
-
- distributedJoins = req.distributedJoins();
- enforceJoinOrder = req.enforceJoinOrder();
-
- return new OdbcResponse(res);
- }
- catch (Exception e) {
- U.error(log, "Failed to perform handshake [reqId=" + reqId + ", req=" + req + ']', e);
-
- return new OdbcResponse(OdbcResponse.STATUS_FAILED, e.toString());
- }
- }
-
- /**
- * {@link SqlListenerQueryExecuteRequest} command handler.
- *
- * @param reqId Request ID.
- * @param req Execute query request.
- * @return Response.
- */
- private OdbcResponse executeQuery(long reqId, SqlListenerQueryExecuteRequest req) {
- int cursorCnt = qryCursors.size();
-
- if (maxCursors > 0 && cursorCnt >= maxCursors)
- return new OdbcResponse(OdbcResponse.STATUS_FAILED, "Too many opened cursors (either close other " +
- "opened cursors or increase the limit through OdbcConfiguration.setMaxOpenCursors()) " +
- "[maximum=" + maxCursors + ", current=" + cursorCnt + ']');
-
- long qryId = QRY_ID_GEN.getAndIncrement();
-
- try {
- String sql = OdbcEscapeUtils.parse(req.sqlQuery());
-
- if (log.isDebugEnabled())
- log.debug("ODBC query parsed [reqId=" + reqId + ", original=" + req.sqlQuery() +
- ", parsed=" + sql + ']');
-
- SqlFieldsQuery qry = new SqlFieldsQuery(sql);
-
- qry.setArgs(req.arguments());
-
- qry.setDistributedJoins(distributedJoins);
- qry.setEnforceJoinOrder(enforceJoinOrder);
-
- IgniteCache<Object, Object> cache0 = ctx.grid().cache(req.cacheName());
-
- if (cache0 == null)
- return new OdbcResponse(OdbcResponse.STATUS_FAILED,
- "Cache doesn't exist (did you configure it?): " + req.cacheName());
-
- IgniteCache<Object, Object> cache = cache0.withKeepBinary();
-
- if (cache == null)
- return new OdbcResponse(OdbcResponse.STATUS_FAILED,
- "Can not get cache with keep binary: " + req.cacheName());
-
- QueryCursor qryCur = cache.query(qry);
-
- qryCursors.put(qryId, new IgniteBiTuple<QueryCursor, Iterator>(qryCur, null));
-
- List<?> fieldsMeta = ((QueryCursorImpl) qryCur).fieldsMeta();
-
- SqlListenerQueryExecuteResult res = new SqlListenerQueryExecuteResult(qryId, convertMetadata(fieldsMeta));
-
- return new OdbcResponse(res);
- }
- catch (Exception e) {
- qryCursors.remove(qryId);
-
- U.error(log, "Failed to execute SQL query [reqId=" + reqId + ", req=" + req + ']', e);
-
- return new OdbcResponse(OdbcResponse.STATUS_FAILED, e.toString());
- }
- }
-
- /**
- * {@link SqlListenerQueryCloseRequest} command handler.
- *
- * @param reqId Request ID.
- * @param req Execute query request.
- * @return Response.
- */
- private OdbcResponse closeQuery(long reqId, SqlListenerQueryCloseRequest req) {
- try {
- IgniteBiTuple<QueryCursor, Iterator> tuple = qryCursors.get(req.queryId());
-
- if (tuple == null)
- return new OdbcResponse(OdbcResponse.STATUS_FAILED, "Failed to find query with ID: " + req.queryId());
-
- QueryCursor cur = tuple.get1();
-
- assert(cur != null);
-
- cur.close();
-
- qryCursors.remove(req.queryId());
-
- SqlListenerQueryCloseResult res = new SqlListenerQueryCloseResult(req.queryId());
-
- return new OdbcResponse(res);
- }
- catch (Exception e) {
- qryCursors.remove(req.queryId());
-
- U.error(log, "Failed to close SQL query [reqId=" + reqId + ", req=" + req.queryId() + ']', e);
-
- return new OdbcResponse(OdbcResponse.STATUS_FAILED, e.toString());
- }
- }
-
- /**
- * {@link SqlListenerQueryFetchRequest} command handler.
- *
- * @param reqId Request ID.
- * @param req Execute query request.
- * @return Response.
- */
- private OdbcResponse fetchQuery(long reqId, SqlListenerQueryFetchRequest req) {
- try {
- IgniteBiTuple<QueryCursor, Iterator> tuple = qryCursors.get(req.queryId());
-
- if (tuple == null)
- return new OdbcResponse(OdbcResponse.STATUS_FAILED, "Failed to find query with ID: " + req.queryId());
-
- Iterator iter = tuple.get2();
-
- if (iter == null) {
- QueryCursor cur = tuple.get1();
-
- iter = cur.iterator();
-
- tuple.put(cur, iter);
- }
-
- List<Object> items = new ArrayList<>();
-
- for (int i = 0; i < req.pageSize() && iter.hasNext(); ++i)
- items.add(iter.next());
-
- SqlListenerQueryFetchResult res = new SqlListenerQueryFetchResult(req.queryId(), items, !iter.hasNext());
-
- return new OdbcResponse(res);
- }
- catch (Exception e) {
- U.error(log, "Failed to fetch SQL query result [reqId=" + reqId + ", req=" + req + ']', e);
-
- return new OdbcResponse(OdbcResponse.STATUS_FAILED, e.toString());
- }
- }
-
- /**
- * {@link OdbcQueryGetColumnsMetaRequest} command handler.
- *
- * @param reqId Request ID.
- * @param req Get columns metadata request.
- * @return Response.
- */
- private OdbcResponse getColumnsMeta(long reqId, OdbcQueryGetColumnsMetaRequest req) {
- try {
- List<SqlListenerColumnMeta> meta = new ArrayList<>();
-
- String cacheName;
- String tableName;
-
- if (req.tableName().contains(".")) {
- // Parsing two-part table name.
- String[] parts = req.tableName().split("\\.");
-
- cacheName = OdbcUtils.removeQuotationMarksIfNeeded(parts[0]);
-
- tableName = parts[1];
- }
- else {
- cacheName = OdbcUtils.removeQuotationMarksIfNeeded(req.cacheName());
-
- tableName = req.tableName();
- }
-
- Collection<GridQueryTypeDescriptor> tablesMeta = ctx.query().types(cacheName);
-
- for (GridQueryTypeDescriptor table : tablesMeta) {
- if (!matches(table.name(), tableName))
- continue;
-
- for (Map.Entry<String, Class<?>> field : table.fields().entrySet()) {
- if (!matches(field.getKey(), req.columnName()))
- continue;
-
- SqlListenerColumnMeta columnMeta = new SqlListenerColumnMeta(req.cacheName(), table.name(),
- field.getKey(), field.getValue());
-
- if (!meta.contains(columnMeta))
- meta.add(columnMeta);
- }
- }
-
- OdbcQueryGetColumnsMetaResult res = new OdbcQueryGetColumnsMetaResult(meta);
-
- return new OdbcResponse(res);
- }
- catch (Exception e) {
- U.error(log, "Failed to get columns metadata [reqId=" + reqId + ", req=" + req + ']', e);
-
- return new OdbcResponse(OdbcResponse.STATUS_FAILED, e.toString());
- }
- }
-
- /**
- * {@link OdbcQueryGetTablesMetaRequest} command handler.
- *
- * @param reqId Request ID.
- * @param req Get tables metadata request.
- * @return Response.
- */
- private OdbcResponse getTablesMeta(long reqId, OdbcQueryGetTablesMetaRequest req) {
- try {
- List<OdbcTableMeta> meta = new ArrayList<>();
-
- String realSchema = OdbcUtils.removeQuotationMarksIfNeeded(req.schema());
-
- for (String cacheName : ctx.cache().cacheNames())
- {
- if (!matches(cacheName, realSchema))
- continue;
-
- Collection<GridQueryTypeDescriptor> tablesMeta = ctx.query().types(cacheName);
-
- for (GridQueryTypeDescriptor table : tablesMeta) {
- if (!matches(table.name(), req.table()))
- continue;
-
- if (!matches("TABLE", req.tableType()))
- continue;
-
- OdbcTableMeta tableMeta = new OdbcTableMeta(null, cacheName, table.name(), "TABLE");
-
- if (!meta.contains(tableMeta))
- meta.add(tableMeta);
- }
- }
-
- OdbcQueryGetTablesMetaResult res = new OdbcQueryGetTablesMetaResult(meta);
-
- return new OdbcResponse(res);
- }
- catch (Exception e) {
- U.error(log, "Failed to get tables metadata [reqId=" + reqId + ", req=" + req + ']', e);
-
- return new OdbcResponse(OdbcResponse.STATUS_FAILED, e.toString());
- }
- }
-
- /**
- * {@link OdbcQueryGetParamsMetaRequest} command handler.
- *
- * @param reqId Request ID.
- * @param req Get params metadata request.
- * @return Response.
- */
- private OdbcResponse getParamsMeta(long reqId, OdbcQueryGetParamsMetaRequest req) {
- try {
- PreparedStatement stmt = ctx.query().prepareNativeStatement(req.cacheName(), req.query());
-
- ParameterMetaData pmd = stmt.getParameterMetaData();
-
- byte[] typeIds = new byte[pmd.getParameterCount()];
-
- for (int i = 1; i <= pmd.getParameterCount(); ++i) {
- int sqlType = pmd.getParameterType(i);
-
- typeIds[i - 1] = sqlTypeToBinary(sqlType);
- }
-
- OdbcQueryGetParamsMetaResult res = new OdbcQueryGetParamsMetaResult(typeIds);
-
- return new OdbcResponse(res);
- }
- catch (Exception e) {
- U.error(log, "Failed to get params metadata [reqId=" + reqId + ", req=" + req + ']', e);
-
- return new OdbcResponse(OdbcResponse.STATUS_FAILED, e.toString());
- }
- }
-
- /**
- * Convert {@link java.sql.Types} to binary type constant (See {@link GridBinaryMarshaller} constants).
- *
- * @param sqlType SQL type.
- * @return Binary type.
- */
- private static byte sqlTypeToBinary(int sqlType) {
- switch (sqlType) {
- case Types.BIGINT:
- return GridBinaryMarshaller.LONG;
-
- case Types.BOOLEAN:
- return GridBinaryMarshaller.BOOLEAN;
-
- case Types.DATE:
- return GridBinaryMarshaller.DATE;
-
- case Types.DOUBLE:
- return GridBinaryMarshaller.DOUBLE;
-
- case Types.FLOAT:
- case Types.REAL:
- return GridBinaryMarshaller.FLOAT;
-
- case Types.NUMERIC:
- case Types.DECIMAL:
- return GridBinaryMarshaller.DECIMAL;
-
- case Types.INTEGER:
- return GridBinaryMarshaller.INT;
-
- case Types.SMALLINT:
- return GridBinaryMarshaller.SHORT;
-
- case Types.TIME:
- return GridBinaryMarshaller.TIME;
-
- case Types.TIMESTAMP:
- return GridBinaryMarshaller.TIMESTAMP;
-
- case Types.TINYINT:
- return GridBinaryMarshaller.BYTE;
-
- case Types.CHAR:
- case Types.VARCHAR:
- case Types.LONGNVARCHAR:
- return GridBinaryMarshaller.STRING;
-
- case Types.NULL:
- return GridBinaryMarshaller.NULL;
-
- case Types.BINARY:
- case Types.VARBINARY:
- case Types.LONGVARBINARY:
- default:
- return GridBinaryMarshaller.BYTE_ARR;
- }
- }
-
- /**
- * Convert metadata in collection from {@link GridQueryFieldMetadata} to
- * {@link SqlListenerColumnMeta}.
- *
- * @param meta Internal query field metadata.
- * @return Odbc query field metadata.
- */
- private static Collection<SqlListenerColumnMeta> convertMetadata(Collection<?> meta) {
- List<SqlListenerColumnMeta> res = new ArrayList<>();
-
- if (meta != null) {
- for (Object info : meta) {
- assert info instanceof GridQueryFieldMetadata;
-
- res.add(new SqlListenerColumnMeta((GridQueryFieldMetadata)info));
- }
- }
-
- return res;
- }
-
- /**
- * Checks whether string matches SQL pattern.
- *
- * @param str String.
- * @param ptrn Pattern.
- * @return Whether string matches pattern.
- */
- private static boolean matches(String str, String ptrn) {
- return str != null && (F.isEmpty(ptrn) ||
- str.toUpperCase().matches(ptrn.toUpperCase().replace("%", ".*").replace("_", ".")));
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e5a82d6/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcResponse.java
deleted file mode 100644
index 12ac4bc..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcResponse.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.odbc;
-
-import org.apache.ignite.internal.util.tostring.GridToStringInclude;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * ODBC protocol response.
- */
-public class OdbcResponse {
- /** Command succeeded. */
- public static final int STATUS_SUCCESS = 0;
-
- /** Command failed. */
- public static final int STATUS_FAILED = 1;
-
- /** Success status. */
- private final int status;
-
- /** Error. */
- private final String err;
-
- /** Response object. */
- @GridToStringInclude
- private final Object obj;
-
- /**
- * Constructs successful rest response.
- *
- * @param obj Response object.
- */
- public OdbcResponse(Object obj) {
- this.status = STATUS_SUCCESS;
-
- this.obj = obj;
- this.err = null;
- }
-
- /**
- * Constructs failed rest response.
- *
- * @param status Response status.
- * @param err Error, {@code null} if success is {@code true}.
- */
- public OdbcResponse(int status, @Nullable String err) {
- assert status != STATUS_SUCCESS;
-
- this.status = status;
-
- this.obj = null;
- this.err = err;
- }
-
- /**
- * @return Success flag.
- */
- public int status() {
- return status;
- }
-
- /**
- * @return Response object.
- */
- public Object response() {
- return obj;
- }
-
- /**
- * @return Error.
- */
- public String error() {
- return err;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(OdbcResponse.class, this);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e5a82d6/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcUtils.java
index 8bf1959..da56813 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcUtils.java
@@ -24,7 +24,7 @@ import org.apache.ignite.IgniteException;
*/
public class OdbcUtils {
/** Latest version. */
- public static final SqlListenerProtocolVersion VER_LATEST = SqlListenerProtocolVersion.VER_2_1_0;
+ public static final SqlListenerProtocolVersion VER_LATEST = SqlListenerProtocolVersion.VER_2_0_0;
/**
* Add quotation marks at the beginning and end of the string.
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e5a82d6/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerConnectionContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerConnectionContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerConnectionContext.java
new file mode 100644
index 0000000..759f3d4
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerConnectionContext.java
@@ -0,0 +1,56 @@
+/*
+ * 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.odbc;
+
+/**
+ * SQL listener connection context.
+ */
+public class SqlListenerConnectionContext {
+ /** Request handler. */
+ private final SqlListenerRequestHandler handler;
+
+ /** Message parser. */
+ private final SqlListenerMessageParser parser;
+
+ /**
+ * Constructor.
+ *
+ * @param handler Handler.
+ * @param parser Parser.
+ */
+ public SqlListenerConnectionContext(SqlListenerRequestHandler handler, SqlListenerMessageParser parser) {
+ this.handler = handler;
+ this.parser = parser;
+ }
+
+ /**
+ * Handler getter.
+ * @return Request handler for the connection.
+ */
+ public SqlListenerRequestHandler handler() {
+ return handler;
+ }
+
+ /**
+ * Parser getter
+ * @return Message parser for the connection.
+ */
+ public SqlListenerMessageParser parser() {
+ return parser;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e5a82d6/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerHandshakeRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerHandshakeRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerHandshakeRequest.java
new file mode 100644
index 0000000..09ac05a
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerHandshakeRequest.java
@@ -0,0 +1,83 @@
+/*
+ * 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.odbc;
+
+import org.apache.ignite.internal.util.typedef.internal.S;
+
+/**
+ * ODBC handshake request.
+ */
+public class SqlListenerHandshakeRequest extends SqlListenerRequest {
+ /** Protocol version. */
+ private final SqlListenerProtocolVersion ver;
+
+ /** Distributed joins flag. */
+ private boolean distributedJoins = false;
+
+ /** Enforce join order flag. */
+ private boolean enforceJoinOrder = false;
+
+ /**
+ * @param ver Long value for protocol version.
+ */
+ public SqlListenerHandshakeRequest(long ver) {
+ super(HANDSHAKE);
+
+ this.ver = SqlListenerProtocolVersion.fromLong(ver);
+ }
+
+ /**
+ * @return Protocol version.
+ */
+ public SqlListenerProtocolVersion version() {
+ return ver;
+ }
+
+ /**
+ * @return Distributed joins flag.
+ */
+ public boolean distributedJoins() {
+ return distributedJoins;
+ }
+
+ /**
+ * @param distributedJoins Distributed joins flag.
+ */
+ public void distributedJoins(boolean distributedJoins) {
+ this.distributedJoins = distributedJoins;
+ }
+
+ /**
+ * @return Enforce join order flag.
+ */
+ public boolean enforceJoinOrder() {
+ return enforceJoinOrder;
+ }
+
+ /**
+ * @param enforceJoinOrder Enforce join order flag.
+ */
+ public void enforceJoinOrder(boolean enforceJoinOrder) {
+ this.enforceJoinOrder = enforceJoinOrder;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(SqlListenerHandshakeRequest.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e5a82d6/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerHandshakeResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerHandshakeResult.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerHandshakeResult.java
new file mode 100644
index 0000000..ca8b629
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerHandshakeResult.java
@@ -0,0 +1,73 @@
+/*
+ * 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.odbc;
+
+import org.apache.ignite.internal.util.typedef.internal.S;
+
+/**
+ * ODBC handshake result.
+ */
+public class SqlListenerHandshakeResult {
+ /** Handshake accepted. */
+ private final boolean accepted;
+
+ /** Apache Ignite version when protocol version has been introduced. */
+ private final String protoVerSince;
+
+ /** Current Apache Ignite version. */
+ private final String curVer;
+
+ /**
+ * Constructor.
+ *
+ * @param accepted Indicates whether handshake accepted or not.
+ * @param protoVerSince Apache Ignite version when protocol version has been introduced.
+ * @param curVer Current Apache Ignite version.
+ */
+ public SqlListenerHandshakeResult(boolean accepted, String protoVerSince, String curVer) {
+ this.accepted = accepted;
+ this.protoVerSince = protoVerSince;
+ this.curVer = curVer;
+ }
+
+ /**
+ * @return Query ID.
+ */
+ public boolean accepted() {
+ return accepted;
+ }
+
+ /**
+ * @return Apache Ignite version when protocol version has been introduced.
+ */
+ public String protocolVersionSince() {
+ return protoVerSince;
+ }
+
+ /**
+ * @return Current Apache Ignite version.
+ */
+ public String currentVersion() {
+ return curVer;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(SqlListenerHandshakeResult.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e5a82d6/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerMessageParser.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerMessageParser.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerMessageParser.java
new file mode 100644
index 0000000..c59ea54
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerMessageParser.java
@@ -0,0 +1,39 @@
+/*
+ * 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.odbc;
+
+/**
+ * SQL listener message parser.
+ */
+public interface SqlListenerMessageParser {
+ /**
+ * Decode request from byte array.
+ *
+ * @param msg Message.
+ * @return Request.
+ */
+ public SqlListenerRequest decode(byte[] msg);
+
+ /**
+ * Encode response to byte array.
+ *
+ * @param resp Response.
+ * @return Message.
+ */
+ public byte[] encode(SqlListenerResponse resp);
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e5a82d6/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerProtocolVersion.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerProtocolVersion.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerProtocolVersion.java
index 372188c..62e07ee 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerProtocolVersion.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerProtocolVersion.java
@@ -21,8 +21,8 @@ package org.apache.ignite.internal.processors.odbc;
* SQL listener protocol version.
*/
public enum SqlListenerProtocolVersion {
- /** Version 2.1.0. */
- VER_2_1_0(makeVersion(2, 1, 0), "2.1.0"),
+ /** Version 2.0.0. */
+ VER_2_0_0(makeVersion(2, 0, 0), "2.0.0"),
/** Unknown version. */
UNKNOWN(Long.MIN_VALUE, "UNKNOWN");
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e5a82d6/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerRequest.java
index 96f24c8..2714237 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerRequest.java
@@ -45,6 +45,9 @@ public class SqlListenerRequest {
/** Command. */
private final int cmd;
+ /** Request ID. */
+ private long reqId;
+
/**
* @param cmd Command type.
*/
@@ -58,4 +61,18 @@ public class SqlListenerRequest {
public int command() {
return cmd;
}
+
+ /**
+ * @return Request ID.
+ */
+ public long requestId() {
+ return reqId;
+ }
+
+ /**
+ * @param reqId Request ID.
+ */
+ public void requestId(long reqId) {
+ this.reqId = reqId;
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e5a82d6/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerRequestHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerRequestHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerRequestHandler.java
new file mode 100644
index 0000000..0ebb084
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerRequestHandler.java
@@ -0,0 +1,31 @@
+/*
+ * 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.odbc;
+
+/**
+ * SQL listener request handler.
+ */
+public interface SqlListenerRequestHandler {
+ /**
+ * Handle request.
+ *
+ * @param req Request.
+ * @return Response.
+ */
+ public SqlListenerResponse handle(SqlListenerRequest req);
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e5a82d6/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerResponse.java
new file mode 100644
index 0000000..84c1e26
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerResponse.java
@@ -0,0 +1,96 @@
+/*
+ * 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.odbc;
+
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * SQL listener response.
+ */
+public class SqlListenerResponse {
+ /** Command succeeded. */
+ public static final int STATUS_SUCCESS = 0;
+
+ /** Command failed. */
+ public static final int STATUS_FAILED = 1;
+
+ /** Success status. */
+ private final int status;
+
+ /** Error. */
+ private final String err;
+
+ /** Response object. */
+ @GridToStringInclude
+ private final Object obj;
+
+ /**
+ * Constructs successful rest response.
+ *
+ * @param obj Response object.
+ */
+ public SqlListenerResponse(Object obj) {
+ this.status = STATUS_SUCCESS;
+
+ this.obj = obj;
+ this.err = null;
+ }
+
+ /**
+ * Constructs failed rest response.
+ *
+ * @param status Response status.
+ * @param err Error, {@code null} if success is {@code true}.
+ */
+ public SqlListenerResponse(int status, @Nullable String err) {
+ assert status != STATUS_SUCCESS;
+
+ this.status = status;
+
+ this.obj = null;
+ this.err = err;
+ }
+
+ /**
+ * @return Success flag.
+ */
+ public int status() {
+ return status;
+ }
+
+ /**
+ * @return Response object.
+ */
+ public Object response() {
+ return obj;
+ }
+
+ /**
+ * @return Error.
+ */
+ public String error() {
+ return err;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(SqlListenerResponse.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e5a82d6/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeParseResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeParseResult.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeParseResult.java
deleted file mode 100644
index cf05651..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeParseResult.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.odbc.escape;
-
-import org.apache.ignite.internal.util.typedef.internal.S;
-
-/**
- * ODBC escape sequence parse result.
- */
-public class OdbcEscapeParseResult {
- /** Original start position. */
- private final int originalStart;
-
- /** Original length. */
- private final int originalLen;
-
- /** Resulting text. */
- private final String res;
-
- /**
- * Constructor.
- *
- * @param originalStart Original start position.
- * @param originalLen Original length.
- * @param res Resulting text.
- */
- public OdbcEscapeParseResult(int originalStart, int originalLen, String res) {
- this.originalStart = originalStart;
- this.originalLen = originalLen;
- this.res = res;
- }
-
- /**
- * @return Original start position.
- */
- public int originalStart() {
- return originalStart;
- }
-
- /**
- * @return Original length.
- */
- public int originalLength() {
- return originalLen;
- }
-
- /**
- * @return Resulting text.
- */
- public String result() {
- return res;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(OdbcEscapeParseResult.class, this);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e5a82d6/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeToken.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeToken.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeToken.java
deleted file mode 100644
index 6bb4f81..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeToken.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.odbc.escape;
-
-import org.apache.ignite.internal.util.typedef.internal.S;
-
-/**
- * ODBC escape sequence token.
- */
-public class OdbcEscapeToken {
- /** Escape sequence type. */
- private final OdbcEscapeType type;
-
- /** Token length. */
- private final int len;
-
- /**
- * Constructor.
- *
- * @param type Escape sequence type.
- * @param len Token length.
- */
- public OdbcEscapeToken(OdbcEscapeType type, int len) {
- this.type = type;
- this.len = len;
- }
-
- /**
- * @return Escape sequence type.
- */
- public OdbcEscapeType type() {
- return type;
- }
-
- /**
- * @return Token length.
- */
- public int length() {
- return len;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(OdbcEscapeToken.class, this);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e5a82d6/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeType.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeType.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeType.java
deleted file mode 100644
index 44d8361..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeType.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.odbc.escape;
-
-/**
- * ODBC escape sequence type.
- */
-public enum OdbcEscapeType {
- /** Scalar function. */
- SCALAR_FUNCTION("fn", true, false),
-
- /** Outer join. */
- OUTER_JOIN("oj", true, false),
-
- /** Stored procedure call */
- CALL("call", true, false),
-
- /** Date. */
- DATE("d", true, false),
-
- /** Timestamp. */
- TIMESTAMP("ts", true, false),
-
- /** Time. */
- TIME("t", true, false),
-
- /** GUID. */
- GUID("guid", true, false),
-
- /** LIKE escape character clause. */
- ESCAPE_WO_TOKEN("\'", false, false),
-
- /** LIKE escape character clause. */
- ESCAPE("escape", true, false);
-
- /** Values in convenient order. */
- private static final OdbcEscapeType[] VALS = new OdbcEscapeType[] {
- SCALAR_FUNCTION, // Assume that scalar functions are very frequent.
- DATE, TIMESTAMP, // Date and timestamp are relatively frequent as well; also TS must go before T.
- OUTER_JOIN, // Joins are less frequent,
- CALL, // Procedure calls are less frequent than joins.
- ESCAPE_WO_TOKEN, ESCAPE, TIME, GUID // LIKE, TIME and GUID are even less frequent.
- };
-
- /**
- * Get values in convenient order, where the most frequent values goes first, and "startsWith" invocation is
- * enough to get type (i.e. "ts" goes before "t").
- *
- * @return Values.
- */
- public static OdbcEscapeType[] sortedValues() {
- return VALS;
- }
-
- /** Escape sequence body. */
- private final String body;
-
- /** Whether this is a standard token with no special handling. */
- private final boolean standard;
-
- /** Whether empty escape sequence is allowed. */
- private final boolean allowEmpty;
-
- /**
- * Constructor.
- *
- * @param body Escape sequence body.
- * @param standard Whether this is a standard token with no special handling.
- * @param allowEmpty Whether empty escape sequence is allowed.
- */
- OdbcEscapeType(String body, boolean standard, boolean allowEmpty) {
- this.body = body;
- this.standard = standard;
- this.allowEmpty = allowEmpty;
- }
-
- /**
- * @return Escape sequence body.
- */
- public String body() {
- return body;
- }
-
- /**
- * @return Whether this is a standard token with no special handling.
- */
- public boolean standard() {
- return standard;
- }
-
- /**
- * @return Whether empty escape sequence is allowed.
- */
- public boolean allowEmpty() {
- return allowEmpty;
- }
-}
[08/50] [abbrv] ignite git commit: IGNITE-4988 Fixed metadata import
from RDBMS.
Posted by sb...@apache.org.
IGNITE-4988 Fixed metadata import from RDBMS.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0e8e5dd9
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0e8e5dd9
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0e8e5dd9
Branch: refs/heads/ignite-5009
Commit: 0e8e5dd99ec647a33f090cde02cf7cddf4a9b24c
Parents: 73d4e11
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Fri Apr 28 18:06:41 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Apr 28 18:06:41 2017 +0700
----------------------------------------------------------------------
.../web-console/backend/app/browsersHandler.js | 4 ++--
.../app/modules/agent/AgentManager.service.js | 20 ++++++++--------
.../agent/handlers/DatabaseListener.java | 24 ++++++++++----------
3 files changed, 24 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0e8e5dd9/modules/web-console/backend/app/browsersHandler.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/app/browsersHandler.js b/modules/web-console/backend/app/browsersHandler.js
index 9f31046..4a03abe 100644
--- a/modules/web-console/backend/app/browsersHandler.js
+++ b/modules/web-console/backend/app/browsersHandler.js
@@ -155,8 +155,8 @@ module.exports.factory = (_, socketio, configure, errors) => {
});
// Return tables from database to browser.
- sock.on('schemaImport:tables', (...args) => {
- this.executeOnAgent(token(), demo, 'schemaImport:tables', ...args);
+ sock.on('schemaImport:metadata', (...args) => {
+ this.executeOnAgent(token(), demo, 'schemaImport:metadata', ...args);
});
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0e8e5dd9/modules/web-console/frontend/app/modules/agent/AgentManager.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/agent/AgentManager.service.js b/modules/web-console/frontend/app/modules/agent/AgentManager.service.js
index 4c388f1..db8b493 100644
--- a/modules/web-console/frontend/app/modules/agent/AgentManager.service.js
+++ b/modules/web-console/frontend/app/modules/agent/AgentManager.service.js
@@ -241,33 +241,33 @@ export default class IgniteAgentManager {
}
/**
- * @param {Object} driverPath
- * @param {Object} driverClass
- * @param {Object} url
+ * @param {Object} jdbcDriverJar
+ * @param {Object} jdbcDriverClass
+ * @param {Object} jdbcUrl
* @param {Object} user
* @param {Object} password
* @returns {Promise}
*/
- schemas({driverPath, driverClass, url, user, password}) {
+ schemas({jdbcDriverJar, jdbcDriverClass, jdbcUrl, user, password}) {
const info = {user, password};
- return this._emit('schemaImport:schemas', {driverPath, driverClass, url, info});
+ return this._emit('schemaImport:schemas', {jdbcDriverJar, jdbcDriverClass, jdbcUrl, info});
}
/**
- * @param {Object} driverPath
- * @param {Object} driverClass
- * @param {Object} url
+ * @param {Object} jdbcDriverJar
+ * @param {Object} jdbcDriverClass
+ * @param {Object} jdbcUrl
* @param {Object} user
* @param {Object} password
* @param {Object} schemas
* @param {Object} tablesOnly
* @returns {Promise} Promise on list of tables (see org.apache.ignite.schema.parser.DbTable java class)
*/
- tables({driverPath, driverClass, url, user, password, schemas, tablesOnly}) {
+ tables({jdbcDriverJar, jdbcDriverClass, jdbcUrl, user, password, schemas, tablesOnly}) {
const info = {user, password};
- return this._emit('schemaImport:tables', {driverPath, driverClass, url, info, schemas, tablesOnly});
+ return this._emit('schemaImport:metadata', {jdbcDriverJar, jdbcDriverClass, jdbcUrl, info, schemas, tablesOnly});
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/0e8e5dd9/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/DatabaseListener.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/DatabaseListener.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/DatabaseListener.java
index 745c1f2..d1394c9 100644
--- a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/DatabaseListener.java
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/DatabaseListener.java
@@ -59,18 +59,18 @@ public class DatabaseListener {
@Override public Object execute(Map<String, Object> args) throws Exception {
String driverPath = null;
- if (args.containsKey("driverPath"))
- driverPath = args.get("driverPath").toString();
+ if (args.containsKey("jdbcDriverJar"))
+ driverPath = args.get("jdbcDriverJar").toString();
- if (!args.containsKey("driverClass"))
+ if (!args.containsKey("jdbcDriverClass"))
throw new IllegalArgumentException("Missing driverClass in arguments: " + args);
- String driverCls = args.get("driverClass").toString();
+ String driverCls = args.get("jdbcDriverClass").toString();
- if (!args.containsKey("url"))
+ if (!args.containsKey("jdbcUrl"))
throw new IllegalArgumentException("Missing url in arguments: " + args);
- String url = args.get("url").toString();
+ String url = args.get("jdbcUrl").toString();
if (!args.containsKey("info"))
throw new IllegalArgumentException("Missing info in arguments: " + args);
@@ -88,18 +88,18 @@ public class DatabaseListener {
@Override public Object execute(Map<String, Object> args) throws Exception {
String driverPath = null;
- if (args.containsKey("driverPath"))
- driverPath = args.get("driverPath").toString();
+ if (args.containsKey("jdbcDriverJar"))
+ driverPath = args.get("jdbcDriverJar").toString();
- if (!args.containsKey("driverClass"))
+ if (!args.containsKey("jdbcDriverClass"))
throw new IllegalArgumentException("Missing driverClass in arguments: " + args);
- String driverCls = args.get("driverClass").toString();
+ String driverCls = args.get("jdbcDriverClass").toString();
- if (!args.containsKey("url"))
+ if (!args.containsKey("jdbcUrl"))
throw new IllegalArgumentException("Missing url in arguments: " + args);
- String url = args.get("url").toString();
+ String url = args.get("jdbcUrl").toString();
if (!args.containsKey("info"))
throw new IllegalArgumentException("Missing info in arguments: " + args);
[44/50] [abbrv] ignite git commit: IGNTIE-4220: Support statements
for JDBC and Cassandra store. This closes #1898.
Posted by sb...@apache.org.
IGNTIE-4220: Support statements for JDBC and Cassandra store. This closes #1898.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8cd9fbe5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8cd9fbe5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8cd9fbe5
Branch: refs/heads/ignite-5009
Commit: 8cd9fbe59050b788ce9cec7f0f2b59bca36e7545
Parents: 988ca32
Author: Andrey V. Mashenkov <an...@gmail.com>
Authored: Thu May 4 17:08:29 2017 +0300
Committer: Andrey V. Mashenkov <an...@gmail.com>
Committed: Thu May 4 18:20:47 2017 +0300
----------------------------------------------------------------------
.../store/cassandra/CassandraCacheStore.java | 16 ++++-
.../session/LoadCacheCustomQueryWorker.java | 26 +++++--
.../ignite/tests/IgnitePersistentStoreTest.java | 30 ++++++---
.../tests/persistence/blob/ignite-config.xml | 4 +-
.../tests/persistence/pojo/ignite-config.xml | 4 +-
.../persistence/primitive/ignite-config.xml | 4 +-
.../primitive/ignite-remote-server-config.xml | 4 +-
.../store/jdbc/CacheAbstractJdbcStore.java | 71 ++++++++++++++------
.../CacheJdbcPojoStoreAbstractSelfTest.java | 49 ++++++++++++++
9 files changed, 163 insertions(+), 45 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/8cd9fbe5/modules/cassandra/store/src/main/java/org/apache/ignite/cache/store/cassandra/CassandraCacheStore.java
----------------------------------------------------------------------
diff --git a/modules/cassandra/store/src/main/java/org/apache/ignite/cache/store/cassandra/CassandraCacheStore.java b/modules/cassandra/store/src/main/java/org/apache/ignite/cache/store/cassandra/CassandraCacheStore.java
index 70d798b..98c8b40 100644
--- a/modules/cassandra/store/src/main/java/org/apache/ignite/cache/store/cassandra/CassandraCacheStore.java
+++ b/modules/cassandra/store/src/main/java/org/apache/ignite/cache/store/cassandra/CassandraCacheStore.java
@@ -20,6 +20,7 @@ package org.apache.ignite.cache.store.cassandra;
import com.datastax.driver.core.BoundStatement;
import com.datastax.driver.core.PreparedStatement;
import com.datastax.driver.core.Row;
+import com.datastax.driver.core.Statement;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
@@ -113,10 +114,19 @@ public class CassandraCacheStore<K, V> implements CacheStore<K, V> {
CassandraSession ses = getCassandraSession();
for (Object obj : args) {
- if (obj == null || !(obj instanceof String) || !((String)obj).trim().toLowerCase().startsWith("select"))
- continue;
+ LoadCacheCustomQueryWorker<K, V> task = null;
- futs.add(pool.submit(new LoadCacheCustomQueryWorker<>(ses, (String) obj, controller, log, clo)));
+ if (obj instanceof Statement)
+ task = new LoadCacheCustomQueryWorker<>(ses, (Statement)obj, controller, log, clo);
+ else if (obj instanceof String) {
+ String qry = ((String)obj).trim();
+
+ if (qry.toLowerCase().startsWith("select"))
+ task = new LoadCacheCustomQueryWorker<>(ses, (String) obj, controller, log, clo);
+ }
+
+ if (task != null)
+ futs.add(pool.submit(task));
}
for (Future<?> fut : futs)
http://git-wip-us.apache.org/repos/asf/ignite/blob/8cd9fbe5/modules/cassandra/store/src/main/java/org/apache/ignite/cache/store/cassandra/session/LoadCacheCustomQueryWorker.java
----------------------------------------------------------------------
diff --git a/modules/cassandra/store/src/main/java/org/apache/ignite/cache/store/cassandra/session/LoadCacheCustomQueryWorker.java b/modules/cassandra/store/src/main/java/org/apache/ignite/cache/store/cassandra/session/LoadCacheCustomQueryWorker.java
index d3ace7d..d186b98 100644
--- a/modules/cassandra/store/src/main/java/org/apache/ignite/cache/store/cassandra/session/LoadCacheCustomQueryWorker.java
+++ b/modules/cassandra/store/src/main/java/org/apache/ignite/cache/store/cassandra/session/LoadCacheCustomQueryWorker.java
@@ -36,8 +36,8 @@ public class LoadCacheCustomQueryWorker<K, V> implements Callable<Void> {
/** Cassandra session to execute CQL query */
private final CassandraSession ses;
- /** User query. */
- private final String qry;
+ /** Statement. */
+ private final Statement stmt;
/** Persistence controller */
private final PersistenceController ctrl;
@@ -49,12 +49,28 @@ public class LoadCacheCustomQueryWorker<K, V> implements Callable<Void> {
private final IgniteBiInClosure<K, V> clo;
/**
+ * @param ses Session.
+ * @param qry Query.
+ * @param ctrl Control.
+ * @param log Logger.
* @param clo Closure for loaded values.
*/
public LoadCacheCustomQueryWorker(CassandraSession ses, String qry, PersistenceController ctrl,
- IgniteLogger log, IgniteBiInClosure<K, V> clo) {
+ IgniteLogger log, IgniteBiInClosure<K, V> clo) {
+ this(ses, new SimpleStatement(qry.trim().endsWith(";") ? qry : qry + ';'), ctrl, log, clo);
+ }
+
+ /**
+ * @param ses Session.
+ * @param stmt Statement.
+ * @param ctrl Control.
+ * @param log Logger.
+ * @param clo Closure for loaded values.
+ */
+ public LoadCacheCustomQueryWorker(CassandraSession ses, Statement stmt, PersistenceController ctrl,
+ IgniteLogger log, IgniteBiInClosure<K, V> clo) {
this.ses = ses;
- this.qry = qry.trim().endsWith(";") ? qry : qry + ";";
+ this.stmt = stmt;
this.ctrl = ctrl;
this.log = log;
this.clo = clo;
@@ -70,7 +86,7 @@ public class LoadCacheCustomQueryWorker<K, V> implements Callable<Void> {
/** {@inheritDoc} */
@Override public Statement getStatement() {
- return new SimpleStatement(qry);
+ return stmt;
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/8cd9fbe5/modules/cassandra/store/src/test/java/org/apache/ignite/tests/IgnitePersistentStoreTest.java
----------------------------------------------------------------------
diff --git a/modules/cassandra/store/src/test/java/org/apache/ignite/tests/IgnitePersistentStoreTest.java b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/IgnitePersistentStoreTest.java
index 97e7230..c8c7139 100644
--- a/modules/cassandra/store/src/test/java/org/apache/ignite/tests/IgnitePersistentStoreTest.java
+++ b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/IgnitePersistentStoreTest.java
@@ -17,6 +17,7 @@
package org.apache.ignite.tests;
+import com.datastax.driver.core.SimpleStatement;
import java.util.Collection;
import java.util.Date;
import java.util.Map;
@@ -43,6 +44,7 @@ import org.apache.log4j.Logger;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.Assert;
import org.springframework.core.io.ClassPathResource;
/**
@@ -429,31 +431,39 @@ public class IgnitePersistentStoreTest {
LOGGER.info("Running loadCache test");
try (Ignite ignite = Ignition.start("org/apache/ignite/tests/persistence/pojo/ignite-config.xml")) {
- IgniteCache<PersonId, Person> personCache3 = ignite.getOrCreateCache(new CacheConfiguration<PersonId, Person>("cache3"));
+ CacheConfiguration<PersonId, Person> ccfg = new CacheConfiguration<>("cache3");
+
+ IgniteCache<PersonId, Person> personCache3 = ignite.getOrCreateCache(ccfg);
+
int size = personCache3.size(CachePeekMode.ALL);
LOGGER.info("Initial cache size " + size);
LOGGER.info("Loading cache data from Cassandra table");
- personCache3.loadCache(null, new String[] {"select * from test1.pojo_test3 limit 3"});
+ String qry = "select * from test1.pojo_test3 limit 3";
+
+ personCache3.loadCache(null, qry);
size = personCache3.size(CachePeekMode.ALL);
- if (size != 3) {
- throw new RuntimeException("Cache data was incorrectly loaded from Cassandra. " +
- "Expected number of records is 3, but loaded number of records is " + size);
- }
+ Assert.assertEquals("Cache data was incorrectly loaded from Cassandra table by '" + qry + "'", 3, size);
+
+ personCache3.clear();
+
+ personCache3.loadCache(null, new SimpleStatement(qry));
+
+ size = personCache3.size(CachePeekMode.ALL);
+ Assert.assertEquals("Cache data was incorrectly loaded from Cassandra table by statement", 3, size);
personCache3.clear();
personCache3.loadCache(null);
size = personCache3.size(CachePeekMode.ALL);
- if (size != TestsHelper.getBulkOperationSize()) {
- throw new RuntimeException("Cache data was incorrectly loaded from Cassandra. " +
+ Assert.assertEquals("Cache data was incorrectly loaded from Cassandra. " +
"Expected number of records is " + TestsHelper.getBulkOperationSize() +
- ", but loaded number of records is " + size);
- }
+ ", but loaded number of records is " + size,
+ TestsHelper.getBulkOperationSize(), size);
LOGGER.info("Cache data loaded from Cassandra table");
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/8cd9fbe5/modules/cassandra/store/src/test/resources/org/apache/ignite/tests/persistence/blob/ignite-config.xml
----------------------------------------------------------------------
diff --git a/modules/cassandra/store/src/test/resources/org/apache/ignite/tests/persistence/blob/ignite-config.xml b/modules/cassandra/store/src/test/resources/org/apache/ignite/tests/persistence/blob/ignite-config.xml
index fbf38e9..db360d5 100644
--- a/modules/cassandra/store/src/test/resources/org/apache/ignite/tests/persistence/blob/ignite-config.xml
+++ b/modules/cassandra/store/src/test/resources/org/apache/ignite/tests/persistence/blob/ignite-config.xml
@@ -78,8 +78,8 @@
to our documentation: http://apacheignite.readme.io/docs/cluster-config
-->
<!-- Uncomment static IP finder to enable static-based discovery of initial nodes. -->
- <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">-->
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
+ <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
+ <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">-->
<property name="addresses">
<list>
<!-- In distributed environment, replace with actual host IP address. -->
http://git-wip-us.apache.org/repos/asf/ignite/blob/8cd9fbe5/modules/cassandra/store/src/test/resources/org/apache/ignite/tests/persistence/pojo/ignite-config.xml
----------------------------------------------------------------------
diff --git a/modules/cassandra/store/src/test/resources/org/apache/ignite/tests/persistence/pojo/ignite-config.xml b/modules/cassandra/store/src/test/resources/org/apache/ignite/tests/persistence/pojo/ignite-config.xml
index c9b45c8..af4ffef 100644
--- a/modules/cassandra/store/src/test/resources/org/apache/ignite/tests/persistence/pojo/ignite-config.xml
+++ b/modules/cassandra/store/src/test/resources/org/apache/ignite/tests/persistence/pojo/ignite-config.xml
@@ -153,8 +153,8 @@
to our documentation: http://apacheignite.readme.io/docs/cluster-config
-->
<!-- Uncomment static IP finder to enable static-based discovery of initial nodes. -->
- <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">-->
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
+ <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
+ <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">-->
<property name="addresses">
<list>
<!-- In distributed environment, replace with actual host IP address. -->
http://git-wip-us.apache.org/repos/asf/ignite/blob/8cd9fbe5/modules/cassandra/store/src/test/resources/org/apache/ignite/tests/persistence/primitive/ignite-config.xml
----------------------------------------------------------------------
diff --git a/modules/cassandra/store/src/test/resources/org/apache/ignite/tests/persistence/primitive/ignite-config.xml b/modules/cassandra/store/src/test/resources/org/apache/ignite/tests/persistence/primitive/ignite-config.xml
index 13e0922..a7d101d 100644
--- a/modules/cassandra/store/src/test/resources/org/apache/ignite/tests/persistence/primitive/ignite-config.xml
+++ b/modules/cassandra/store/src/test/resources/org/apache/ignite/tests/persistence/primitive/ignite-config.xml
@@ -78,8 +78,8 @@
to our documentation: http://apacheignite.readme.io/docs/cluster-config
-->
<!-- Uncomment static IP finder to enable static-based discovery of initial nodes. -->
- <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">-->
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
+ <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
+ <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">-->
<property name="addresses">
<list>
<!-- In distributed environment, replace with actual host IP address. -->
http://git-wip-us.apache.org/repos/asf/ignite/blob/8cd9fbe5/modules/cassandra/store/src/test/resources/org/apache/ignite/tests/persistence/primitive/ignite-remote-server-config.xml
----------------------------------------------------------------------
diff --git a/modules/cassandra/store/src/test/resources/org/apache/ignite/tests/persistence/primitive/ignite-remote-server-config.xml b/modules/cassandra/store/src/test/resources/org/apache/ignite/tests/persistence/primitive/ignite-remote-server-config.xml
index 8d71aec..bbaff8c 100644
--- a/modules/cassandra/store/src/test/resources/org/apache/ignite/tests/persistence/primitive/ignite-remote-server-config.xml
+++ b/modules/cassandra/store/src/test/resources/org/apache/ignite/tests/persistence/primitive/ignite-remote-server-config.xml
@@ -94,8 +94,8 @@
to our documentation: http://apacheignite.readme.io/docs/cluster-config
-->
<!-- Uncomment static IP finder to enable static-based discovery of initial nodes. -->
- <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">-->
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
+ <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
+ <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">-->
<property name="addresses">
<list>
<!-- In distributed environment, replace with actual host IP address. -->
http://git-wip-us.apache.org/repos/asf/ignite/blob/8cd9fbe5/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
index ba2a98d..46e9022 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
@@ -702,17 +702,34 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
}
}))
throw new CacheLoaderException("Provided key type is not found in store or cache configuration " +
- "[cache=" + U.maskName(cacheName) + ", key=" + keyType + "]");
-
- String qry = args[i + 1].toString();
+ "[cache=" + U.maskName(cacheName) + ", key=" + keyType + ']');
EntryMapping em = entryMapping(cacheName, typeIdForTypeName(kindForName(keyType), keyType));
- if (log.isInfoEnabled())
- log.info("Started load cache using custom query [cache=" + U.maskName(cacheName) +
- ", keyType=" + keyType + ", query=" + qry + "]");
+ Object arg = args[i + 1];
+
+ LoadCacheCustomQueryWorker<K, V> task;
+
+ if (arg instanceof PreparedStatement) {
+ PreparedStatement stmt = (PreparedStatement)arg;
+
+ if (log.isInfoEnabled())
+ log.info("Started load cache using custom statement [cache=" + U.maskName(cacheName) +
+ ", keyType=" + keyType + ", stmt=" + stmt + ']');
+
+ task = new LoadCacheCustomQueryWorker<>(em, stmt, clo);
+ }
+ else {
+ String qry = arg.toString();
- futs.add(pool.submit(new LoadCacheCustomQueryWorker<>(em, qry, clo)));
+ if (log.isInfoEnabled())
+ log.info("Started load cache using custom query [cache=" + U.maskName(cacheName) +
+ ", keyType=" + keyType + ", query=" + qry + ']');
+
+ task = new LoadCacheCustomQueryWorker<>(em, qry, clo);
+ }
+
+ futs.add(pool.submit(task));
}
}
else {
@@ -727,7 +744,7 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
processedKeyTypes.add(keyType);
if (log.isInfoEnabled())
- log.info("Started load cache [cache=" + U.maskName(cacheName) + ", keyType=" + keyType + "]");
+ log.info("Started load cache [cache=" + U.maskName(cacheName) + ", keyType=" + keyType + ']');
if (parallelLoadCacheMinThreshold > 0) {
Connection conn = null;
@@ -744,7 +761,7 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
if (rs.next()) {
if (log.isDebugEnabled())
log.debug("Multithread loading entries from db [cache=" + U.maskName(cacheName) +
- ", keyType=" + keyType + "]");
+ ", keyType=" + keyType + ']');
int keyCnt = em.keyCols.size();
@@ -773,7 +790,7 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
}
catch (SQLException e) {
log.warning("Failed to load entries from db in multithreaded mode, will try in single thread " +
- "[cache=" + U.maskName(cacheName) + ", keyType=" + keyType + " ]", e);
+ "[cache=" + U.maskName(cacheName) + ", keyType=" + keyType + ']', e);
}
finally {
U.closeQuiet(conn);
@@ -782,7 +799,7 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
if (log.isDebugEnabled())
log.debug("Single thread loading entries from db [cache=" + U.maskName(cacheName) +
- ", keyType=" + keyType + "]");
+ ", keyType=" + keyType + ']');
futs.add(pool.submit(loadCacheFull(em, clo)));
}
@@ -809,7 +826,7 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
EntryMapping em = entryMapping(session().cacheName(), typeIdForObject(key));
if (log.isDebugEnabled())
- log.debug("Load value from db [table= " + em.fullTableName() + ", key=" + key + "]");
+ log.debug("Load value from db [table= " + em.fullTableName() + ", key=" + key + ']');
Connection conn = null;
@@ -1910,14 +1927,28 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
/** Entry mapping description. */
private final EntryMapping em;
+ /** User statement. */
+ private PreparedStatement stmt;
+
/** User query. */
- private final String qry;
+ private String qry;
/** Closure for loaded values. */
private final IgniteBiInClosure<K1, V1> clo;
/**
* @param em Entry mapping description.
+ * @param stmt User statement.
+ * @param clo Closure for loaded values.
+ */
+ private LoadCacheCustomQueryWorker(EntryMapping em, PreparedStatement stmt, IgniteBiInClosure<K1, V1> clo) {
+ this.em = em;
+ this.stmt = stmt;
+ this.clo = clo;
+ }
+
+ /**
+ * @param em Entry mapping description.
* @param qry User query.
* @param clo Closure for loaded values.
*/
@@ -1931,12 +1962,12 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
@Override public Void call() throws Exception {
Connection conn = null;
- PreparedStatement stmt = null;
-
try {
- conn = openConnection(true);
+ if (stmt == null) {
+ conn = openConnection(true);
- stmt = conn.prepareStatement(qry);
+ stmt = conn.prepareStatement(qry);
+ }
stmt.setFetchSize(dialect.getFetchSize());
@@ -1962,9 +1993,11 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
throw new CacheLoaderException("Failed to execute custom query for load cache", e);
}
finally {
- U.closeQuiet(stmt);
+ if (conn != null) {
+ U.closeQuiet(stmt);
- U.closeQuiet(conn);
+ U.closeQuiet(conn);
+ }
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/8cd9fbe5/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreAbstractSelfTest.java
index 8544f71..703cbe1 100644
--- a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreAbstractSelfTest.java
@@ -337,6 +337,55 @@ public abstract class CacheJdbcPojoStoreAbstractSelfTest extends GridCommonAbstr
}
/**
+ * Checks that data was loaded correctly with prepared statement.
+ */
+ protected void checkCacheLoadWithStatement() throws SQLException {
+ Connection conn = null;
+
+ PreparedStatement stmt = null;
+
+ try {
+ conn = getConnection();
+
+ conn.setAutoCommit(true);
+
+ String qry = "select id, org_id, name, birthday, gender from Person";
+
+ stmt = conn.prepareStatement(qry);
+
+ IgniteCache<Object, Object> c1 = grid().cache(CACHE_NAME);
+
+ c1.loadCache(null, "org.apache.ignite.cache.store.jdbc.model.PersonKey", stmt);
+
+ assertEquals(PERSON_CNT, c1.size());
+ }
+ finally {
+ U.closeQuiet(stmt);
+
+ U.closeQuiet(conn);
+ }
+
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testLoadCacheWithStatement() throws Exception {
+ startTestGrid(false, false, false, false, 512);
+
+ checkCacheLoadWithStatement();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testLoadCacheWithStatementTx() throws Exception {
+ startTestGrid(false, false, false, true, 512);
+
+ checkCacheLoadWithStatement();
+ }
+
+ /**
* @throws Exception If failed.
*/
public void testLoadCache() throws Exception {
[37/50] [abbrv] ignite git commit: IGNITE-5164: ODBC: renamed classes
which is obviously common with JDBC.
Posted by sb...@apache.org.
IGNITE-5164: ODBC: renamed classes which is obviously common with JDBC.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c7f09d8a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c7f09d8a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c7f09d8a
Branch: refs/heads/ignite-5009
Commit: c7f09d8a3cd6544eea7d78dcce8f8479ce905019
Parents: 7f8a430
Author: devozerov <vo...@gridgain.com>
Authored: Thu May 4 13:28:54 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Thu May 4 13:28:54 2017 +0300
----------------------------------------------------------------------
.../internal/processors/odbc/IgniteTypes.java | 69 -----------
.../processors/odbc/OdbcBufferedParser.java | 81 -------------
.../processors/odbc/OdbcColumnMeta.java | 110 ------------------
.../processors/odbc/OdbcConnectionData.java | 60 ++++++++++
.../processors/odbc/OdbcHandshakeRequest.java | 8 +-
.../processors/odbc/OdbcMessageParser.java | 48 ++++----
.../processors/odbc/OdbcNioListener.java | 44 +------
.../processors/odbc/OdbcNioServerBuffer.java | 114 -------------------
.../internal/processors/odbc/OdbcProcessor.java | 2 +-
.../processors/odbc/OdbcProtocolVersion.java | 88 --------------
.../processors/odbc/OdbcQueryCloseRequest.java | 49 --------
.../processors/odbc/OdbcQueryCloseResult.java | 40 -------
.../odbc/OdbcQueryExecuteRequest.java | 78 -------------
.../processors/odbc/OdbcQueryExecuteResult.java | 54 ---------
.../processors/odbc/OdbcQueryFetchRequest.java | 61 ----------
.../processors/odbc/OdbcQueryFetchResult.java | 66 -----------
.../odbc/OdbcQueryGetColumnsMetaRequest.java | 4 +-
.../odbc/OdbcQueryGetColumnsMetaResult.java | 6 +-
.../odbc/OdbcQueryGetParamsMetaRequest.java | 4 +-
.../odbc/OdbcQueryGetTablesMetaRequest.java | 4 +-
.../internal/processors/odbc/OdbcRequest.java | 61 ----------
.../processors/odbc/OdbcRequestHandler.java | 56 ++++-----
.../internal/processors/odbc/OdbcUtils.java | 32 +++---
.../odbc/SqlListenerBufferedParser.java | 81 +++++++++++++
.../processors/odbc/SqlListenerColumnMeta.java | 110 ++++++++++++++++++
.../processors/odbc/SqlListenerDataTypes.java | 69 +++++++++++
.../odbc/SqlListenerNioServerBuffer.java | 114 +++++++++++++++++++
.../odbc/SqlListenerProtocolVersion.java | 88 ++++++++++++++
.../odbc/SqlListenerQueryCloseRequest.java | 49 ++++++++
.../odbc/SqlListenerQueryCloseResult.java | 40 +++++++
.../odbc/SqlListenerQueryExecuteRequest.java | 78 +++++++++++++
.../odbc/SqlListenerQueryExecuteResult.java | 54 +++++++++
.../odbc/SqlListenerQueryFetchRequest.java | 61 ++++++++++
.../odbc/SqlListenerQueryFetchResult.java | 66 +++++++++++
.../processors/odbc/SqlListenerRequest.java | 61 ++++++++++
35 files changed, 1017 insertions(+), 993 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c7f09d8a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/IgniteTypes.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/IgniteTypes.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/IgniteTypes.java
deleted file mode 100644
index 1eea4e2..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/IgniteTypes.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.odbc;
-
-/**
- * Data type names usable in SQL queries
- * after escape sequence transformation
- */
-public class IgniteTypes {
- /** Type name for 64-bit integer */
- static final String BIGINT = "BIGINT";
-
- /** Type name for byte array */
- static final String BINARY = "BINARY";
-
- /** Type name for boolean flag */
- static final String BIT = "BIT";
-
- /** Type name for unicode string */
- static final String CHAR = "CHAR";
-
- /** Type name for decimal number */
- static final String DECIMAL = "DECIMAL";
-
- /** Type name for unicode string */
- static final String VARCHAR = "VARCHAR";
-
- /** Type name for floating point number */
- static final String DOUBLE = "DOUBLE";
-
- /** Type name for single precision floating point number */
- static final String REAL = "REAL";
-
- /** Type name for universally unique identifier */
- static final String UUID = "UUID";
-
- /** Type name for 16-bit integer */
- static final String SMALLINT = "SMALLINT";
-
- /** Type name for 32-bit integer */
- static final String INTEGER = "INTEGER";
-
- /** Type name for 8-bit integer */
- static final String TINYINT = "TINYINT";
-
- /** Type name for date */
- static final String DATE = "DATE";
-
- /** Type name for time */
- static final String TIME = "TIME";
-
- /** Type name for timestamp */
- static final String TIMESTAMP = "TIMESTAMP";
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/c7f09d8a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcBufferedParser.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcBufferedParser.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcBufferedParser.java
deleted file mode 100644
index 0d43aec..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcBufferedParser.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.odbc;
-
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.util.nio.GridNioParser;
-import org.apache.ignite.internal.util.nio.GridNioSession;
-import org.apache.ignite.internal.util.nio.GridNioSessionMetaKey;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-/**
- * This class implements stream parser based on {@link OdbcNioServerBuffer}.
- * <p>
- * The rule for this parser is that every message sent over the stream is prepended with
- * 4-byte integer header containing message size. So, the stream structure is as follows:
- * <pre>
- * +--+--+--+--+--+--+...+--+--+--+--+--+--+--+...+--+
- * | MSG_SIZE | MESSAGE | MSG_SIZE | MESSAGE |
- * +--+--+--+--+--+--+...+--+--+--+--+--+--+--+...+--+
- * </pre>
- */
-public class OdbcBufferedParser implements GridNioParser {
- /** Buffer metadata key. */
- private static final int BUF_META_KEY = GridNioSessionMetaKey.nextUniqueKey();
-
- /** {@inheritDoc} */
- @Override public byte[] decode(GridNioSession ses, ByteBuffer buf) throws IOException, IgniteCheckedException {
- OdbcNioServerBuffer nioBuf = ses.meta(BUF_META_KEY);
-
- // Decode for a given session is called per one thread, so there should not be any concurrency issues.
- // However, we make some additional checks.
- if (nioBuf == null) {
- nioBuf = new OdbcNioServerBuffer();
-
- OdbcNioServerBuffer old = ses.addMeta(BUF_META_KEY, nioBuf);
-
- assert old == null;
- }
-
- return nioBuf.read(buf);
- }
-
- /** {@inheritDoc} */
- @Override public ByteBuffer encode(GridNioSession ses, Object msg) throws IOException, IgniteCheckedException {
- byte[] msg0 = (byte[])msg;
-
- ByteBuffer res = ByteBuffer.allocate(msg0.length + 4);
-
- res.order(ByteOrder.LITTLE_ENDIAN);
-
- res.putInt(msg0.length);
- res.put(msg0);
-
- res.flip();
-
- return res;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return OdbcBufferedParser.class.getSimpleName();
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/c7f09d8a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcColumnMeta.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcColumnMeta.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcColumnMeta.java
deleted file mode 100644
index 0edfabc..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcColumnMeta.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.odbc;
-
-import org.apache.ignite.binary.BinaryRawWriter;
-import org.apache.ignite.internal.binary.BinaryUtils;
-import org.apache.ignite.internal.processors.query.GridQueryFieldMetadata;
-
-/**
- * ODBC column-related metadata.
- */
-public class OdbcColumnMeta {
- /** Cache name. */
- private final String schemaName;
-
- /** Table name. */
- private final String tableName;
-
- /** Column name. */
- private final String columnName;
-
- /** Data type. */
- private final Class<?> dataType;
-
- /**
- * @param schemaName Cache name.
- * @param tableName Table name.
- * @param columnName Column name.
- * @param dataType Data type.
- */
- public OdbcColumnMeta(String schemaName, String tableName, String columnName, Class<?> dataType) {
- this.schemaName = OdbcUtils.addQuotationMarksIfNeeded(schemaName);
- this.tableName = tableName;
- this.columnName = columnName;
- this.dataType = dataType;
- }
-
- /**
- * @param info Field metadata.
- */
- public OdbcColumnMeta(GridQueryFieldMetadata info) {
- this.schemaName = OdbcUtils.addQuotationMarksIfNeeded(info.schemaName());
- this.tableName = info.typeName();
- this.columnName = info.fieldName();
-
- Class<?> type;
-
- try {
- type = Class.forName(info.fieldTypeName());
- }
- catch (Exception ignored) {
- type = Object.class;
- }
-
- this.dataType = type;
- }
-
- /** {@inheritDoc} */
- @Override public int hashCode() {
- int hash = schemaName.hashCode();
-
- hash = 31 * hash + tableName.hashCode();
- hash = 31 * hash + columnName.hashCode();
- hash = 31 * hash + dataType.hashCode();
-
- return hash;
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object o) {
- if (o instanceof OdbcColumnMeta) {
- OdbcColumnMeta other = (OdbcColumnMeta) o;
-
- return this == other || schemaName.equals(other.schemaName) && tableName.equals(other.tableName) &&
- columnName.equals(other.columnName) && dataType.equals(other.dataType);
- }
-
- return false;
- }
-
- /**
- * Write in a binary format.
- *
- * @param writer Binary writer.
- */
- public void write(BinaryRawWriter writer) {
- writer.writeString(schemaName);
- writer.writeString(tableName);
- writer.writeString(columnName);
-
- byte typeId = BinaryUtils.typeByClass(dataType);
-
- writer.writeByte(typeId);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/c7f09d8a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcConnectionData.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcConnectionData.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcConnectionData.java
new file mode 100644
index 0000000..28a903d
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcConnectionData.java
@@ -0,0 +1,60 @@
+/*
+ * 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.odbc;
+
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.util.GridSpinBusyLock;
+
+/**
+ * Connection-related data.
+ */
+class OdbcConnectionData {
+ /** Request handler. */
+ private final OdbcRequestHandler handler;
+
+ /** Message parser. */
+ private final OdbcMessageParser parser;
+
+ /**
+ * Constructor.
+ *
+ * @param ctx Context.
+ * @param busyLock Shutdown busy lock.
+ * @param maxCursors Maximum cursors.
+ */
+ public OdbcConnectionData(GridKernalContext ctx, GridSpinBusyLock busyLock, int maxCursors) {
+ handler = new OdbcRequestHandler(ctx, busyLock, maxCursors);
+ parser = new OdbcMessageParser(ctx);
+ }
+
+ /**
+ * Handler getter.
+ * @return Request handler for the connection.
+ */
+ public OdbcRequestHandler getHandler() {
+ return handler;
+ }
+
+ /**
+ * Parser getter
+ * @return Message parser for the connection.
+ */
+ public OdbcMessageParser getParser() {
+ return parser;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/c7f09d8a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcHandshakeRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcHandshakeRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcHandshakeRequest.java
index 55ff21f..7d337b7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcHandshakeRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcHandshakeRequest.java
@@ -22,9 +22,9 @@ import org.apache.ignite.internal.util.typedef.internal.S;
/**
* ODBC handshake request.
*/
-public class OdbcHandshakeRequest extends OdbcRequest {
+public class OdbcHandshakeRequest extends SqlListenerRequest {
/** Protocol version. */
- private final OdbcProtocolVersion ver;
+ private final SqlListenerProtocolVersion ver;
/** Distributed joins flag. */
private boolean distributedJoins = false;
@@ -38,13 +38,13 @@ public class OdbcHandshakeRequest extends OdbcRequest {
public OdbcHandshakeRequest(long ver) {
super(HANDSHAKE);
- this.ver = OdbcProtocolVersion.fromLong(ver);
+ this.ver = SqlListenerProtocolVersion.fromLong(ver);
}
/**
* @return Protocol version.
*/
- public OdbcProtocolVersion version() {
+ public SqlListenerProtocolVersion version() {
return ver;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/c7f09d8a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcMessageParser.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcMessageParser.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcMessageParser.java
index a3d7308..d999501 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcMessageParser.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcMessageParser.java
@@ -63,7 +63,7 @@ public class OdbcMessageParser {
* @param msg Message.
* @return Assembled ODBC request.
*/
- public OdbcRequest decode(byte[] msg) {
+ public SqlListenerRequest decode(byte[] msg) {
assert msg != null;
BinaryInputStream stream = new BinaryHeapInputStream(msg);
@@ -75,15 +75,15 @@ public class OdbcMessageParser {
// This is a special case because we can not decode protocol messages until
// we has not confirmed that the remote client uses the same protocol version.
if (!verConfirmed) {
- if (cmd == OdbcRequest.HANDSHAKE)
+ if (cmd == SqlListenerRequest.HANDSHAKE)
{
long longVersion = reader.readLong();
OdbcHandshakeRequest res = new OdbcHandshakeRequest(longVersion);
- OdbcProtocolVersion version = res.version();
+ SqlListenerProtocolVersion version = res.version();
- if (version == OdbcProtocolVersion.UNKNOWN)
+ if (version == SqlListenerProtocolVersion.UNKNOWN)
return res;
res.distributedJoins(reader.readBoolean());
@@ -96,10 +96,10 @@ public class OdbcMessageParser {
"(first message is not a handshake request): [cmd=" + cmd + ']');
}
- OdbcRequest res;
+ SqlListenerRequest res;
switch (cmd) {
- case OdbcRequest.EXECUTE_SQL_QUERY: {
+ case SqlListenerRequest.QRY_EXEC: {
String cache = reader.readString();
String sql = reader.readString();
int argsNum = reader.readInt();
@@ -109,29 +109,29 @@ public class OdbcMessageParser {
for (int i = 0; i < argsNum; ++i)
params[i] = reader.readObjectDetached();
- res = new OdbcQueryExecuteRequest(cache, sql, params);
+ res = new SqlListenerQueryExecuteRequest(cache, sql, params);
break;
}
- case OdbcRequest.FETCH_SQL_QUERY: {
+ case SqlListenerRequest.QRY_FETCH: {
long queryId = reader.readLong();
int pageSize = reader.readInt();
- res = new OdbcQueryFetchRequest(queryId, pageSize);
+ res = new SqlListenerQueryFetchRequest(queryId, pageSize);
break;
}
- case OdbcRequest.CLOSE_SQL_QUERY: {
+ case SqlListenerRequest.QRY_CLOSE: {
long queryId = reader.readLong();
- res = new OdbcQueryCloseRequest(queryId);
+ res = new SqlListenerQueryCloseRequest(queryId);
break;
}
- case OdbcRequest.GET_COLUMNS_META: {
+ case SqlListenerRequest.META_COLS: {
String cache = reader.readString();
String table = reader.readString();
String column = reader.readString();
@@ -141,7 +141,7 @@ public class OdbcMessageParser {
break;
}
- case OdbcRequest.GET_TABLES_META: {
+ case SqlListenerRequest.META_TBLS: {
String catalog = reader.readString();
String schema = reader.readString();
String table = reader.readString();
@@ -152,7 +152,7 @@ public class OdbcMessageParser {
break;
}
- case OdbcRequest.GET_PARAMS_META: {
+ case SqlListenerRequest.META_PARAMS: {
String cacheName = reader.readString();
String sqlQuery = reader.readString();
@@ -212,25 +212,25 @@ public class OdbcMessageParser {
writer.writeString(res.currentVersion());
}
}
- else if (res0 instanceof OdbcQueryExecuteResult) {
- OdbcQueryExecuteResult res = (OdbcQueryExecuteResult) res0;
+ else if (res0 instanceof SqlListenerQueryExecuteResult) {
+ SqlListenerQueryExecuteResult res = (SqlListenerQueryExecuteResult) res0;
if (log.isDebugEnabled())
log.debug("Resulting query ID: " + res.getQueryId());
writer.writeLong(res.getQueryId());
- Collection<OdbcColumnMeta> metas = res.getColumnsMetadata();
+ Collection<SqlListenerColumnMeta> metas = res.getColumnsMetadata();
assert metas != null;
writer.writeInt(metas.size());
- for (OdbcColumnMeta meta : metas)
+ for (SqlListenerColumnMeta meta : metas)
meta.write(writer);
}
- else if (res0 instanceof OdbcQueryFetchResult) {
- OdbcQueryFetchResult res = (OdbcQueryFetchResult) res0;
+ else if (res0 instanceof SqlListenerQueryFetchResult) {
+ SqlListenerQueryFetchResult res = (SqlListenerQueryFetchResult) res0;
if (log.isDebugEnabled())
log.debug("Resulting query ID: " + res.queryId());
@@ -271,8 +271,8 @@ public class OdbcMessageParser {
}
}
}
- else if (res0 instanceof OdbcQueryCloseResult) {
- OdbcQueryCloseResult res = (OdbcQueryCloseResult) res0;
+ else if (res0 instanceof SqlListenerQueryCloseResult) {
+ SqlListenerQueryCloseResult res = (SqlListenerQueryCloseResult) res0;
if (log.isDebugEnabled())
log.debug("Resulting query ID: " + res.getQueryId());
@@ -282,13 +282,13 @@ public class OdbcMessageParser {
else if (res0 instanceof OdbcQueryGetColumnsMetaResult) {
OdbcQueryGetColumnsMetaResult res = (OdbcQueryGetColumnsMetaResult) res0;
- Collection<OdbcColumnMeta> columnsMeta = res.meta();
+ Collection<SqlListenerColumnMeta> columnsMeta = res.meta();
assert columnsMeta != null;
writer.writeInt(columnsMeta.size());
- for (OdbcColumnMeta columnMeta : columnsMeta)
+ for (SqlListenerColumnMeta columnMeta : columnsMeta)
columnMeta.write(writer);
}
else if (res0 instanceof OdbcQueryGetTablesMetaResult) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/c7f09d8a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcNioListener.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcNioListener.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcNioListener.java
index 378e5f2..b0146e5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcNioListener.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcNioListener.java
@@ -32,7 +32,7 @@ import java.util.concurrent.atomic.AtomicLong;
*/
public class OdbcNioListener extends GridNioServerListenerAdapter<byte[]> {
/** Connection-related metadata key. */
- private static final int CONNECTION_DATA_META_KEY = GridNioSessionMetaKey.nextUniqueKey();
+ private static final int CONN_DATA_META_KEY = GridNioSessionMetaKey.nextUniqueKey();
/** Request ID generator. */
private static final AtomicLong REQ_ID_GEN = new AtomicLong();
@@ -69,7 +69,7 @@ public class OdbcNioListener extends GridNioServerListenerAdapter<byte[]> {
if (log.isDebugEnabled())
log.debug("ODBC client connected: " + ses.remoteAddress());
- ses.addMeta(CONNECTION_DATA_META_KEY, new ConnectionData(ctx, busyLock));
+ ses.addMeta(CONN_DATA_META_KEY, new OdbcConnectionData(ctx, busyLock, maxCursors));
}
/** {@inheritDoc} */
@@ -88,13 +88,13 @@ public class OdbcNioListener extends GridNioServerListenerAdapter<byte[]> {
long reqId = REQ_ID_GEN.incrementAndGet();
- ConnectionData connData = ses.meta(CONNECTION_DATA_META_KEY);
+ OdbcConnectionData connData = ses.meta(CONN_DATA_META_KEY);
assert connData != null;
OdbcMessageParser parser = connData.getParser();
- OdbcRequest req;
+ SqlListenerRequest req;
try {
req = parser.decode(msg);
@@ -140,40 +140,4 @@ public class OdbcNioListener extends GridNioServerListenerAdapter<byte[]> {
ses.send(parser.encode(new OdbcResponse(OdbcResponse.STATUS_FAILED, e.toString())));
}
}
-
- /**
- * Connection-related data.
- */
- private class ConnectionData {
- /** Request handler. */
- private final OdbcRequestHandler handler;
-
- /** Message parser. */
- private final OdbcMessageParser parser;
-
- /**
- * @param ctx Context.
- * @param busyLock Shutdown busy lock.
- */
- public ConnectionData(GridKernalContext ctx, GridSpinBusyLock busyLock) {
- handler = new OdbcRequestHandler(ctx, busyLock, maxCursors);
- parser = new OdbcMessageParser(ctx);
- }
-
- /**
- * Handler getter.
- * @return Request handler for the connection.
- */
- public OdbcRequestHandler getHandler() {
- return handler;
- }
-
- /**
- * Parser getter
- * @return Message parser for the connection.
- */
- public OdbcMessageParser getParser() {
- return parser;
- }
- }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/c7f09d8a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcNioServerBuffer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcNioServerBuffer.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcNioServerBuffer.java
deleted file mode 100644
index d1e6dd9..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcNioServerBuffer.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.odbc;
-
-import org.apache.ignite.IgniteCheckedException;
-import org.jetbrains.annotations.Nullable;
-
-import java.nio.ByteBuffer;
-
-/**
- * NIO server buffer.
- */
-public class OdbcNioServerBuffer {
- /** Current message data. */
- private byte[] data;
-
- /** Count of received bytes of the current message. */
- private int cnt = -4;
-
- /** Current message size. */
- private int msgSize;
-
- /**
- * Reset buffer state.
- */
- public void reset() {
- msgSize = 0;
- cnt = -4;
- data = null;
- }
-
- /**
- * Checks whether the byte array is filled.
- *
- * @return Flag indicating whether byte array is filled or not.
- */
- public boolean isFilled() {
- return cnt > 0 && cnt == msgSize;
- }
-
- /**
- * Get data withing the buffer.
- *
- * @return Data.
- */
- public byte[] data() {
- return data;
- }
-
- /**
- * @param buf Buffer.
- * @return Message bytes or {@code null} if message is not fully read yet.
- * @throws IgniteCheckedException If failed to parse message.
- */
- @Nullable public byte[] read(ByteBuffer buf) throws IgniteCheckedException {
- if (cnt < 0) {
- for (; cnt < 0 && buf.hasRemaining(); cnt++)
- msgSize |= (buf.get() & 0xFF) << (8*(4 + cnt));
-
- if (cnt < 0)
- return null;
-
- // If count is 0 then message size should be inited.
- if (msgSize <= 0)
- throw new IgniteCheckedException("Invalid message size: " + msgSize);
-
- data = new byte[msgSize];
- }
-
- assert msgSize > 0;
- assert cnt >= 0;
-
- int remaining = buf.remaining();
-
- // If there are more bytes in buffer.
- if (remaining > 0) {
- int missing = msgSize - cnt;
-
- // Read only up to message size.
- if (missing > 0) {
- int len = missing < remaining ? missing : remaining;
-
- buf.get(data, cnt, len);
-
- cnt += len;
- }
- }
-
- if (cnt == msgSize) {
- byte[] data0 = data;
-
- reset();
-
- return data0;
- }
- else
- return null;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/c7f09d8a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcProcessor.java
index 054f0dc..6b8b5a3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcProcessor.java
@@ -128,7 +128,7 @@ public class OdbcProcessor extends GridProcessorAdapter {
proceedSessionOpened(ses);
}
},
- new GridNioCodecFilter(new OdbcBufferedParser(), log, false)
+ new GridNioCodecFilter(new SqlListenerBufferedParser(), log, false)
};
GridNioServer<byte[]> srv0 = GridNioServer.<byte[]>builder()
http://git-wip-us.apache.org/repos/asf/ignite/blob/c7f09d8a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcProtocolVersion.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcProtocolVersion.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcProtocolVersion.java
deleted file mode 100644
index 5c156d2..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcProtocolVersion.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.odbc;
-
-/**
- * ODBC protocol version.
- */
-public enum OdbcProtocolVersion {
- /** Version 2.1.0. */
- VER_2_1_0(makeVersion(2, 1, 0), "2.1.0"),
-
- /** Unknown version. */
- UNKNOWN(Long.MIN_VALUE, "UNKNOWN");
-
- /** Mask to get 2 lowest bytes of the value and cast to long. */
- private static final long LONG_MASK = 0x000000000000FFFFL;
-
- /** Long value for version. */
- private final long longVal;
-
- /** Since string. */
- private final String since;
-
- /**
- * Constructor.
- *
- * @param longVal Long value.
- * @param since Since string.
- */
- OdbcProtocolVersion(long longVal, String since) {
- this.longVal = longVal;
- this.since = since;
- }
-
- /**
- * Make long value for the version.
- *
- * @param major Major version.
- * @param minor Minor version.
- * @param maintenance Maintenance version.
- * @return Long value for the version.
- */
- private static long makeVersion(int major, int minor, int maintenance) {
- return ((major & LONG_MASK) << 48) | ((minor & LONG_MASK) << 32) | ((maintenance & LONG_MASK) << 16);
- }
-
- /**
- * @param longVal Long value.
- * @return Protocol version.
- */
- public static OdbcProtocolVersion fromLong(long longVal) {
- for (OdbcProtocolVersion ver : OdbcProtocolVersion.values()) {
- if (ver.longValue() == longVal)
- return ver;
- }
-
- return UNKNOWN;
- }
-
- /**
- * @return Long value.
- */
- public long longValue() {
- return longVal;
- }
-
- /**
- * @return Ignite version when introduced.
- */
- public String since() {
- return since;
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/c7f09d8a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryCloseRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryCloseRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryCloseRequest.java
deleted file mode 100644
index 8c081ef..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryCloseRequest.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.odbc;
-
-import org.apache.ignite.internal.util.typedef.internal.S;
-
-/**
- * ODBC query close request.
- */
-public class OdbcQueryCloseRequest extends OdbcRequest {
- /** Query ID. */
- private final long queryId;
-
- /**
- * @param queryId Query ID.
- */
- public OdbcQueryCloseRequest(long queryId) {
- super(CLOSE_SQL_QUERY);
-
- this.queryId = queryId;
- }
-
- /**
- * @return Query ID.
- */
- public long queryId() {
- return queryId;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(OdbcQueryCloseRequest.class, this);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/c7f09d8a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryCloseResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryCloseResult.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryCloseResult.java
deleted file mode 100644
index 9a85e43..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryCloseResult.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.odbc;
-
-/**
- * ODBC query result.
- */
-public class OdbcQueryCloseResult {
- /** Query ID. */
- private final long queryId;
-
- /**
- * @param queryId Query ID.
- */
- public OdbcQueryCloseResult(long queryId){
- this.queryId = queryId;
- }
-
- /**
- * @return Query ID.
- */
- public long getQueryId() {
- return queryId;
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/c7f09d8a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryExecuteRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryExecuteRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryExecuteRequest.java
deleted file mode 100644
index c0d1c60..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryExecuteRequest.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.odbc;
-
-import org.apache.ignite.internal.util.tostring.GridToStringExclude;
-import org.apache.ignite.internal.util.tostring.GridToStringInclude;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * ODBC query execute request.
- */
-public class OdbcQueryExecuteRequest extends OdbcRequest {
- /** Cache name. */
- private final String cacheName;
-
- /** Sql query. */
- @GridToStringInclude(sensitive = true)
- private final String sqlQry;
-
- /** Sql query arguments. */
- @GridToStringExclude
- private final Object[] args;
-
- /**
- * @param cacheName Cache name.
- * @param sqlQry SQL query.
- * @param args Arguments list.
- */
- public OdbcQueryExecuteRequest(String cacheName, String sqlQry, Object[] args) {
- super(EXECUTE_SQL_QUERY);
-
- this.cacheName = cacheName.isEmpty() ? null : cacheName;
- this.sqlQry = sqlQry;
- this.args = args;
- }
-
- /**
- * @return Sql query.
- */
- public String sqlQuery() {
- return sqlQry;
- }
-
- /**
- * @return Sql query arguments.
- */
- public Object[] arguments() {
- return args;
- }
-
- /**
- * @return Cache name.
- */
- @Nullable public String cacheName() {
- return cacheName;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(OdbcQueryExecuteRequest.class, this, "args", args, true);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/c7f09d8a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryExecuteResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryExecuteResult.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryExecuteResult.java
deleted file mode 100644
index a403812..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryExecuteResult.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.odbc;
-
-import java.util.Collection;
-
-/**
- * Query execute result.
- */
-public class OdbcQueryExecuteResult {
- /** Query ID. */
- private final long queryId;
-
- /** Fields metadata. */
- private final Collection<OdbcColumnMeta> columnsMeta;
-
- /**
- * @param queryId Query ID.
- * @param columnsMeta Columns metadata.
- */
- public OdbcQueryExecuteResult(long queryId, Collection<OdbcColumnMeta> columnsMeta) {
- this.queryId = queryId;
- this.columnsMeta = columnsMeta;
- }
-
- /**
- * @return Query ID.
- */
- public long getQueryId() {
- return queryId;
- }
-
- /**
- * @return Columns metadata.
- */
- public Collection<OdbcColumnMeta> getColumnsMetadata() {
- return columnsMeta;
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/c7f09d8a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryFetchRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryFetchRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryFetchRequest.java
deleted file mode 100644
index 58bc43a..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryFetchRequest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.odbc;
-
-import org.apache.ignite.internal.util.typedef.internal.S;
-
-/**
- * ODBC query fetch request.
- */
-public class OdbcQueryFetchRequest extends OdbcRequest {
- /** Query ID. */
- private final long queryId;
-
- /** Page size - maximum number of rows to return. */
- private final int pageSize;
-
- /**
- * @param queryId Query ID.
- * @param pageSize Page size.
- */
- public OdbcQueryFetchRequest(long queryId, int pageSize) {
- super(FETCH_SQL_QUERY);
-
- this.queryId = queryId;
- this.pageSize = pageSize;
- }
-
- /**
- * @return Page size.
- */
- public int pageSize() {
- return pageSize;
- }
-
- /**
- * @return Query ID.
- */
- public long queryId() {
- return queryId;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(OdbcQueryFetchRequest.class, this);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/c7f09d8a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryFetchResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryFetchResult.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryFetchResult.java
deleted file mode 100644
index f72d7e1..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryFetchResult.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.odbc;
-
-import java.util.Collection;
-
-/**
- * Query fetch result.
- */
-public class OdbcQueryFetchResult {
- /** Query ID. */
- private final long queryId;
-
- /** Query result rows. */
- private final Collection<?> items;
-
- /** Flag indicating the query has no unfetched results. */
- private final boolean last;
-
- /**
- * @param queryId Query ID.
- * @param items Query result rows.
- * @param last Flag indicating the query has no unfetched results.
- */
- public OdbcQueryFetchResult(long queryId, Collection<?> items, boolean last){
- this.queryId = queryId;
- this.items = items;
- this.last = last;
- }
-
- /**
- * @return Query ID.
- */
- public long queryId() {
- return queryId;
- }
-
- /**
- * @return Query result rows.
- */
- public Collection<?> items() {
- return items;
- }
-
- /**
- * @return Flag indicating the query has no unfetched results.
- */
- public boolean last() {
- return last;
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/c7f09d8a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryGetColumnsMetaRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryGetColumnsMetaRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryGetColumnsMetaRequest.java
index 875be89..bdfaa1d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryGetColumnsMetaRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryGetColumnsMetaRequest.java
@@ -23,7 +23,7 @@ import org.jetbrains.annotations.Nullable;
/**
* ODBC query get columns meta request.
*/
-public class OdbcQueryGetColumnsMetaRequest extends OdbcRequest {
+public class OdbcQueryGetColumnsMetaRequest extends SqlListenerRequest {
/** Cache name. */
private final String cacheName;
@@ -39,7 +39,7 @@ public class OdbcQueryGetColumnsMetaRequest extends OdbcRequest {
* @param columnName Column name.
*/
public OdbcQueryGetColumnsMetaRequest(String cacheName, String tableName, String columnName) {
- super(GET_COLUMNS_META);
+ super(META_COLS);
this.cacheName = cacheName;
this.tableName = tableName;
http://git-wip-us.apache.org/repos/asf/ignite/blob/c7f09d8a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryGetColumnsMetaResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryGetColumnsMetaResult.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryGetColumnsMetaResult.java
index 256b15b..28daa56 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryGetColumnsMetaResult.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryGetColumnsMetaResult.java
@@ -24,19 +24,19 @@ import java.util.Collection;
*/
public class OdbcQueryGetColumnsMetaResult {
/** Query result rows. */
- private final Collection<OdbcColumnMeta> meta;
+ private final Collection<SqlListenerColumnMeta> meta;
/**
* @param meta Column metadata.
*/
- public OdbcQueryGetColumnsMetaResult(Collection<OdbcColumnMeta> meta) {
+ public OdbcQueryGetColumnsMetaResult(Collection<SqlListenerColumnMeta> meta) {
this.meta = meta;
}
/**
* @return Query result rows.
*/
- public Collection<OdbcColumnMeta> meta() {
+ public Collection<SqlListenerColumnMeta> meta() {
return meta;
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/c7f09d8a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryGetParamsMetaRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryGetParamsMetaRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryGetParamsMetaRequest.java
index c372c0b..e6a97e3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryGetParamsMetaRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryGetParamsMetaRequest.java
@@ -22,7 +22,7 @@ import org.apache.ignite.internal.util.typedef.internal.S;
/**
* ODBC query get params meta request.
*/
-public class OdbcQueryGetParamsMetaRequest extends OdbcRequest {
+public class OdbcQueryGetParamsMetaRequest extends SqlListenerRequest {
/** Cache. */
private final String cacheName;
@@ -33,7 +33,7 @@ public class OdbcQueryGetParamsMetaRequest extends OdbcRequest {
* @param query SQL Query.
*/
public OdbcQueryGetParamsMetaRequest(String cacheName, String query) {
- super(GET_PARAMS_META);
+ super(META_PARAMS);
this.cacheName = cacheName;
this.query = query;
http://git-wip-us.apache.org/repos/asf/ignite/blob/c7f09d8a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryGetTablesMetaRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryGetTablesMetaRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryGetTablesMetaRequest.java
index a56aad2..772c487 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryGetTablesMetaRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryGetTablesMetaRequest.java
@@ -22,7 +22,7 @@ import org.apache.ignite.internal.util.typedef.internal.S;
/**
* ODBC query get tables meta request.
*/
-public class OdbcQueryGetTablesMetaRequest extends OdbcRequest {
+public class OdbcQueryGetTablesMetaRequest extends SqlListenerRequest {
/** Catalog search pattern. */
private final String catalog;
@@ -42,7 +42,7 @@ public class OdbcQueryGetTablesMetaRequest extends OdbcRequest {
* @param tableType Table type search pattern.
*/
public OdbcQueryGetTablesMetaRequest(String catalog, String schema, String table, String tableType) {
- super(GET_TABLES_META);
+ super(META_TBLS);
this.catalog = catalog;
this.schema = schema;
http://git-wip-us.apache.org/repos/asf/ignite/blob/c7f09d8a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcRequest.java
deleted file mode 100644
index f056fed..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcRequest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.odbc;
-
-/**
- * ODBC command request.
- */
-public class OdbcRequest {
- /** Handshake request. */
- public static final int HANDSHAKE = 1;
-
- /** Execute sql query. */
- public static final int EXECUTE_SQL_QUERY = 2;
-
- /** Fetch query results. */
- public static final int FETCH_SQL_QUERY = 3;
-
- /** Close query. */
- public static final int CLOSE_SQL_QUERY = 4;
-
- /** Get columns meta query. */
- public static final int GET_COLUMNS_META = 5;
-
- /** Get columns meta query. */
- public static final int GET_TABLES_META = 6;
-
- /** Get parameters meta. */
- public static final int GET_PARAMS_META = 7;
-
- /** Command. */
- private final int cmd;
-
- /**
- * @param cmd Command type.
- */
- public OdbcRequest(int cmd) {
- this.cmd = cmd;
- }
-
- /**
- * @return Command.
- */
- public int command() {
- return cmd;
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/c7f09d8a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcRequestHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcRequestHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcRequestHandler.java
index c17dd63..d98c366 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcRequestHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcRequestHandler.java
@@ -40,7 +40,7 @@ import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicLong;
-import static org.apache.ignite.internal.processors.odbc.OdbcRequest.*;
+import static org.apache.ignite.internal.processors.odbc.SqlListenerRequest.*;
/**
* SQL query handler.
@@ -92,7 +92,7 @@ public class OdbcRequestHandler {
* @param req Request.
* @return Response.
*/
- public OdbcResponse handle(long reqId, OdbcRequest req) {
+ public OdbcResponse handle(long reqId, SqlListenerRequest req) {
assert req != null;
if (!busyLock.enterBusy())
@@ -104,22 +104,22 @@ public class OdbcRequestHandler {
case HANDSHAKE:
return performHandshake(reqId, (OdbcHandshakeRequest)req);
- case EXECUTE_SQL_QUERY:
- return executeQuery(reqId, (OdbcQueryExecuteRequest)req);
+ case QRY_EXEC:
+ return executeQuery(reqId, (SqlListenerQueryExecuteRequest)req);
- case FETCH_SQL_QUERY:
- return fetchQuery(reqId, (OdbcQueryFetchRequest)req);
+ case QRY_FETCH:
+ return fetchQuery(reqId, (SqlListenerQueryFetchRequest)req);
- case CLOSE_SQL_QUERY:
- return closeQuery(reqId, (OdbcQueryCloseRequest)req);
+ case QRY_CLOSE:
+ return closeQuery(reqId, (SqlListenerQueryCloseRequest)req);
- case GET_COLUMNS_META:
+ case META_COLS:
return getColumnsMeta(reqId, (OdbcQueryGetColumnsMetaRequest)req);
- case GET_TABLES_META:
+ case META_TBLS:
return getTablesMeta(reqId, (OdbcQueryGetTablesMetaRequest)req);
- case GET_PARAMS_META:
+ case META_PARAMS:
return getParamsMeta(reqId, (OdbcQueryGetParamsMetaRequest)req);
}
@@ -139,9 +139,9 @@ public class OdbcRequestHandler {
*/
private OdbcResponse performHandshake(long reqId, OdbcHandshakeRequest req) {
try {
- OdbcProtocolVersion version = req.version();
+ SqlListenerProtocolVersion version = req.version();
- if (version == OdbcProtocolVersion.UNKNOWN) {
+ if (version == SqlListenerProtocolVersion.UNKNOWN) {
IgniteProductVersion ver = ctx.grid().version();
String verStr = Byte.toString(ver.major()) + '.' + ver.minor() + '.' + ver.maintenance();
@@ -166,13 +166,13 @@ public class OdbcRequestHandler {
}
/**
- * {@link OdbcQueryExecuteRequest} command handler.
+ * {@link SqlListenerQueryExecuteRequest} command handler.
*
* @param reqId Request ID.
* @param req Execute query request.
* @return Response.
*/
- private OdbcResponse executeQuery(long reqId, OdbcQueryExecuteRequest req) {
+ private OdbcResponse executeQuery(long reqId, SqlListenerQueryExecuteRequest req) {
int cursorCnt = qryCursors.size();
if (maxCursors > 0 && cursorCnt >= maxCursors)
@@ -214,7 +214,7 @@ public class OdbcRequestHandler {
List<?> fieldsMeta = ((QueryCursorImpl) qryCur).fieldsMeta();
- OdbcQueryExecuteResult res = new OdbcQueryExecuteResult(qryId, convertMetadata(fieldsMeta));
+ SqlListenerQueryExecuteResult res = new SqlListenerQueryExecuteResult(qryId, convertMetadata(fieldsMeta));
return new OdbcResponse(res);
}
@@ -228,13 +228,13 @@ public class OdbcRequestHandler {
}
/**
- * {@link OdbcQueryCloseRequest} command handler.
+ * {@link SqlListenerQueryCloseRequest} command handler.
*
* @param reqId Request ID.
* @param req Execute query request.
* @return Response.
*/
- private OdbcResponse closeQuery(long reqId, OdbcQueryCloseRequest req) {
+ private OdbcResponse closeQuery(long reqId, SqlListenerQueryCloseRequest req) {
try {
IgniteBiTuple<QueryCursor, Iterator> tuple = qryCursors.get(req.queryId());
@@ -249,7 +249,7 @@ public class OdbcRequestHandler {
qryCursors.remove(req.queryId());
- OdbcQueryCloseResult res = new OdbcQueryCloseResult(req.queryId());
+ SqlListenerQueryCloseResult res = new SqlListenerQueryCloseResult(req.queryId());
return new OdbcResponse(res);
}
@@ -263,13 +263,13 @@ public class OdbcRequestHandler {
}
/**
- * {@link OdbcQueryFetchRequest} command handler.
+ * {@link SqlListenerQueryFetchRequest} command handler.
*
* @param reqId Request ID.
* @param req Execute query request.
* @return Response.
*/
- private OdbcResponse fetchQuery(long reqId, OdbcQueryFetchRequest req) {
+ private OdbcResponse fetchQuery(long reqId, SqlListenerQueryFetchRequest req) {
try {
IgniteBiTuple<QueryCursor, Iterator> tuple = qryCursors.get(req.queryId());
@@ -291,7 +291,7 @@ public class OdbcRequestHandler {
for (int i = 0; i < req.pageSize() && iter.hasNext(); ++i)
items.add(iter.next());
- OdbcQueryFetchResult res = new OdbcQueryFetchResult(req.queryId(), items, !iter.hasNext());
+ SqlListenerQueryFetchResult res = new SqlListenerQueryFetchResult(req.queryId(), items, !iter.hasNext());
return new OdbcResponse(res);
}
@@ -311,7 +311,7 @@ public class OdbcRequestHandler {
*/
private OdbcResponse getColumnsMeta(long reqId, OdbcQueryGetColumnsMetaRequest req) {
try {
- List<OdbcColumnMeta> meta = new ArrayList<>();
+ List<SqlListenerColumnMeta> meta = new ArrayList<>();
String cacheName;
String tableName;
@@ -340,7 +340,7 @@ public class OdbcRequestHandler {
if (!matches(field.getKey(), req.columnName()))
continue;
- OdbcColumnMeta columnMeta = new OdbcColumnMeta(req.cacheName(), table.name(),
+ SqlListenerColumnMeta columnMeta = new SqlListenerColumnMeta(req.cacheName(), table.name(),
field.getKey(), field.getValue());
if (!meta.contains(columnMeta))
@@ -497,19 +497,19 @@ public class OdbcRequestHandler {
/**
* Convert metadata in collection from {@link GridQueryFieldMetadata} to
- * {@link OdbcColumnMeta}.
+ * {@link SqlListenerColumnMeta}.
*
* @param meta Internal query field metadata.
* @return Odbc query field metadata.
*/
- private static Collection<OdbcColumnMeta> convertMetadata(Collection<?> meta) {
- List<OdbcColumnMeta> res = new ArrayList<>();
+ private static Collection<SqlListenerColumnMeta> convertMetadata(Collection<?> meta) {
+ List<SqlListenerColumnMeta> res = new ArrayList<>();
if (meta != null) {
for (Object info : meta) {
assert info instanceof GridQueryFieldMetadata;
- res.add(new OdbcColumnMeta((GridQueryFieldMetadata)info));
+ res.add(new SqlListenerColumnMeta((GridQueryFieldMetadata)info));
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/c7f09d8a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcUtils.java
index 668ce6a..8bf1959 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcUtils.java
@@ -24,7 +24,7 @@ import org.apache.ignite.IgniteException;
*/
public class OdbcUtils {
/** Latest version. */
- public static final OdbcProtocolVersion VER_LATEST = OdbcProtocolVersion.VER_2_1_0;
+ public static final SqlListenerProtocolVersion VER_LATEST = SqlListenerProtocolVersion.VER_2_1_0;
/**
* Add quotation marks at the beginning and end of the string.
@@ -69,57 +69,57 @@ public class OdbcUtils {
assert odbcDataType != null;
switch (odbcDataType.toUpperCase()) {
case OdbcTypes.SQL_BIGINT:
- return IgniteTypes.BIGINT;
+ return SqlListenerDataTypes.BIGINT;
case OdbcTypes.SQL_BINARY:
case OdbcTypes.SQL_LONGVARBINARY:
case OdbcTypes.SQL_VARBINARY:
- return IgniteTypes.BINARY;
+ return SqlListenerDataTypes.BINARY;
case OdbcTypes.SQL_BIT:
- return IgniteTypes.BIT;
+ return SqlListenerDataTypes.BIT;
case OdbcTypes.SQL_CHAR:
- return IgniteTypes.CHAR;
+ return SqlListenerDataTypes.CHAR;
case OdbcTypes.SQL_DECIMAL:
case OdbcTypes.SQL_NUMERIC:
- return IgniteTypes.DECIMAL;
+ return SqlListenerDataTypes.DECIMAL;
case OdbcTypes.SQL_LONGVARCHAR:
case OdbcTypes.SQL_VARCHAR:
case OdbcTypes.SQL_WCHAR:
case OdbcTypes.SQL_WLONGVARCHAR:
case OdbcTypes.SQL_WVARCHAR:
- return IgniteTypes.VARCHAR;
+ return SqlListenerDataTypes.VARCHAR;
case OdbcTypes.SQL_DOUBLE:
case OdbcTypes.SQL_FLOAT:
- return IgniteTypes.DOUBLE;
+ return SqlListenerDataTypes.DOUBLE;
case OdbcTypes.SQL_REAL:
- return IgniteTypes.REAL;
+ return SqlListenerDataTypes.REAL;
case OdbcTypes.SQL_GUID:
- return IgniteTypes.UUID;
+ return SqlListenerDataTypes.UUID;
case OdbcTypes.SQL_SMALLINT:
- return IgniteTypes.SMALLINT;
+ return SqlListenerDataTypes.SMALLINT;
case OdbcTypes.SQL_INTEGER:
- return IgniteTypes.INTEGER;
+ return SqlListenerDataTypes.INTEGER;
case OdbcTypes.SQL_DATE:
- return IgniteTypes.DATE;
+ return SqlListenerDataTypes.DATE;
case OdbcTypes.SQL_TIME:
- return IgniteTypes.TIME;
+ return SqlListenerDataTypes.TIME;
case OdbcTypes.SQL_TIMESTAMP:
- return IgniteTypes.TIMESTAMP;
+ return SqlListenerDataTypes.TIMESTAMP;
case OdbcTypes.SQL_TINYINT:
- return IgniteTypes.TINYINT;
+ return SqlListenerDataTypes.TINYINT;
//No support for interval types
case OdbcTypes.SQL_INTERVAL_SECOND:
http://git-wip-us.apache.org/repos/asf/ignite/blob/c7f09d8a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerBufferedParser.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerBufferedParser.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerBufferedParser.java
new file mode 100644
index 0000000..a8e124f
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerBufferedParser.java
@@ -0,0 +1,81 @@
+/*
+ * 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.odbc;
+
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.util.nio.GridNioParser;
+import org.apache.ignite.internal.util.nio.GridNioSession;
+import org.apache.ignite.internal.util.nio.GridNioSessionMetaKey;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+/**
+ * This class implements stream parser based on {@link SqlListenerNioServerBuffer}.
+ * <p>
+ * The rule for this parser is that every message sent over the stream is prepended with
+ * 4-byte integer header containing message size. So, the stream structure is as follows:
+ * <pre>
+ * +--+--+--+--+--+--+...+--+--+--+--+--+--+--+...+--+
+ * | MSG_SIZE | MESSAGE | MSG_SIZE | MESSAGE |
+ * +--+--+--+--+--+--+...+--+--+--+--+--+--+--+...+--+
+ * </pre>
+ */
+public class SqlListenerBufferedParser implements GridNioParser {
+ /** Buffer metadata key. */
+ private static final int BUF_META_KEY = GridNioSessionMetaKey.nextUniqueKey();
+
+ /** {@inheritDoc} */
+ @Override public byte[] decode(GridNioSession ses, ByteBuffer buf) throws IOException, IgniteCheckedException {
+ SqlListenerNioServerBuffer nioBuf = ses.meta(BUF_META_KEY);
+
+ // Decode for a given session is called per one thread, so there should not be any concurrency issues.
+ // However, we make some additional checks.
+ if (nioBuf == null) {
+ nioBuf = new SqlListenerNioServerBuffer();
+
+ SqlListenerNioServerBuffer old = ses.addMeta(BUF_META_KEY, nioBuf);
+
+ assert old == null;
+ }
+
+ return nioBuf.read(buf);
+ }
+
+ /** {@inheritDoc} */
+ @Override public ByteBuffer encode(GridNioSession ses, Object msg) throws IOException, IgniteCheckedException {
+ byte[] msg0 = (byte[])msg;
+
+ ByteBuffer res = ByteBuffer.allocate(msg0.length + 4);
+
+ res.order(ByteOrder.LITTLE_ENDIAN);
+
+ res.putInt(msg0.length);
+ res.put(msg0);
+
+ res.flip();
+
+ return res;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return SqlListenerBufferedParser.class.getSimpleName();
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/c7f09d8a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerColumnMeta.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerColumnMeta.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerColumnMeta.java
new file mode 100644
index 0000000..73133a1
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerColumnMeta.java
@@ -0,0 +1,110 @@
+/*
+ * 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.odbc;
+
+import org.apache.ignite.binary.BinaryRawWriter;
+import org.apache.ignite.internal.binary.BinaryUtils;
+import org.apache.ignite.internal.processors.query.GridQueryFieldMetadata;
+
+/**
+ * SQL listener column metadata.
+ */
+public class SqlListenerColumnMeta {
+ /** Cache name. */
+ private final String schemaName;
+
+ /** Table name. */
+ private final String tableName;
+
+ /** Column name. */
+ private final String columnName;
+
+ /** Data type. */
+ private final Class<?> dataType;
+
+ /**
+ * @param schemaName Cache name.
+ * @param tableName Table name.
+ * @param columnName Column name.
+ * @param dataType Data type.
+ */
+ public SqlListenerColumnMeta(String schemaName, String tableName, String columnName, Class<?> dataType) {
+ this.schemaName = OdbcUtils.addQuotationMarksIfNeeded(schemaName);
+ this.tableName = tableName;
+ this.columnName = columnName;
+ this.dataType = dataType;
+ }
+
+ /**
+ * @param info Field metadata.
+ */
+ public SqlListenerColumnMeta(GridQueryFieldMetadata info) {
+ this.schemaName = OdbcUtils.addQuotationMarksIfNeeded(info.schemaName());
+ this.tableName = info.typeName();
+ this.columnName = info.fieldName();
+
+ Class<?> type;
+
+ try {
+ type = Class.forName(info.fieldTypeName());
+ }
+ catch (Exception ignored) {
+ type = Object.class;
+ }
+
+ this.dataType = type;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ int hash = schemaName.hashCode();
+
+ hash = 31 * hash + tableName.hashCode();
+ hash = 31 * hash + columnName.hashCode();
+ hash = 31 * hash + dataType.hashCode();
+
+ return hash;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ if (o instanceof SqlListenerColumnMeta) {
+ SqlListenerColumnMeta other = (SqlListenerColumnMeta) o;
+
+ return this == other || schemaName.equals(other.schemaName) && tableName.equals(other.tableName) &&
+ columnName.equals(other.columnName) && dataType.equals(other.dataType);
+ }
+
+ return false;
+ }
+
+ /**
+ * Write in a binary format.
+ *
+ * @param writer Binary writer.
+ */
+ public void write(BinaryRawWriter writer) {
+ writer.writeString(schemaName);
+ writer.writeString(tableName);
+ writer.writeString(columnName);
+
+ byte typeId = BinaryUtils.typeByClass(dataType);
+
+ writer.writeByte(typeId);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/c7f09d8a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerDataTypes.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerDataTypes.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerDataTypes.java
new file mode 100644
index 0000000..0f0bfdd
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerDataTypes.java
@@ -0,0 +1,69 @@
+/*
+ * 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.odbc;
+
+/**
+ * Data type names usable in SQL queries
+ * after escape sequence transformation
+ */
+public class SqlListenerDataTypes {
+ /** Type name for 64-bit integer */
+ static final String BIGINT = "BIGINT";
+
+ /** Type name for byte array */
+ static final String BINARY = "BINARY";
+
+ /** Type name for boolean flag */
+ static final String BIT = "BIT";
+
+ /** Type name for unicode string */
+ static final String CHAR = "CHAR";
+
+ /** Type name for decimal number */
+ static final String DECIMAL = "DECIMAL";
+
+ /** Type name for unicode string */
+ static final String VARCHAR = "VARCHAR";
+
+ /** Type name for floating point number */
+ static final String DOUBLE = "DOUBLE";
+
+ /** Type name for single precision floating point number */
+ static final String REAL = "REAL";
+
+ /** Type name for universally unique identifier */
+ static final String UUID = "UUID";
+
+ /** Type name for 16-bit integer */
+ static final String SMALLINT = "SMALLINT";
+
+ /** Type name for 32-bit integer */
+ static final String INTEGER = "INTEGER";
+
+ /** Type name for 8-bit integer */
+ static final String TINYINT = "TINYINT";
+
+ /** Type name for date */
+ static final String DATE = "DATE";
+
+ /** Type name for time */
+ static final String TIME = "TIME";
+
+ /** Type name for timestamp */
+ static final String TIMESTAMP = "TIMESTAMP";
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/c7f09d8a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioServerBuffer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioServerBuffer.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioServerBuffer.java
new file mode 100644
index 0000000..cf8a0ad
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioServerBuffer.java
@@ -0,0 +1,114 @@
+/*
+ * 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.odbc;
+
+import org.apache.ignite.IgniteCheckedException;
+import org.jetbrains.annotations.Nullable;
+
+import java.nio.ByteBuffer;
+
+/**
+ * NIO server buffer.
+ */
+public class SqlListenerNioServerBuffer {
+ /** Current message data. */
+ private byte[] data;
+
+ /** Count of received bytes of the current message. */
+ private int cnt = -4;
+
+ /** Current message size. */
+ private int msgSize;
+
+ /**
+ * Reset buffer state.
+ */
+ public void reset() {
+ msgSize = 0;
+ cnt = -4;
+ data = null;
+ }
+
+ /**
+ * Checks whether the byte array is filled.
+ *
+ * @return Flag indicating whether byte array is filled or not.
+ */
+ public boolean isFilled() {
+ return cnt > 0 && cnt == msgSize;
+ }
+
+ /**
+ * Get data withing the buffer.
+ *
+ * @return Data.
+ */
+ public byte[] data() {
+ return data;
+ }
+
+ /**
+ * @param buf Buffer.
+ * @return Message bytes or {@code null} if message is not fully read yet.
+ * @throws IgniteCheckedException If failed to parse message.
+ */
+ @Nullable public byte[] read(ByteBuffer buf) throws IgniteCheckedException {
+ if (cnt < 0) {
+ for (; cnt < 0 && buf.hasRemaining(); cnt++)
+ msgSize |= (buf.get() & 0xFF) << (8*(4 + cnt));
+
+ if (cnt < 0)
+ return null;
+
+ // If count is 0 then message size should be inited.
+ if (msgSize <= 0)
+ throw new IgniteCheckedException("Invalid message size: " + msgSize);
+
+ data = new byte[msgSize];
+ }
+
+ assert msgSize > 0;
+ assert cnt >= 0;
+
+ int remaining = buf.remaining();
+
+ // If there are more bytes in buffer.
+ if (remaining > 0) {
+ int missing = msgSize - cnt;
+
+ // Read only up to message size.
+ if (missing > 0) {
+ int len = missing < remaining ? missing : remaining;
+
+ buf.get(data, cnt, len);
+
+ cnt += len;
+ }
+ }
+
+ if (cnt == msgSize) {
+ byte[] data0 = data;
+
+ reset();
+
+ return data0;
+ }
+ else
+ return null;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/c7f09d8a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerProtocolVersion.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerProtocolVersion.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerProtocolVersion.java
new file mode 100644
index 0000000..372188c
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerProtocolVersion.java
@@ -0,0 +1,88 @@
+/*
+ * 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.odbc;
+
+/**
+ * SQL listener protocol version.
+ */
+public enum SqlListenerProtocolVersion {
+ /** Version 2.1.0. */
+ VER_2_1_0(makeVersion(2, 1, 0), "2.1.0"),
+
+ /** Unknown version. */
+ UNKNOWN(Long.MIN_VALUE, "UNKNOWN");
+
+ /** Mask to get 2 lowest bytes of the value and cast to long. */
+ private static final long LONG_MASK = 0x000000000000FFFFL;
+
+ /** Long value for version. */
+ private final long longVal;
+
+ /** Since string. */
+ private final String since;
+
+ /**
+ * Constructor.
+ *
+ * @param longVal Long value.
+ * @param since Since string.
+ */
+ SqlListenerProtocolVersion(long longVal, String since) {
+ this.longVal = longVal;
+ this.since = since;
+ }
+
+ /**
+ * Make long value for the version.
+ *
+ * @param major Major version.
+ * @param minor Minor version.
+ * @param maintenance Maintenance version.
+ * @return Long value for the version.
+ */
+ private static long makeVersion(int major, int minor, int maintenance) {
+ return ((major & LONG_MASK) << 48) | ((minor & LONG_MASK) << 32) | ((maintenance & LONG_MASK) << 16);
+ }
+
+ /**
+ * @param longVal Long value.
+ * @return Protocol version.
+ */
+ public static SqlListenerProtocolVersion fromLong(long longVal) {
+ for (SqlListenerProtocolVersion ver : SqlListenerProtocolVersion.values()) {
+ if (ver.longValue() == longVal)
+ return ver;
+ }
+
+ return UNKNOWN;
+ }
+
+ /**
+ * @return Long value.
+ */
+ public long longValue() {
+ return longVal;
+ }
+
+ /**
+ * @return Ignite version when introduced.
+ */
+ public String since() {
+ return since;
+ }
+}
[17/50] [abbrv] ignite git commit: IGNITE-5081 - Removed redundant
duplication of permissions in SecurityPermissionSetBuilder
Posted by sb...@apache.org.
IGNITE-5081 - Removed redundant duplication of permissions in SecurityPermissionSetBuilder
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/56ec9951
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/56ec9951
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/56ec9951
Branch: refs/heads/ignite-5009
Commit: 56ec995199d12c3b257e77cb49296dc747bc7a93
Parents: 2f7172c
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Fri Apr 28 14:48:57 2017 +0200
Committer: Valentin Kulichenko <va...@ing.be>
Committed: Tue May 2 12:59:53 2017 +0200
----------------------------------------------------------------------
.../security/SecurityPermissionSetBuilder.java | 17 +++---
.../SecurityPermissionSetBuilderTest.java | 63 ++++++++++++--------
2 files changed, 46 insertions(+), 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/56ec9951/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityPermissionSetBuilder.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityPermissionSetBuilder.java b/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityPermissionSetBuilder.java
index cf38c0f..abac541 100644
--- a/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityPermissionSetBuilder.java
+++ b/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityPermissionSetBuilder.java
@@ -17,16 +17,17 @@
package org.apache.ignite.plugin.security;
-import java.util.Map;
-import java.util.List;
-import java.util.HashMap;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
import org.apache.ignite.IgniteException;
+import org.apache.ignite.internal.util.typedef.internal.U;
-import static java.util.Collections.unmodifiableList;
import static java.util.Collections.unmodifiableMap;
+import static java.util.Collections.unmodifiableSet;
/**
* Provides a convenient way to create a permission set.
@@ -61,7 +62,7 @@ public class SecurityPermissionSetBuilder {
private Map<String, Collection<SecurityPermission>> srvcPerms = new HashMap<>();
/** System permissions.*/
- private List<SecurityPermission> sysPerms = new ArrayList<>();
+ private Set<SecurityPermission> sysPerms = new HashSet<>();
/** Default allow all.*/
private boolean dfltAllowAll;
@@ -193,7 +194,7 @@ public class SecurityPermissionSetBuilder {
private final <T> Collection<T> toCollection(T... perms) {
assert perms != null;
- Collection<T> col = new ArrayList<>(perms.length);
+ Collection<T> col = U.newHashSet(perms.length);
Collections.addAll(col, perms);
@@ -234,7 +235,7 @@ public class SecurityPermissionSetBuilder {
permSet.setCachePermissions(unmodifiableMap(cachePerms));
permSet.setTaskPermissions(unmodifiableMap(taskPerms));
permSet.setServicePermissions(unmodifiableMap(srvcPerms));
- permSet.setSystemPermissions(unmodifiableList(sysPerms));
+ permSet.setSystemPermissions(unmodifiableSet(sysPerms));
return permSet;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/56ec9951/modules/core/src/test/java/org/apache/ignite/plugin/security/SecurityPermissionSetBuilderTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/plugin/security/SecurityPermissionSetBuilderTest.java b/modules/core/src/test/java/org/apache/ignite/plugin/security/SecurityPermissionSetBuilderTest.java
index 5443cfd..0ac7bc7 100644
--- a/modules/core/src/test/java/org/apache/ignite/plugin/security/SecurityPermissionSetBuilderTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/plugin/security/SecurityPermissionSetBuilderTest.java
@@ -17,23 +17,24 @@
package org.apache.ignite.plugin.security;
-import java.util.Map;
-import java.util.Arrays;
-import java.util.HashMap;
import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
import java.util.concurrent.Callable;
import org.apache.ignite.IgniteException;
+import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import static org.apache.ignite.plugin.security.SecurityPermission.ADMIN_VIEW;
import static org.apache.ignite.plugin.security.SecurityPermission.CACHE_PUT;
import static org.apache.ignite.plugin.security.SecurityPermission.CACHE_READ;
import static org.apache.ignite.plugin.security.SecurityPermission.CACHE_REMOVE;
import static org.apache.ignite.plugin.security.SecurityPermission.SERVICE_DEPLOY;
import static org.apache.ignite.plugin.security.SecurityPermission.SERVICE_INVOKE;
+import static org.apache.ignite.plugin.security.SecurityPermission.EVENTS_ENABLE;
import static org.apache.ignite.plugin.security.SecurityPermission.TASK_CANCEL;
import static org.apache.ignite.plugin.security.SecurityPermission.TASK_EXECUTE;
-import static org.apache.ignite.plugin.security.SecurityPermission.EVENTS_ENABLE;
-import static org.apache.ignite.plugin.security.SecurityPermission.ADMIN_VIEW;
import static org.apache.ignite.testframework.GridTestUtils.assertThrows;
/**
@@ -41,31 +42,30 @@ import static org.apache.ignite.testframework.GridTestUtils.assertThrows;
*/
public class SecurityPermissionSetBuilderTest extends GridCommonAbstractTest {
/**
- *
*/
@SuppressWarnings({"ThrowableNotThrown", "ArraysAsListWithZeroOrOneArgument"})
public void testPermissionBuilder() {
SecurityBasicPermissionSet exp = new SecurityBasicPermissionSet();
Map<String, Collection<SecurityPermission>> permCache = new HashMap<>();
- permCache.put("cache1", Arrays.asList(CACHE_PUT, CACHE_REMOVE));
- permCache.put("cache2", Arrays.asList(CACHE_READ));
+ permCache.put("cache1", permissions(CACHE_PUT, CACHE_REMOVE));
+ permCache.put("cache2", permissions(CACHE_READ));
exp.setCachePermissions(permCache);
Map<String, Collection<SecurityPermission>> permTask = new HashMap<>();
- permTask.put("task1", Arrays.asList(TASK_CANCEL));
- permTask.put("task2", Arrays.asList(TASK_EXECUTE));
+ permTask.put("task1", permissions(TASK_CANCEL));
+ permTask.put("task2", permissions(TASK_EXECUTE));
exp.setTaskPermissions(permTask);
Map<String, Collection<SecurityPermission>> permSrvc = new HashMap<>();
- permSrvc.put("service1", Arrays.asList(SERVICE_DEPLOY));
- permSrvc.put("service2", Arrays.asList(SERVICE_INVOKE));
+ permSrvc.put("service1", permissions(SERVICE_DEPLOY));
+ permSrvc.put("service2", permissions(SERVICE_INVOKE));
exp.setServicePermissions(permSrvc);
- exp.setSystemPermissions(Arrays.asList(ADMIN_VIEW, EVENTS_ENABLE));
+ exp.setSystemPermissions(permissions(ADMIN_VIEW, EVENTS_ENABLE));
final SecurityPermissionSetBuilder permsBuilder = new SecurityPermissionSetBuilder();
@@ -105,19 +105,18 @@ public class SecurityPermissionSetBuilderTest extends GridCommonAbstractTest {
"you can assign permission only start with [EVENTS_, ADMIN_], but you try SERVICE_INVOKE"
);
- permsBuilder.appendCachePermissions(
- "cache1", CACHE_PUT, CACHE_REMOVE
- ).appendCachePermissions(
- "cache2", CACHE_READ
- ).appendTaskPermissions(
- "task1", TASK_CANCEL
- ).appendTaskPermissions(
- "task2", TASK_EXECUTE
- ).appendServicePermissions(
- "service1", SERVICE_DEPLOY
- ).appendServicePermissions(
- "service2", SERVICE_INVOKE
- ).appendSystemPermissions(ADMIN_VIEW, EVENTS_ENABLE);
+ permsBuilder
+ .appendCachePermissions("cache1", CACHE_PUT)
+ .appendCachePermissions("cache1", CACHE_PUT, CACHE_REMOVE)
+ .appendCachePermissions("cache2", CACHE_READ)
+ .appendTaskPermissions("task1", TASK_CANCEL)
+ .appendTaskPermissions("task2", TASK_EXECUTE)
+ .appendTaskPermissions("task2", TASK_EXECUTE)
+ .appendServicePermissions("service1", SERVICE_DEPLOY)
+ .appendServicePermissions("service2", SERVICE_INVOKE)
+ .appendServicePermissions("service2", SERVICE_INVOKE)
+ .appendSystemPermissions(ADMIN_VIEW)
+ .appendSystemPermissions(ADMIN_VIEW, EVENTS_ENABLE);
SecurityPermissionSet actual = permsBuilder.build();
@@ -127,4 +126,16 @@ public class SecurityPermissionSetBuilderTest extends GridCommonAbstractTest {
assertEquals(exp.systemPermissions(), actual.systemPermissions());
assertEquals(exp.defaultAllowAll(), actual.defaultAllowAll());
}
+
+ /**
+ * @param perms Permissions.
+ * @return Collection.
+ */
+ private static Collection<SecurityPermission> permissions(SecurityPermission... perms) {
+ Collection<SecurityPermission> col = U.newHashSet(perms.length);
+
+ Collections.addAll(col, perms);
+
+ return col;
+ }
}
[32/50] [abbrv] ignite git commit: IGNITE-5146 Simplified generation
for user properties.
Posted by sb...@apache.org.
IGNITE-5146 Simplified generation for user properties.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6579197a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6579197a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6579197a
Branch: refs/heads/ignite-5009
Commit: 6579197a86d6c6a4421aa20af8dbc792c2f49e44
Parents: 8be6813
Author: Vasiliy Sisko <vs...@gridgain.com>
Authored: Thu May 4 11:42:58 2017 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Thu May 4 11:42:58 2017 +0700
----------------------------------------------------------------------
.../generator/Properties.service.js | 63 ++++++++++----------
1 file changed, 32 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6579197a/modules/web-console/frontend/app/modules/configuration/generator/Properties.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/Properties.service.js b/modules/web-console/frontend/app/modules/configuration/generator/Properties.service.js
index 8a6a471..882ac5b 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/Properties.service.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/Properties.service.js
@@ -24,54 +24,55 @@ export default class IgnitePropertiesGenerator {
_collectProperties(bean) {
const props = [];
- _.forEach(bean.arguments, (arg) => {
- switch (arg.clsName) {
- case 'BEAN':
- props.push(...this._collectProperties(arg.value));
-
- break;
- case 'PROPERTY':
- case 'PROPERTY_CHAR':
- case 'PROPERTY_INT':
- props.push(`${arg.value}=${arg.hint}`);
+ // Append properties for complex object.
+ const processBean = (bean) => {
+ const newProps = _.difference(this._collectProperties(bean), props);
- break;
- default:
- // No-op.
- }
- });
+ if (!_.isEmpty(newProps)) {
+ props.push(...newProps);
- _.forEach(bean.properties, (prop) => {
- switch (prop.clsName) {
- case 'DATA_SOURCE':
- props.push(...this._collectProperties(prop.value));
+ if (!_.isEmpty(_.last(props)))
props.push('');
+ }
+ };
- break;
- case 'BEAN':
- props.push(...this._collectProperties(prop.value));
-
- break;
+ // Append properties from item.
+ const processItem = (item) => {
+ switch (item.clsName) {
case 'PROPERTY':
case 'PROPERTY_CHAR':
case 'PROPERTY_INT':
- props.push(`${prop.value}=${prop.hint}`);
+ props.push(..._.difference([`${item.value}=${item.hint}`], props));
+
+ break;
+ case 'BEAN':
+ case 'DATA_SOURCE':
+ processBean(item.value);
break;
case 'ARRAY':
case 'COLLECTION':
- _.forEach(prop.items, (item) => {
- const itemLines = this._collectProperties(item);
+ _.forEach(item.items, processBean);
- if (_.intersection(props, itemLines).length !== itemLines.length)
- props.push(...this._collectProperties(item));
+ break;
+ case 'MAP':
+ // Generate properties for all objects in keys and values of map.
+ _.forEach(item.entries, (entry) => {
+ processBean(entry.name);
+ processBean(entry.value);
});
break;
default:
// No-op.
}
- });
+ };
+
+ // Generate properties for object arguments.
+ _.forEach(_.get(bean, 'arguments'), processItem);
+
+ // Generate properties for object properties.
+ _.forEach(_.get(bean, 'properties'), processItem);
return props;
}
@@ -84,7 +85,7 @@ export default class IgnitePropertiesGenerator {
const sb = new StringBuilder();
- sb.append(`# ${sb.generatedBy()}`);
+ sb.append(`# ${sb.generatedBy()}`).emptyLine();
_.forEach(lines, (line) => sb.append(line));
[04/50] [abbrv] ignite git commit: IGNITE-5024 code of two tests was
fixed to pass new validation rules
Posted by sb...@apache.org.
IGNITE-5024 code of two tests was fixed to pass new validation rules
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/dc4b21ef
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/dc4b21ef
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/dc4b21ef
Branch: refs/heads/ignite-5009
Commit: dc4b21efffbcc0e1f45570e89477f8a63c381d31
Parents: 2872060
Author: Sergey Chugunov <se...@gmail.com>
Authored: Fri Apr 28 11:37:36 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Fri Apr 28 11:56:07 2017 +0300
----------------------------------------------------------------------
.../cache/CacheMemoryPolicyConfigurationTest.java | 12 +++++++++---
.../database/MemoryPolicyInitializationTest.java | 18 ++++++++++++------
2 files changed, 21 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/dc4b21ef/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMemoryPolicyConfigurationTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMemoryPolicyConfigurationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMemoryPolicyConfigurationTest.java
index 326a830..0fb9c08 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMemoryPolicyConfigurationTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMemoryPolicyConfigurationTest.java
@@ -36,6 +36,12 @@ public class CacheMemoryPolicyConfigurationTest extends GridCommonAbstractTest {
/** */
private volatile MemoryConfiguration memCfg;
+ /** */
+ private static final long DFLT_MEM_PLC_SIZE = 10 * 1024 * 1024;
+
+ /** */
+ private static final long BIG_MEM_PLC_SIZE = 1024 * 1024 * 1024;
+
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
@@ -138,12 +144,12 @@ public class CacheMemoryPolicyConfigurationTest extends GridCommonAbstractTest {
MemoryPolicyConfiguration dfltPlcCfg = new MemoryPolicyConfiguration();
dfltPlcCfg.setName("dfltPlc");
- dfltPlcCfg.setInitialSize(1024 * 1024);
- dfltPlcCfg.setMaxSize(1024 * 1024);
+ dfltPlcCfg.setInitialSize(DFLT_MEM_PLC_SIZE);
+ dfltPlcCfg.setMaxSize(DFLT_MEM_PLC_SIZE);
MemoryPolicyConfiguration bigPlcCfg = new MemoryPolicyConfiguration();
bigPlcCfg.setName("bigPlc");
- bigPlcCfg.setMaxSize(1024 * 1024 * 1024);
+ bigPlcCfg.setMaxSize(BIG_MEM_PLC_SIZE);
memCfg.setMemoryPolicies(dfltPlcCfg, bigPlcCfg);
memCfg.setDefaultMemoryPolicyName("dfltPlc");
http://git-wip-us.apache.org/repos/asf/ignite/blob/dc4b21ef/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/database/MemoryPolicyInitializationTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/database/MemoryPolicyInitializationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/database/MemoryPolicyInitializationTest.java
index a1c9728..ec798ee 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/database/MemoryPolicyInitializationTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/database/MemoryPolicyInitializationTest.java
@@ -232,10 +232,12 @@ public class MemoryPolicyInitializationTest extends GridCommonAbstractTest {
memCfg.setMemoryPolicies(new MemoryPolicyConfiguration()
.setName(CUSTOM_NON_DEFAULT_MEM_PLC_NAME)
+ .setInitialSize(USER_CUSTOM_MEM_PLC_SIZE)
.setMaxSize(USER_CUSTOM_MEM_PLC_SIZE),
- new MemoryPolicyConfiguration()
+ new MemoryPolicyConfiguration()
.setName(DFLT_MEM_PLC_DEFAULT_NAME)
+ .setInitialSize(USER_CUSTOM_MEM_PLC_SIZE)
.setMaxSize(USER_DEFAULT_MEM_PLC_SIZE)
);
}
@@ -248,8 +250,9 @@ public class MemoryPolicyInitializationTest extends GridCommonAbstractTest {
memCfg = new MemoryConfiguration();
memCfg.setMemoryPolicies(new MemoryPolicyConfiguration()
- .setName(DFLT_MEM_PLC_DEFAULT_NAME)
- .setMaxSize(USER_DEFAULT_MEM_PLC_SIZE)
+ .setName(DFLT_MEM_PLC_DEFAULT_NAME)
+ .setInitialSize(USER_CUSTOM_MEM_PLC_SIZE)
+ .setMaxSize(USER_DEFAULT_MEM_PLC_SIZE)
);
}
@@ -261,10 +264,12 @@ public class MemoryPolicyInitializationTest extends GridCommonAbstractTest {
memCfg.setMemoryPolicies(new MemoryPolicyConfiguration()
.setName(DFLT_MEM_PLC_DEFAULT_NAME)
+ .setInitialSize(USER_CUSTOM_MEM_PLC_SIZE)
.setMaxSize(USER_DEFAULT_MEM_PLC_SIZE),
- new MemoryPolicyConfiguration()
+ new MemoryPolicyConfiguration()
.setName(CUSTOM_NON_DEFAULT_MEM_PLC_NAME)
+ .setInitialSize(USER_CUSTOM_MEM_PLC_SIZE)
.setMaxSize(USER_CUSTOM_MEM_PLC_SIZE)
);
}
@@ -287,8 +292,9 @@ public class MemoryPolicyInitializationTest extends GridCommonAbstractTest {
memCfg = new MemoryConfiguration();
memCfg.setMemoryPolicies(new MemoryPolicyConfiguration()
- .setName(CUSTOM_NON_DEFAULT_MEM_PLC_NAME)
- .setMaxSize(USER_CUSTOM_MEM_PLC_SIZE)
+ .setName(CUSTOM_NON_DEFAULT_MEM_PLC_NAME)
+ .setInitialSize(USER_CUSTOM_MEM_PLC_SIZE)
+ .setMaxSize(USER_CUSTOM_MEM_PLC_SIZE)
);
}
[20/50] [abbrv] ignite git commit: IGNITE-5134: Fixed
ClassCastException in IgniteCacheDatabaseSharedManager. This closes #1895.
Posted by sb...@apache.org.
IGNITE-5134: Fixed ClassCastException in IgniteCacheDatabaseSharedManager. This closes #1895.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4c1dab4e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4c1dab4e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4c1dab4e
Branch: refs/heads/ignite-5009
Commit: 4c1dab4e6be1490887144cc2ff1042aa4d650363
Parents: e7826aa
Author: Ivan Rakov <iv...@gmail.com>
Authored: Wed May 3 11:24:01 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed May 3 11:24:01 2017 +0300
----------------------------------------------------------------------
.../IgniteCacheDatabaseSharedManager.java | 21 +++++++++++++-------
.../pagemem/impl/PageMemoryNoLoadSelfTest.java | 3 ++-
.../database/IgniteDbDynamicCacheSelfTest.java | 1 +
.../database/MetadataStorageSelfTest.java | 3 ++-
.../processors/igfs/IgfsSizeSelfTest.java | 2 +-
5 files changed, 20 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/4c1dab4e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/IgniteCacheDatabaseSharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/IgniteCacheDatabaseSharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/IgniteCacheDatabaseSharedManager.java
index 5062d0f..7151b2f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/IgniteCacheDatabaseSharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/IgniteCacheDatabaseSharedManager.java
@@ -715,7 +715,8 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
* @param memMetrics {@link MemoryMetrics} object to collect memory usage metrics.
* @return Memory policy instance.
*/
- private MemoryPolicy initMemory(MemoryConfiguration memCfg, MemoryPolicyConfiguration plcCfg, MemoryMetricsImpl memMetrics) {
+ private MemoryPolicy initMemory(MemoryConfiguration memCfg, MemoryPolicyConfiguration plcCfg,
+ MemoryMetricsImpl memMetrics) {
File allocPath = buildAllocPath(plcCfg);
DirectMemoryProvider memProvider = allocPath == null ?
@@ -726,23 +727,29 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
PageMemory pageMem = createPageMemory(memProvider, memCfg, plcCfg, memMetrics);
- return new MemoryPolicy(pageMem, plcCfg, memMetrics, createPageEvictionTracker(plcCfg,
- (PageMemoryNoStoreImpl)pageMem));
+ return new MemoryPolicy(pageMem, plcCfg, memMetrics, createPageEvictionTracker(plcCfg, pageMem));
}
/**
* @param plc Memory Policy Configuration.
* @param pageMem Page memory.
*/
- private PageEvictionTracker createPageEvictionTracker(MemoryPolicyConfiguration plc, PageMemoryNoStoreImpl pageMem) {
+ private PageEvictionTracker createPageEvictionTracker(MemoryPolicyConfiguration plc, PageMemory pageMem) {
+ if (plc.getPageEvictionMode() == DataPageEvictionMode.DISABLED)
+ return new NoOpPageEvictionTracker();
+
+ assert pageMem instanceof PageMemoryNoStoreImpl : pageMem.getClass();
+
+ PageMemoryNoStoreImpl pageMem0 = (PageMemoryNoStoreImpl)pageMem;
+
if (Boolean.getBoolean("override.fair.fifo.page.eviction.tracker"))
- return new FairFifoPageEvictionTracker(pageMem, plc, cctx);
+ return new FairFifoPageEvictionTracker(pageMem0, plc, cctx);
switch (plc.getPageEvictionMode()) {
case RANDOM_LRU:
- return new RandomLruPageEvictionTracker(pageMem, plc, cctx);
+ return new RandomLruPageEvictionTracker(pageMem0, plc, cctx);
case RANDOM_2_LRU:
- return new Random2LruPageEvictionTracker(pageMem, plc, cctx);
+ return new Random2LruPageEvictionTracker(pageMem0, plc, cctx);
default:
return new NoOpPageEvictionTracker();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4c1dab4e/modules/core/src/test/java/org/apache/ignite/internal/pagemem/impl/PageMemoryNoLoadSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/pagemem/impl/PageMemoryNoLoadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/pagemem/impl/PageMemoryNoLoadSelfTest.java
index 84db565..0a283ed 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/pagemem/impl/PageMemoryNoLoadSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/pagemem/impl/PageMemoryNoLoadSelfTest.java
@@ -280,7 +280,8 @@ public class PageMemoryNoLoadSelfTest extends GridCommonAbstractTest {
protected PageMemory memory() throws Exception {
File memDir = U.resolveWorkDirectory(U.defaultWorkDirectory(), "pagemem", false);
- MemoryPolicyConfiguration plcCfg = new MemoryPolicyConfiguration().setMaxSize(10 * 1024 * 1024);
+ MemoryPolicyConfiguration plcCfg = new MemoryPolicyConfiguration()
+ .setInitialSize(10 * 1024 * 1024).setMaxSize(10 * 1024 * 1024);
DirectMemoryProvider provider = new MappedFileMemoryProvider(log(), memDir);
http://git-wip-us.apache.org/repos/asf/ignite/blob/4c1dab4e/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbDynamicCacheSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbDynamicCacheSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbDynamicCacheSelfTest.java
index 3b3e1de..8655ba9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbDynamicCacheSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbDynamicCacheSelfTest.java
@@ -44,6 +44,7 @@ public class IgniteDbDynamicCacheSelfTest extends GridCommonAbstractTest {
MemoryPolicyConfiguration plc = new MemoryPolicyConfiguration();
plc.setName("dfltPlc");
+ plc.setInitialSize(200 * 1024 * 1024);
plc.setMaxSize(200 * 1024 * 1024);
dbCfg.setDefaultMemoryPolicyName("dfltPlc");
http://git-wip-us.apache.org/repos/asf/ignite/blob/4c1dab4e/modules/core/src/test/java/org/apache/ignite/internal/processors/database/MetadataStorageSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/MetadataStorageSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/MetadataStorageSelfTest.java
index af0b849..b98f429 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/MetadataStorageSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/MetadataStorageSelfTest.java
@@ -157,7 +157,8 @@ public class MetadataStorageSelfTest extends GridCommonAbstractTest {
protected PageMemory memory(boolean clean) throws Exception {
DirectMemoryProvider provider = new MappedFileMemoryProvider(log(), allocationPath);
- MemoryPolicyConfiguration plcCfg = new MemoryPolicyConfiguration().setMaxSize(30 * 1024 * 1024);
+ MemoryPolicyConfiguration plcCfg = new MemoryPolicyConfiguration()
+ .setMaxSize(30 * 1024 * 1024).setInitialSize(30 * 1024 * 1024);
return new PageMemoryNoStoreImpl(
log,
http://git-wip-us.apache.org/repos/asf/ignite/blob/4c1dab4e/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java
index 456971a..597efe1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java
@@ -397,7 +397,7 @@ public class IgfsSizeSelfTest extends IgfsCommonAbstractTest {
String memPlcName = "igfsDataMemPlc";
cfg.setMemoryConfiguration(new MemoryConfiguration().setMemoryPolicies(
- new MemoryPolicyConfiguration().setMaxSize(maxSize).setName(memPlcName)));
+ new MemoryPolicyConfiguration().setMaxSize(maxSize).setInitialSize(maxSize).setName(memPlcName)));
FileSystemConfiguration igfsCfg = cfg.getFileSystemConfiguration()[0];
[02/50] [abbrv] ignite git commit: IGNITE-4988 Code cleanup for
ignite-2.0.
Posted by sb...@apache.org.
IGNITE-4988 Code cleanup for ignite-2.0.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/28720608
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/28720608
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/28720608
Branch: refs/heads/ignite-5009
Commit: 2872060897a9a6390d4c5cb7324a733f7b3cec56
Parents: ab2a5b9
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Fri Apr 28 14:56:53 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Apr 28 14:56:53 2017 +0700
----------------------------------------------------------------------
.../internal/visor/query/VisorQueryConfiguration.java | 12 ------------
.../ignite/visor/commands/cache/VisorCacheCommand.scala | 1 -
modules/web-console/backend/app/mongo.js | 3 ---
.../configuration/generator/ConfigurationGenerator.js | 3 ---
.../configuration/generator/PlatformGenerator.js | 3 +--
.../configuration/generator/defaults/Cache.service.js | 2 --
.../configuration/generator/defaults/IGFS.service.js | 1 -
.../app/modules/states/configuration/caches/query.pug | 6 ------
.../app/modules/states/configuration/igfs/misc.pug | 2 --
9 files changed, 1 insertion(+), 32 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/28720608/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryConfiguration.java
index 92921b2..67eaaa4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryConfiguration.java
@@ -48,9 +48,6 @@ public class VisorQueryConfiguration extends VisorDataTransferObject {
private List<String> indexedTypes;
/** */
- private int sqlOnheapRowCacheSize;
-
- /** */
private String sqlSchema;
/**
@@ -102,13 +99,6 @@ public class VisorQueryConfiguration extends VisorDataTransferObject {
}
/**
- * @return Number of SQL rows which will be cached onheap to avoid deserialization on each SQL index access.
- */
- public int getSqlOnheapRowCacheSize() {
- return sqlOnheapRowCacheSize;
- }
-
- /**
* @return Schema name, which is used by SQL engine for SQL statements generation.
*/
public String getSqlSchema() {
@@ -121,7 +111,6 @@ public class VisorQueryConfiguration extends VisorDataTransferObject {
out.writeLong(longQryWarnTimeout);
out.writeBoolean(sqlEscapeAll);
U.writeCollection(out, indexedTypes);
- out.writeInt(sqlOnheapRowCacheSize);
U.writeString(out, sqlSchema);
}
@@ -131,7 +120,6 @@ public class VisorQueryConfiguration extends VisorDataTransferObject {
longQryWarnTimeout = in.readLong();
sqlEscapeAll = in.readBoolean();
indexedTypes = U.readList(in);
- sqlOnheapRowCacheSize = in.readInt();
sqlSchema = U.readString(in);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/28720608/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
index 0616154..680522f 100755
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
@@ -895,7 +895,6 @@ object VisorCacheCommand {
cacheT +=("Query Execution Time Threshold", queryCfg.getLongQueryWarningTimeout)
cacheT +=("Query Schema Name", queryCfg.getSqlSchema)
cacheT +=("Query Escaped Names", bool2Str(queryCfg.isSqlEscapeAll))
- cacheT +=("Query Onheap Cache Size", queryCfg.getSqlOnheapRowCacheSize)
val sqlFxs = queryCfg.getSqlFunctionClasses
http://git-wip-us.apache.org/repos/asf/ignite/blob/28720608/modules/web-console/backend/app/mongo.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/app/mongo.js b/modules/web-console/backend/app/mongo.js
index b525419..80be010 100644
--- a/modules/web-console/backend/app/mongo.js
+++ b/modules/web-console/backend/app/mongo.js
@@ -266,10 +266,8 @@ module.exports.factory = function(passportMongo, settings, pluginMongo, mongoose
sqlEscapeAll: Boolean,
sqlSchema: String,
- sqlOnheapRowCacheSize: Number,
longQueryWarningTimeout: Number,
sqlFunctionClasses: [String],
- snapshotableIndex: Boolean,
queryDetailMetricsSize: Number,
queryParallelism: Number,
statisticsEnabled: Boolean,
@@ -355,7 +353,6 @@ module.exports.factory = function(passportMongo, settings, pluginMongo, mongoose
threadCount: Number
},
ipcEndpointEnabled: Boolean,
- maxSpaceSize: Number,
maximumTaskRangeLength: Number,
managementPort: Number,
pathModes: [{path: String, mode: {type: String, enum: ['PRIMARY', 'PROXY', 'DUAL_SYNC', 'DUAL_ASYNC']}}],
http://git-wip-us.apache.org/repos/asf/ignite/blob/28720608/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js b/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
index 8856e03..d5aecdb 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
@@ -1498,13 +1498,11 @@ export default class IgniteConfigurationGenerator {
}, []);
ccfg.stringProperty('sqlSchema')
- .intProperty('sqlOnheapRowCacheSize')
.intProperty('longQueryWarningTimeout')
.arrayProperty('indexedTypes', 'indexedTypes', indexedTypes, 'java.lang.Class')
.intProperty('queryDetailMetricsSize')
.intProperty('queryParallelism')
.arrayProperty('sqlFunctionClasses', 'sqlFunctionClasses', cache.sqlFunctionClasses, 'java.lang.Class')
- .intProperty('snapshotableIndex')
.intProperty('sqlEscapeAll');
return ccfg;
@@ -1835,7 +1833,6 @@ export default class IgniteConfigurationGenerator {
static igfsMisc(igfs, cfg = this.igfsConfigurationBean(igfs)) {
cfg.intProperty('blockSize')
.intProperty('bufferSize')
- .intProperty('maxSpaceSize')
.intProperty('maximumTaskRangeLength')
.intProperty('managementPort')
.intProperty('perNodeBatchSize')
http://git-wip-us.apache.org/repos/asf/ignite/blob/28720608/modules/web-console/frontend/app/modules/configuration/generator/PlatformGenerator.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/PlatformGenerator.js b/modules/web-console/frontend/app/modules/configuration/generator/PlatformGenerator.js
index febba62..d1a9092 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/PlatformGenerator.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/PlatformGenerator.js
@@ -300,8 +300,7 @@ export default ['JavaTypes', 'igniteClusterPlatformDefaults', 'igniteCachePlatfo
// Generate cache queries & Indexing group.
static cacheQuery(cache, domains, ccfg = this.cacheConfigurationBean(cache)) {
- ccfg.intProperty('sqlOnheapRowCacheSize')
- .intProperty('longQueryWarningTimeout');
+ ccfg.intProperty('longQueryWarningTimeout');
return ccfg;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/28720608/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.service.js b/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.service.js
index e77d1d3..390233b 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.service.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.service.js
@@ -26,9 +26,7 @@ const DFLT_CACHE = {
clsName: 'org.apache.ignite.cache.PartitionLossPolicy',
value: 'IGNORE'
},
- sqlOnheapRowCacheSize: 10240,
longQueryWarningTimeout: 3000,
- snapshotableIndex: false,
sqlEscapeAll: false,
storeKeepBinary: false,
loadPreviousValue: false,
http://git-wip-us.apache.org/repos/asf/ignite/blob/28720608/modules/web-console/frontend/app/modules/configuration/generator/defaults/IGFS.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/defaults/IGFS.service.js b/modules/web-console/frontend/app/modules/configuration/generator/defaults/IGFS.service.js
index 6c8d16c..49699bc 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/defaults/IGFS.service.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/defaults/IGFS.service.js
@@ -37,7 +37,6 @@ const DFLT_IGFS = {
fragmentizerThrottlingDelay: 200,
blockSize: 65536,
bufferSize: 65536,
- maxSpaceSize: 0,
maximumTaskRangeLength: 0,
managementPort: 11400,
perNodeBatchSize: 100,
http://git-wip-us.apache.org/repos/asf/ignite/blob/28720608/modules/web-console/frontend/app/modules/states/configuration/caches/query.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/caches/query.pug b/modules/web-console/frontend/app/modules/states/configuration/caches/query.pug
index 52425ba..b3650e2 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/caches/query.pug
+++ b/modules/web-console/frontend/app/modules/states/configuration/caches/query.pug
@@ -47,9 +47,6 @@ include /app/helpers/jade/mixins
</li>\
</ul>')
.settings-row
- +number('On-heap cache for off-heap indexes:', `${model}.sqlOnheapRowCacheSize`, '"sqlOnheapRowCacheSize"', 'true', '10240', '1',
- 'Number of SQL rows which will be cached onheap to avoid deserialization on each SQL index access')
- .settings-row
+number('Long query timeout:', `${model}.longQueryWarningTimeout`, '"longQueryWarningTimeout"', 'true', '3000', '0',
'Timeout in milliseconds after which long query warning will be printed')
.settings-row
@@ -106,9 +103,6 @@ include /app/helpers/jade/mixins
.group-content-empty(ng-if=`!(${sqlFunctionClasses}.length) && !group.add.length`)
| Not defined
.settings-row
- +checkbox('Snapshotable index', `${model}.snapshotableIndex`, '"snapshotableIndex"',
- 'Flag indicating whether SQL indexes should support snapshots')
- .settings-row
+checkbox('Escape table and filed names', `${model}.sqlEscapeAll`, '"sqlEscapeAll"',
'If enabled than all schema, table and field names will be escaped with double quotes (for example: "tableName"."fieldName").<br/>\
This enforces case sensitivity for field names and also allows having special characters in table and field names.<br/>\
http://git-wip-us.apache.org/repos/asf/ignite/blob/28720608/modules/web-console/frontend/app/modules/states/configuration/igfs/misc.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/igfs/misc.pug b/modules/web-console/frontend/app/modules/states/configuration/igfs/misc.pug
index 6133feb..29f955a 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/igfs/misc.pug
+++ b/modules/web-console/frontend/app/modules/states/configuration/igfs/misc.pug
@@ -57,8 +57,6 @@ mixin table-igfs-path-mode-edit(prefix, focusId, index)
.settings-row
+number('Buffer size:', `${model}.bufferSize`, '"bufferSize"', 'true', '65536', '0', 'Read/write buffer size for IGFS stream operations in bytes')
.settings-row
- +number('Maximum space size:', `${model}.maxSpaceSize`, '"maxSpaceSize"', 'true', '0', '0', 'Maximum space available for data cache to store file system entries')
- .settings-row
+number('Maximum task range length:', `${model}.maximumTaskRangeLength`, '"maximumTaskRangeLength"', 'true', '0', '0', 'Maximum default range size of a file being split during IGFS task execution')
.settings-row
+number-min-max('Management port:', `${model}.managementPort`, '"managementPort"', 'true', '11400', '0', '65535', 'Port number for management endpoint')
[39/50] [abbrv] ignite git commit: Added docker files for 2.0.0
version
Posted by sb...@apache.org.
Added docker files for 2.0.0 version
Signed-off-by: nikolay_tikhonov <nt...@gridgain.com>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a8fcb0b1
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a8fcb0b1
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a8fcb0b1
Branch: refs/heads/ignite-5009
Commit: a8fcb0b1abe02dcd8a8fd7354ccd8b650db8d19a
Parents: 7d288c7
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Thu May 4 14:55:19 2017 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Thu May 4 14:55:59 2017 +0300
----------------------------------------------------------------------
modules/docker/2.0.0/Dockerfile | 46 ++++++++++++++++++++++++++++++++
modules/docker/2.0.0/run.sh | 51 ++++++++++++++++++++++++++++++++++++
modules/docker/Dockerfile | 2 +-
3 files changed, 98 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/a8fcb0b1/modules/docker/2.0.0/Dockerfile
----------------------------------------------------------------------
diff --git a/modules/docker/2.0.0/Dockerfile b/modules/docker/2.0.0/Dockerfile
new file mode 100644
index 0000000..2292981
--- /dev/null
+++ b/modules/docker/2.0.0/Dockerfile
@@ -0,0 +1,46 @@
+#
+# 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.
+#
+
+# Start from a Java image.
+FROM java:8
+
+# Ignite version
+ENV IGNITE_VERSION 2.0.0
+
+# Ignite home
+ENV IGNITE_HOME /opt/ignite/apache-ignite-fabric-${IGNITE_VERSION}-bin
+
+# Do not rely on anything provided by base image(s), but be explicit, if they are installed already it is noop then
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ unzip \
+ curl \
+ && rm -rf /var/lib/apt/lists/*
+
+WORKDIR /opt/ignite
+
+RUN curl https://dist.apache.org/repos/dist/release/ignite/${IGNITE_VERSION}/apache-ignite-fabric-${IGNITE_VERSION}-bin.zip -o ignite.zip \
+ && unzip ignite.zip \
+ && rm ignite.zip
+
+# Copy sh files and set permission
+COPY ./run.sh $IGNITE_HOME/
+
+RUN chmod +x $IGNITE_HOME/run.sh
+
+CMD $IGNITE_HOME/run.sh
+
+EXPOSE 11211 47100 47500 49112
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/a8fcb0b1/modules/docker/2.0.0/run.sh
----------------------------------------------------------------------
diff --git a/modules/docker/2.0.0/run.sh b/modules/docker/2.0.0/run.sh
new file mode 100644
index 0000000..3aafc30
--- /dev/null
+++ b/modules/docker/2.0.0/run.sh
@@ -0,0 +1,51 @@
+#!/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.
+#
+
+if [ ! -z "$OPTION_LIBS" ]; then
+ IFS=, LIBS_LIST=("$OPTION_LIBS")
+
+ for lib in ${LIBS_LIST[@]}; do
+ cp -r $IGNITE_HOME/libs/optional/"$lib"/* \
+ $IGNITE_HOME/libs/
+ done
+fi
+
+if [ ! -z "$EXTERNAL_LIBS" ]; then
+ IFS=, LIBS_LIST=("$EXTERNAL_LIBS")
+
+ for lib in ${LIBS_LIST[@]}; do
+ echo $lib >> temp
+ done
+
+ wget -i temp -P $IGNITE_HOME/libs
+
+ rm temp
+fi
+
+QUIET=""
+
+if [ "$IGNITE_QUIET" = "false" ]; then
+ QUIET="-v"
+fi
+
+if [ -z $CONFIG_URI ]; then
+ $IGNITE_HOME/bin/ignite.sh $QUIET
+else
+ $IGNITE_HOME/bin/ignite.sh $QUIET $CONFIG_URI
+fi
+
http://git-wip-us.apache.org/repos/asf/ignite/blob/a8fcb0b1/modules/docker/Dockerfile
----------------------------------------------------------------------
diff --git a/modules/docker/Dockerfile b/modules/docker/Dockerfile
index 48ceba1..2292981 100644
--- a/modules/docker/Dockerfile
+++ b/modules/docker/Dockerfile
@@ -19,7 +19,7 @@
FROM java:8
# Ignite version
-ENV IGNITE_VERSION 1.9.0
+ENV IGNITE_VERSION 2.0.0
# Ignite home
ENV IGNITE_HOME /opt/ignite/apache-ignite-fabric-${IGNITE_VERSION}-bin
[47/50] [abbrv] ignite git commit: Fixed JavaDocs in
MemoryMetricsImpl.
Posted by sb...@apache.org.
Fixed JavaDocs in MemoryMetricsImpl.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1af98e9b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1af98e9b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1af98e9b
Branch: refs/heads/ignite-5009
Commit: 1af98e9b597d2ffe986d5f9827b9bf2d596219af
Parents: ad288a5
Author: devozerov <vo...@gridgain.com>
Authored: Fri May 5 12:16:36 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Fri May 5 12:16:36 2017 +0300
----------------------------------------------------------------------
.../processors/cache/database/MemoryMetricsImpl.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/1af98e9b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/MemoryMetricsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/MemoryMetricsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/MemoryMetricsImpl.java
index 4a7e951..ee356a1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/MemoryMetricsImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/MemoryMetricsImpl.java
@@ -255,12 +255,16 @@ public class MemoryMetricsImpl implements MemoryMetrics {
largeEntriesPages.decrement();
}
- /** {@inheritDoc} */
+ /**
+ * Enable metrics.
+ */
public void enableMetrics() {
metricsEnabled = true;
}
- /** {@inheritDoc} */
+ /**
+ * Disable metrics.
+ */
public void disableMetrics() {
metricsEnabled = false;
}