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/15 10:48:53 UTC
[1/5] ignite git commit: IGNITE-5213 .NET: Fix collection handling in
reflective serializer
Repository: ignite
Updated Branches:
refs/heads/ignite-5075-cacheStart f5a5fa020 -> f9aa769ad
IGNITE-5213 .NET: Fix collection handling in reflective serializer
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9e3af25e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9e3af25e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9e3af25e
Branch: refs/heads/ignite-5075-cacheStart
Commit: 9e3af25e1220e84cdeca2c24adfe8a964b933e60
Parents: 330d9ef
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon May 15 13:13:24 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon May 15 13:13:24 2017 +0300
----------------------------------------------------------------------
.../Binary/BinarySelfTest.cs | 26 ++++++++++++++++++++
.../Impl/Binary/BinaryReflectiveActions.cs | 6 ++---
.../BinaryReflectiveSerializerInternal.cs | 9 ++++---
.../Impl/Binary/BinaryUtils.cs | 9 -------
.../Binary/DeserializationCallbackProcessor.cs | 11 +++++++++
.../Impl/Binary/SerializableSerializer.cs | 10 +++-----
6 files changed, 49 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/9e3af25e/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
index 01f108e..4a0827b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
@@ -30,6 +30,7 @@ namespace Apache.Ignite.Core.Tests.Binary
using System.IO;
using System.Linq;
using System.Reflection;
+ using System.Runtime.Serialization;
using Apache.Ignite.Core.Binary;
using Apache.Ignite.Core.Cache.Configuration;
using Apache.Ignite.Core.Common;
@@ -1128,6 +1129,13 @@ namespace Apache.Ignite.Core.Tests.Binary
Assert.AreEqual(obj, marsh.Unmarshal<CollectionsType>(marsh.Marshal(obj)));
obj.Col2 = new TestList();
+ obj.Hashtable = new TestHashTable();
+
+ Assert.AreEqual(obj, marsh.Unmarshal<CollectionsType>(marsh.Marshal(obj)));
+
+ // Test custom collections.
+ obj.Col3 = new TestList {1, "2"};
+ obj.Hashtable2 = new TestHashTable {{1, "2"}};
Assert.AreEqual(obj, marsh.Unmarshal<CollectionsType>(marsh.Marshal(obj)));
}
@@ -1697,9 +1705,13 @@ namespace Apache.Ignite.Core.Tests.Binary
public ICollection Col1 { get; set; }
public ArrayList Col2 { get; set; }
+
+ public TestList Col3 { get; set; }
public Hashtable Hashtable { get; set; }
+ public TestHashTable Hashtable2 { get; set; }
+
public Dictionary<int, string> Dict { get; set; }
public InnerObjectType[] Arr { get; set; }
@@ -1767,7 +1779,21 @@ namespace Apache.Ignite.Core.Tests.Binary
public class TestList : ArrayList
{
+ // No-op.
+ }
+
+ public class TestHashTable : Hashtable
+ {
+ public TestHashTable()
+ {
+ // No-op.
+ }
+ // ReSharper disable once UnusedMember.Global
+ protected TestHashTable(SerializationInfo info, StreamingContext context) : base(info, context)
+ {
+ // No-op.
+ }
}
private static bool CompareCollections(ICollection col1, ICollection col2)
http://git-wip-us.apache.org/repos/asf/ignite/blob/9e3af25e/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReflectiveActions.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReflectiveActions.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReflectiveActions.cs
index 6aaf5f9..bdcdd09 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReflectiveActions.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReflectiveActions.cs
@@ -483,8 +483,7 @@ namespace Apache.Ignite.Core.Impl.Binary
: GetWriter<object>(field, (f, w, o) => w.WriteEnum(f, o), true);
readAction = raw ? GetRawReader(field, MthdReadEnumRaw) : GetReader(field, MthdReadEnum);
}
- else if (type == BinaryUtils.TypDictionary ||
- type.GetInterface(BinaryUtils.TypDictionary.FullName) != null && !type.IsGenericType)
+ else if (type == typeof(IDictionary) || type == typeof(Hashtable))
{
writeAction = raw
? GetRawWriter<IDictionary>(field, (w, o) => w.WriteDictionary(o))
@@ -493,8 +492,7 @@ namespace Apache.Ignite.Core.Impl.Binary
? GetRawReader(field, r => r.ReadDictionary())
: GetReader(field, (f, r) => r.ReadDictionary(f));
}
- else if (type == BinaryUtils.TypCollection ||
- type.GetInterface(BinaryUtils.TypCollection.FullName) != null && !type.IsGenericType)
+ else if (type == typeof(ICollection) || type == typeof(ArrayList))
{
writeAction = raw
? GetRawWriter<ICollection>(field, (w, o) => w.WriteCollection(o))
http://git-wip-us.apache.org/repos/asf/ignite/blob/9e3af25e/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReflectiveSerializerInternal.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReflectiveSerializerInternal.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReflectiveSerializerInternal.cs
index e160559..b179f92 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReflectiveSerializerInternal.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReflectiveSerializerInternal.cs
@@ -106,11 +106,14 @@ namespace Apache.Ignite.Core.Impl.Binary
action(obj, reader);
_serializableDescriptor.OnDeserialized(obj, ctx);
-
+
+ DeserializationCallbackProcessor.Pop();
}
- finally
+ catch (Exception)
{
- DeserializationCallbackProcessor.Pop();
+ // Clear callbacks on exception to avoid dangling objects.
+ DeserializationCallbackProcessor.Clear();
+ throw;
}
return (T) obj;
http://git-wip-us.apache.org/repos/asf/ignite/blob/9e3af25e/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
index 5bc68fe..977251c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
@@ -206,15 +206,6 @@ namespace Apache.Ignite.Core.Impl.Binary
/** Indicates object array. */
public const int ObjTypeId = -1;
- /** Int type. */
- public static readonly Type TypInt = typeof(int);
-
- /** Collection type. */
- public static readonly Type TypCollection = typeof(ICollection);
-
- /** Dictionary type. */
- public static readonly Type TypDictionary = typeof(IDictionary);
-
/** Ticks for Java epoch. */
private static readonly long JavaDateTicks = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).Ticks;
http://git-wip-us.apache.org/repos/asf/ignite/blob/9e3af25e/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/DeserializationCallbackProcessor.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/DeserializationCallbackProcessor.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/DeserializationCallbackProcessor.cs
index 3b21946..a2bb43f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/DeserializationCallbackProcessor.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/DeserializationCallbackProcessor.cs
@@ -78,6 +78,17 @@ namespace Apache.Ignite.Core.Impl.Binary
}
/// <summary>
+ /// Clears all registered objects.
+ /// </summary>
+ public static void Clear()
+ {
+ var graph = Graph.Value;
+
+ graph.Objects.Clear();
+ graph.Depth = 0;
+ }
+
+ /// <summary>
/// Object graph.
/// </summary>
private class ObjectGraph
http://git-wip-us.apache.org/repos/asf/ignite/blob/9e3af25e/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/SerializableSerializer.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/SerializableSerializer.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/SerializableSerializer.cs
index 6c7076a..1e4af4b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/SerializableSerializer.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/SerializableSerializer.cs
@@ -91,7 +91,6 @@ namespace Apache.Ignite.Core.Impl.Binary
{
object res;
var ctx = GetStreamingContext(reader);
- var callbackPushed = false;
// Read additional information from raw part, if flag is set.
IEnumerable<string> fieldNames;
@@ -129,7 +128,6 @@ namespace Apache.Ignite.Core.Impl.Binary
reader.AddHandle(pos, res);
DeserializationCallbackProcessor.Push(res);
- callbackPushed = true;
}
else
{
@@ -138,7 +136,6 @@ namespace Apache.Ignite.Core.Impl.Binary
_serializableTypeDesc.OnDeserializing(res, ctx);
DeserializationCallbackProcessor.Push(res);
- callbackPushed = true;
reader.AddHandle(pos, res);
@@ -148,11 +145,12 @@ namespace Apache.Ignite.Core.Impl.Binary
}
_serializableTypeDesc.OnDeserialized(res, ctx);
+ DeserializationCallbackProcessor.Pop();
}
- finally
+ catch (Exception)
{
- if (callbackPushed)
- DeserializationCallbackProcessor.Pop();
+ DeserializationCallbackProcessor.Clear();
+ throw;
}
return (T) res;
[2/5] ignite git commit: IGNITE-5112 Create OLS example: Created
example & tests refactoring.
Posted by sb...@apache.org.
IGNITE-5112 Create OLS example:
Created example & tests refactoring.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5743c3b0
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5743c3b0
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5743c3b0
Branch: refs/heads/ignite-5075-cacheStart
Commit: 5743c3b0bec7813eb22ade8c15334be418c5ad4b
Parents: 9e3af25
Author: Yury Babak <yb...@gridgain.com>
Authored: Mon May 15 13:20:18 2017 +0300
Committer: Yury Babak <yb...@gridgain.com>
Committed: Mon May 15 13:20:18 2017 +0300
----------------------------------------------------------------------
.../DistributedRegressionExample.java | 149 +++++++++++++++++++
.../apache/ignite/ml/math/util/MatrixUtil.java | 3 +-
.../org/apache/ignite/ml/IgniteMLTestSuite.java | 35 +++++
.../ml/math/MathImplDistributedTestSuite.java | 2 +-
.../ignite/ml/math/MathImplLocalTestSuite.java | 7 +-
.../ignite/ml/math/MathImplMainTestSuite.java | 2 +-
.../OLSMultipleLinearRegressionTest.java | 7 +
.../ml/regressions/RegressionsTestSuite.java | 32 ++++
8 files changed, 229 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/5743c3b0/examples/src/main/ml/org/apache/ignite/examples/ml/math/regression/DistributedRegressionExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/ml/org/apache/ignite/examples/ml/math/regression/DistributedRegressionExample.java b/examples/src/main/ml/org/apache/ignite/examples/ml/math/regression/DistributedRegressionExample.java
new file mode 100644
index 0000000..8e68522
--- /dev/null
+++ b/examples/src/main/ml/org/apache/ignite/examples/ml/math/regression/DistributedRegressionExample.java
@@ -0,0 +1,149 @@
+/*
+ * 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.examples.ml.math.regression;
+
+import java.util.Arrays;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.examples.ml.math.matrix.SparseDistributedMatrixExample;
+import org.apache.ignite.ml.math.StorageConstants;
+import org.apache.ignite.ml.math.Tracer;
+import org.apache.ignite.ml.math.impls.matrix.SparseDistributedMatrix;
+import org.apache.ignite.ml.regressions.OLSMultipleLinearRegression;
+import org.apache.ignite.thread.IgniteThread;
+
+/**
+ * Run linear regression over distributed matrix.
+ *
+ * TODO: Currently works only in local mode.
+ *
+ * @see OLSMultipleLinearRegression
+ */
+public class DistributedRegressionExample {
+ /** Run example. */
+ public static void main(String[] args) throws InterruptedException {
+ System.out.println();
+ System.out.println(">>> Linear regression over sparse distributed matrix API usage example started.");
+ // Start ignite grid.
+ try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+ System.out.println(">>> Ignite grid started.");
+ // Create IgniteThread, we must work with SparseDistributedMatrix inside IgniteThread
+ // because we create ignite cache internally.
+ IgniteThread igniteThread = new IgniteThread(ignite.configuration().getIgniteInstanceName(), SparseDistributedMatrixExample.class.getSimpleName(), () -> {
+
+ double[] data = {
+ 8, 78, 284, 9.100000381, 109,
+ 9.300000191, 68, 433, 8.699999809, 144,
+ 7.5, 70, 739, 7.199999809, 113,
+ 8.899999619, 96, 1792, 8.899999619, 97,
+ 10.19999981, 74, 477, 8.300000191, 206,
+ 8.300000191, 111, 362, 10.89999962, 124,
+ 8.800000191, 77, 671, 10, 152,
+ 8.800000191, 168, 636, 9.100000381, 162,
+ 10.69999981, 82, 329, 8.699999809, 150,
+ 11.69999981, 89, 634, 7.599999905, 134,
+ 8.5, 149, 631, 10.80000019, 292,
+ 8.300000191, 60, 257, 9.5, 108,
+ 8.199999809, 96, 284, 8.800000191, 111,
+ 7.900000095, 83, 603, 9.5, 182,
+ 10.30000019, 130, 686, 8.699999809, 129,
+ 7.400000095, 145, 345, 11.19999981, 158,
+ 9.600000381, 112, 1357, 9.699999809, 186,
+ 9.300000191, 131, 544, 9.600000381, 177,
+ 10.60000038, 80, 205, 9.100000381, 127,
+ 9.699999809, 130, 1264, 9.199999809, 179,
+ 11.60000038, 140, 688, 8.300000191, 80,
+ 8.100000381, 154, 354, 8.399999619, 103,
+ 9.800000191, 118, 1632, 9.399999619, 101,
+ 7.400000095, 94, 348, 9.800000191, 117,
+ 9.399999619, 119, 370, 10.39999962, 88,
+ 11.19999981, 153, 648, 9.899999619, 78,
+ 9.100000381, 116, 366, 9.199999809, 102,
+ 10.5, 97, 540, 10.30000019, 95,
+ 11.89999962, 176, 680, 8.899999619, 80,
+ 8.399999619, 75, 345, 9.600000381, 92,
+ 5, 134, 525, 10.30000019, 126,
+ 9.800000191, 161, 870, 10.39999962, 108,
+ 9.800000191, 111, 669, 9.699999809, 77,
+ 10.80000019, 114, 452, 9.600000381, 60,
+ 10.10000038, 142, 430, 10.69999981, 71,
+ 10.89999962, 238, 822, 10.30000019, 86,
+ 9.199999809, 78, 190, 10.69999981, 93,
+ 8.300000191, 196, 867, 9.600000381, 106,
+ 7.300000191, 125, 969, 10.5, 162,
+ 9.399999619, 82, 499, 7.699999809, 95,
+ 9.399999619, 125, 925, 10.19999981, 91,
+ 9.800000191, 129, 353, 9.899999619, 52,
+ 3.599999905, 84, 288, 8.399999619, 110,
+ 8.399999619, 183, 718, 10.39999962, 69,
+ 10.80000019, 119, 540, 9.199999809, 57,
+ 10.10000038, 180, 668, 13, 106,
+ 9, 82, 347, 8.800000191, 40,
+ 10, 71, 345, 9.199999809, 50,
+ 11.30000019, 118, 463, 7.800000191, 35,
+ 11.30000019, 121, 728, 8.199999809, 86,
+ 12.80000019, 68, 383, 7.400000095, 57,
+ 10, 112, 316, 10.39999962, 57,
+ 6.699999809, 109, 388, 8.899999619, 94
+ };
+
+ final int nobs = 53;
+ final int nvars = 4;
+
+ System.out.println(">>> Create new SparseDistributedMatrix inside IgniteThread.");
+ // Create SparseDistributedMatrix, new cache will be created automagically.
+ SparseDistributedMatrix distributedMatrix = new SparseDistributedMatrix(0, 0,
+ StorageConstants.ROW_STORAGE_MODE, StorageConstants.RANDOM_ACCESS_MODE);
+
+ System.out.println(">>> Create new linear regression object");
+ OLSMultipleLinearRegression regression = new OLSMultipleLinearRegression();
+ regression.newSampleData(data, nobs, nvars, distributedMatrix);
+ System.out.println();
+
+ System.out.println(">>> Estimates the regression parameters b:");
+ System.out.println(Arrays.toString(regression.estimateRegressionParameters()));
+
+ System.out.println(">>> Estimates the residuals, ie u = y - X*b:");
+ System.out.println(Arrays.toString(regression.estimateResiduals()));
+
+ System.out.println(">>> Standard errors of the regression parameters:");
+ System.out.println(Arrays.toString(regression.estimateRegressionParametersStandardErrors()));
+
+ System.out.println(">>> Estimates the variance of the regression parameters, ie Var(b):");
+ Tracer.showAscii(regression.estimateRegressionParametersVariance());
+
+ System.out.println(">>> Estimates the standard error of the regression:");
+ System.out.println(regression.estimateRegressionStandardError());
+
+ System.out.println(">>> R-Squared statistic:");
+ System.out.println(regression.calculateRSquared());
+
+ System.out.println(">>> Adjusted R-squared statistic:");
+ System.out.println(regression.calculateAdjustedRSquared());
+
+ System.out.println(">>> Returns the variance of the regressand, ie Var(y):");
+ System.out.println(regression.estimateErrorVariance());
+ });
+
+ igniteThread.start();
+
+ igniteThread.join();
+ }
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/5743c3b0/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
index 9277ae4..a06b773 100644
--- 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
@@ -24,6 +24,7 @@ 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.matrix.SparseDistributedMatrix;
import org.apache.ignite.ml.math.impls.vector.DenseLocalOnHeapVector;
/**
@@ -116,6 +117,6 @@ public class MatrixUtil {
/** */
private static boolean isCopyLikeSupport(Matrix matrix) {
return matrix instanceof RandomMatrix || matrix instanceof MatrixView || matrix instanceof CacheMatrix ||
- matrix instanceof PivotedMatrixView;
+ matrix instanceof PivotedMatrixView || matrix instanceof SparseDistributedMatrix;
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/5743c3b0/modules/ml/src/test/java/org/apache/ignite/ml/IgniteMLTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/IgniteMLTestSuite.java b/modules/ml/src/test/java/org/apache/ignite/ml/IgniteMLTestSuite.java
new file mode 100644
index 0000000..92aa7db
--- /dev/null
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/IgniteMLTestSuite.java
@@ -0,0 +1,35 @@
+/*
+ * 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 org.apache.ignite.ml.math.MathImplMainTestSuite;
+import org.apache.ignite.ml.regressions.RegressionsTestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Test suite for all module tests.
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ MathImplMainTestSuite.class,
+ RegressionsTestSuite.class
+})
+public class IgniteMLTestSuite {
+ // No-op.
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/5743c3b0/modules/ml/src/test/java/org/apache/ignite/ml/math/MathImplDistributedTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/math/MathImplDistributedTestSuite.java b/modules/ml/src/test/java/org/apache/ignite/ml/math/MathImplDistributedTestSuite.java
index 720a090..9899d3b 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/math/MathImplDistributedTestSuite.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/math/MathImplDistributedTestSuite.java
@@ -25,7 +25,7 @@ import org.junit.runner.RunWith;
import org.junit.runners.Suite;
/**
- * Test suite for all distributed tests located in org.apache.ignite.math.impls.* package.
+ * Test suite for all distributed tests located in org.apache.ignite.ml.math.impls.* package.
*/
@RunWith(Suite.class)
@Suite.SuiteClasses({
http://git-wip-us.apache.org/repos/asf/ignite/blob/5743c3b0/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 9137bed..216fd7b 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,12 +59,11 @@ 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;
/**
- * Test suite for all local tests located in org.apache.ignite.math.impls.* package.
+ * Test suite for all local tests located in org.apache.ignite.ml.math.impls.* package.
*/
@RunWith(Suite.class)
@Suite.SuiteClasses({
@@ -117,9 +116,7 @@ import org.junit.runners.Suite;
EigenDecompositionTest.class,
CholeskyDecompositionTest.class,
QRDecompositionTest.class,
- SingularValueDecompositionTest.class,
- // Regressions.
- OLSMultipleLinearRegressionTest.class
+ SingularValueDecompositionTest.class
})
public class MathImplLocalTestSuite {
// No-op.
http://git-wip-us.apache.org/repos/asf/ignite/blob/5743c3b0/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 8d6d2af..4d245b4 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,7 +21,7 @@ import org.junit.runner.RunWith;
import org.junit.runners.Suite;
/**
- * Test suite for local and distributed tests.
+ * Test suite for local and distributed math tests.
*/
@RunWith(Suite.class)
@Suite.SuiteClasses({
http://git-wip-us.apache.org/repos/asf/ignite/blob/5743c3b0/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
index 8180c55..e992163 100644
--- 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
@@ -809,4 +809,11 @@ public class OLSMultipleLinearRegressionTest extends AbstractMultipleLinearRegre
OLSMultipleLinearRegression mdl = new OLSMultipleLinearRegression();
mdl.calculateTotalSumOfSquares();
}
+
+ /** */
+ @Test(expected = MathIllegalArgumentException.class)
+ public void testMathIllegalArgumentException(){
+ OLSMultipleLinearRegression mdl = new OLSMultipleLinearRegression();
+ mdl.validateSampleData(new DenseLocalOnHeapMatrix(1, 2), new DenseLocalOnHeapVector(1));
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/5743c3b0/modules/ml/src/test/java/org/apache/ignite/ml/regressions/RegressionsTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/regressions/RegressionsTestSuite.java b/modules/ml/src/test/java/org/apache/ignite/ml/regressions/RegressionsTestSuite.java
new file mode 100644
index 0000000..a54a4e3
--- /dev/null
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/regressions/RegressionsTestSuite.java
@@ -0,0 +1,32 @@
+/*
+ * 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.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Test suite for all tests located in org.apache.ignite.ml.regressions.* package.
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ OLSMultipleLinearRegressionTest.class
+})
+public class RegressionsTestSuite {
+ // No-op.
+}
[3/5] ignite git commit: GridCacheConcurrentMap: renamed size ->
internalSize.
Posted by sb...@apache.org.
GridCacheConcurrentMap: renamed size -> internalSize.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/86622cf7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/86622cf7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/86622cf7
Branch: refs/heads/ignite-5075-cacheStart
Commit: 86622cf79fd2a5f80b5194d3c32d456c0bd808a2
Parents: 330d9ef
Author: sboikov <sb...@gridgain.com>
Authored: Mon May 15 13:47:02 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon May 15 13:47:02 2017 +0300
----------------------------------------------------------------------
.../ignite/internal/processors/cache/GridCacheConcurrentMap.java | 2 +-
.../internal/processors/cache/GridCacheConcurrentMapImpl.java | 2 +-
.../ignite/internal/processors/cache/GridNoStorageCacheMap.java | 2 +-
.../cache/distributed/dht/GridCachePartitionedConcurrentMap.java | 4 ++--
.../processors/cache/distributed/dht/GridDhtLocalPartition.java | 4 ++--
.../cache/distributed/dht/GridDhtPartitionTopologyImpl.java | 2 +-
.../ignite/internal/processors/cache/GridCacheLeakTest.java | 4 ++--
.../internal/processors/cache/eviction/EvictionAbstractTest.java | 2 +-
.../cache/expiry/IgniteCacheClientNearCacheExpiryTest.java | 2 +-
9 files changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/86622cf7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java
index eb3f28e..9f20d64 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java
@@ -63,7 +63,7 @@ public interface GridCacheConcurrentMap {
*
* @return the number of key-value mappings in this map.
*/
- public int size();
+ public int internalSize();
/**
* Returns the number of publicly available key-value mappings in this map.
http://git-wip-us.apache.org/repos/asf/ignite/blob/86622cf7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapImpl.java
index 45b455c..b02a2b7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapImpl.java
@@ -287,7 +287,7 @@ public abstract class GridCacheConcurrentMapImpl implements GridCacheConcurrentM
}
/** {@inheritDoc} */
- @Override public int size() {
+ @Override public int internalSize() {
return map.size();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/86622cf7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridNoStorageCacheMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridNoStorageCacheMap.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridNoStorageCacheMap.java
index 86a573b..5e52c8b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridNoStorageCacheMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridNoStorageCacheMap.java
@@ -61,7 +61,7 @@ public class GridNoStorageCacheMap implements GridCacheConcurrentMap {
}
/** {@inheritDoc} */
- @Override public int size() {
+ @Override public int internalSize() {
return 0;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/86622cf7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedConcurrentMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedConcurrentMap.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedConcurrentMap.java
index dcc2d8b..76c7a15 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedConcurrentMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedConcurrentMap.java
@@ -99,11 +99,11 @@ public class GridCachePartitionedConcurrentMap implements GridCacheConcurrentMap
}
/** {@inheritDoc} */
- @Override public int size() {
+ @Override public int internalSize() {
int size = 0;
for (GridDhtLocalPartition part : ctx.topology().currentLocalPartitions())
- size += part.size();
+ size += part.internalSize();
return size;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/86622cf7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
index 4208a98..6fb557a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
@@ -236,9 +236,9 @@ public class GridDhtLocalPartition extends GridCacheConcurrentMapImpl implements
*/
public boolean isEmpty() {
if (cctx.allowFastEviction())
- return size() == 0;
+ return internalSize() == 0;
- return store.size() == 0 && size() == 0;
+ return store.size() == 0 && internalSize() == 0;
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/86622cf7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
index 38cbb8c..4e699b3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
@@ -238,7 +238,7 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
", cache=" + cctx.name() +
", part=" + part.id() +
", partState=" + part.state() +
- ", size=" + part.size() +
+ ", size=" + part.internalSize() +
", reservations=" + part.reservations() +
", grpReservations=" + part.groupReserved() +
", node=" + cctx.localNodeId() + "]");
http://git-wip-us.apache.org/repos/asf/ignite/blob/86622cf7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLeakTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLeakTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLeakTest.java
index b1202a1..a13ad64 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLeakTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLeakTest.java
@@ -127,10 +127,10 @@ public class GridCacheLeakTest extends GridCommonAbstractTest {
for (int g = 0; g < 3; g++) {
GridCacheConcurrentMap map = ((IgniteKernal)grid(g)).internalCache(CACHE_NAME).map();
- info("Map size for cache [g=" + g + ", size=" + map.size() +
+ info("Map size for cache [g=" + g + ", size=" + map.internalSize() +
", pubSize=" + map.publicSize() + ']');
- assertTrue("Wrong map size: " + map.size(), map.size() <= 8192);
+ assertTrue("Wrong map size: " + map.internalSize(), map.internalSize() <= 8192);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/86622cf7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/EvictionAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/EvictionAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/EvictionAbstractTest.java
index 7fb40a3..ba70232 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/EvictionAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/EvictionAbstractTest.java
@@ -780,7 +780,7 @@ public abstract class EvictionAbstractTest<T extends EvictionPolicy<?, ?>>
if (plcMax > 0) {
for (int i = 0; i < gridCnt; i++) {
- int actual = colocated(i).map().size();
+ int actual = colocated(i).map().internalSize();
assertTrue("Cache size is greater then policy size [expected=" + endSize + ", actual=" + actual + ']',
actual <= endSize + (plcMaxMemSize > 0 ? 1 : plcBatchSize));
http://git-wip-us.apache.org/repos/asf/ignite/blob/86622cf7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheClientNearCacheExpiryTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheClientNearCacheExpiryTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheClientNearCacheExpiryTest.java
index 3acdf9f..f7164a0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheClientNearCacheExpiryTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheClientNearCacheExpiryTest.java
@@ -113,7 +113,7 @@ public class IgniteCacheClientNearCacheExpiryTest extends IgniteCacheAbstractTes
GridCacheAdapter.class,
"map");
- assertEquals(KEYS_COUNT, map.size());
+ assertEquals(KEYS_COUNT, map.publicSize());
assertEquals(KEYS_COUNT, cache.size());
[4/5] 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/feda3ff5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/feda3ff5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/feda3ff5
Branch: refs/heads/ignite-5075-cacheStart
Commit: feda3ff524d57d94633ad9e90adaa6788d6b5259
Parents: 86622cf 5743c3b
Author: sboikov <sb...@gridgain.com>
Authored: Mon May 15 13:47:33 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon May 15 13:47:33 2017 +0300
----------------------------------------------------------------------
.../DistributedRegressionExample.java | 149 +++++++++++++++++++
.../apache/ignite/ml/math/util/MatrixUtil.java | 3 +-
.../org/apache/ignite/ml/IgniteMLTestSuite.java | 35 +++++
.../ml/math/MathImplDistributedTestSuite.java | 2 +-
.../ignite/ml/math/MathImplLocalTestSuite.java | 7 +-
.../ignite/ml/math/MathImplMainTestSuite.java | 2 +-
.../OLSMultipleLinearRegressionTest.java | 7 +
.../ml/regressions/RegressionsTestSuite.java | 32 ++++
.../Binary/BinarySelfTest.cs | 26 ++++
.../Impl/Binary/BinaryReflectiveActions.cs | 6 +-
.../BinaryReflectiveSerializerInternal.cs | 9 +-
.../Impl/Binary/BinaryUtils.cs | 9 --
.../Binary/DeserializationCallbackProcessor.cs | 11 ++
.../Impl/Binary/SerializableSerializer.cs | 10 +-
14 files changed, 278 insertions(+), 30 deletions(-)
----------------------------------------------------------------------
[5/5] ignite git commit: Merge remote-tracking branch
'remotes/origin/master' into ignite-5075-cacheStart
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into ignite-5075-cacheStart
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f9aa769a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f9aa769a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f9aa769a
Branch: refs/heads/ignite-5075-cacheStart
Commit: f9aa769ad1d769a91849d50e9c12be0154092889
Parents: f5a5fa0 feda3ff
Author: sboikov <sb...@gridgain.com>
Authored: Mon May 15 13:48:36 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon May 15 13:48:36 2017 +0300
----------------------------------------------------------------------
.../DistributedRegressionExample.java | 149 +++++++++++++++++++
.../cache/GridCacheConcurrentMap.java | 2 +-
.../cache/GridCacheConcurrentMapImpl.java | 2 +-
.../processors/cache/GridNoStorageCacheMap.java | 2 +-
.../dht/GridCachePartitionedConcurrentMap.java | 4 +-
.../distributed/dht/GridDhtLocalPartition.java | 4 +-
.../dht/GridDhtPartitionTopologyImpl.java | 2 +-
.../processors/cache/GridCacheLeakTest.java | 4 +-
.../cache/eviction/EvictionAbstractTest.java | 2 +-
.../IgniteCacheClientNearCacheExpiryTest.java | 2 +-
.../apache/ignite/ml/math/util/MatrixUtil.java | 3 +-
.../org/apache/ignite/ml/IgniteMLTestSuite.java | 35 +++++
.../ml/math/MathImplDistributedTestSuite.java | 2 +-
.../ignite/ml/math/MathImplLocalTestSuite.java | 7 +-
.../ignite/ml/math/MathImplMainTestSuite.java | 2 +-
.../OLSMultipleLinearRegressionTest.java | 7 +
.../ml/regressions/RegressionsTestSuite.java | 32 ++++
.../Binary/BinarySelfTest.cs | 26 ++++
.../Impl/Binary/BinaryReflectiveActions.cs | 6 +-
.../BinaryReflectiveSerializerInternal.cs | 9 +-
.../Impl/Binary/BinaryUtils.cs | 9 --
.../Binary/DeserializationCallbackProcessor.cs | 11 ++
.../Impl/Binary/SerializableSerializer.cs | 10 +-
23 files changed, 290 insertions(+), 42 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f9aa769a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
----------------------------------------------------------------------