This is an automated email from the ASF dual-hosted git repository.

mboehm7 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/systemds.git


The following commit(s) were added to refs/heads/main by this push:
     new 8110994  [MINOR] Fix warnings, formatting, tests (imports, 
serializable, tabs)
8110994 is described below

commit 8110994b5c49d482452aa0f83c0398af33483a9a
Author: Matthias Boehm <mboe...@gmail.com>
AuthorDate: Thu Dec 16 20:42:53 2021 +0100

    [MINOR] Fix warnings, formatting, tests (imports, serializable, tabs)
---
 .../compress/colgroup/AMorphingMMColGroup.java     |   1 +
 .../runtime/compress/colgroup/ColGroupFactory.java |   2 +-
 .../compress/colgroup/mapping/AMapToData.java      |   2 +-
 .../runtime/compress/colgroup/offset/AOffset.java  |   1 +
 .../compress/mapping/MappingPreAggregateTests.java |   1 +
 .../setoperations/BuiltinIntersectionTest.java     |   8 -
 .../builtin/setoperations/BuiltinSetDiffTest.java  |  12 +-
 .../BuiltinSymmetricDifferenceTest.java            |  12 +-
 .../builtin/setoperations/BuiltinUnionTest.java    |  19 +-
 .../setoperations/SetOperationsTestBase.java       | 274 ++++++++++-----------
 10 files changed, 158 insertions(+), 174 deletions(-)

diff --git 
a/src/main/java/org/apache/sysds/runtime/compress/colgroup/AMorphingMMColGroup.java
 
b/src/main/java/org/apache/sysds/runtime/compress/colgroup/AMorphingMMColGroup.java
index 26c055d..fbc6b2c 100644
--- 
a/src/main/java/org/apache/sysds/runtime/compress/colgroup/AMorphingMMColGroup.java
+++ 
b/src/main/java/org/apache/sysds/runtime/compress/colgroup/AMorphingMMColGroup.java
@@ -30,6 +30,7 @@ import org.apache.sysds.runtime.matrix.data.MatrixBlock;
  * reasons but instead transforms into another type of column group type to 
perform that operation.
  */
 public abstract class AMorphingMMColGroup extends AColGroupValue {
+       private static final long serialVersionUID = -4265713396790607199L;
 
        /**
         * Constructor for serialization
diff --git 
a/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupFactory.java 
b/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupFactory.java
index 74b5c1e..7cd2b1a 100644
--- 
a/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupFactory.java
+++ 
b/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupFactory.java
@@ -484,7 +484,7 @@ public class ColGroupFactory {
 
                @Override
                public Boolean call() {
-                       return new Boolean(readToMapDDC(_colIndexes, _raw, 
_map, _cs, _data, _rl, _ru, _fill));
+                       return Boolean.valueOf(readToMapDDC(_colIndexes, _raw, 
_map, _cs, _data, _rl, _ru, _fill));
                }
        }
 
diff --git 
a/src/main/java/org/apache/sysds/runtime/compress/colgroup/mapping/AMapToData.java
 
b/src/main/java/org/apache/sysds/runtime/compress/colgroup/mapping/AMapToData.java
index d430d48..a6d048b 100644
--- 
a/src/main/java/org/apache/sysds/runtime/compress/colgroup/mapping/AMapToData.java
+++ 
b/src/main/java/org/apache/sysds/runtime/compress/colgroup/mapping/AMapToData.java
@@ -40,7 +40,7 @@ import org.apache.sysds.runtime.matrix.data.MatrixBlock;
  * - SDC use this in collaboration with the offsets to only point to 
dictionary entries for non default values.
  */
 public abstract class AMapToData implements Serializable {
-
+       private static final long serialVersionUID = 1208906071822976041L;
        protected static final Log LOG = 
LogFactory.getLog(AMapToData.class.getName());
 
        /** Number of unique values inside this map. */
diff --git 
a/src/main/java/org/apache/sysds/runtime/compress/colgroup/offset/AOffset.java 
b/src/main/java/org/apache/sysds/runtime/compress/colgroup/offset/AOffset.java
index a884e4d..112fbb1 100644
--- 
a/src/main/java/org/apache/sysds/runtime/compress/colgroup/offset/AOffset.java
+++ 
b/src/main/java/org/apache/sysds/runtime/compress/colgroup/offset/AOffset.java
@@ -40,6 +40,7 @@ import org.apache.sysds.runtime.matrix.data.MatrixBlock;
  * represented size.
  */
 public abstract class AOffset implements Serializable {
+       private static final long serialVersionUID = 6910025321078561338L;
 
        protected static final Log LOG = 
LogFactory.getLog(AOffset.class.getName());
 
diff --git 
a/src/test/java/org/apache/sysds/test/component/compress/mapping/MappingPreAggregateTests.java
 
b/src/test/java/org/apache/sysds/test/component/compress/mapping/MappingPreAggregateTests.java
index 9f7ccd2..27dc8f8 100644
--- 
a/src/test/java/org/apache/sysds/test/component/compress/mapping/MappingPreAggregateTests.java
+++ 
b/src/test/java/org/apache/sysds/test/component/compress/mapping/MappingPreAggregateTests.java
@@ -320,6 +320,7 @@ public class MappingPreAggregateTests {
        }
 
        private static class OneOffset extends OffsetByte {
+               private static final long serialVersionUID = 
1910028460503867232L;
 
                private OneOffset(byte[] offsets, int offsetToFirst, int 
offsetToLast) {
                        super(offsets, offsetToFirst, offsetToLast);
diff --git 
a/src/test/java/org/apache/sysds/test/functions/builtin/setoperations/BuiltinIntersectionTest.java
 
b/src/test/java/org/apache/sysds/test/functions/builtin/setoperations/BuiltinIntersectionTest.java
index a78bc5f..10bafa3 100644
--- 
a/src/test/java/org/apache/sysds/test/functions/builtin/setoperations/BuiltinIntersectionTest.java
+++ 
b/src/test/java/org/apache/sysds/test/functions/builtin/setoperations/BuiltinIntersectionTest.java
@@ -19,15 +19,7 @@
 
 package org.apache.sysds.test.functions.builtin.setoperations;
 
-import org.junit.Test;
 import org.apache.sysds.common.Types;
-import org.apache.sysds.common.Types.ExecType;
-import org.apache.sysds.runtime.matrix.data.MatrixValue.CellIndex;
-import org.apache.sysds.test.AutomatedTestBase;
-import org.apache.sysds.test.TestConfiguration;
-import org.apache.sysds.test.TestUtils;
-
-import java.util.HashMap;
 
 public class BuiltinIntersectionTest extends SetOperationsTestBase
 {
diff --git 
a/src/test/java/org/apache/sysds/test/functions/builtin/setoperations/BuiltinSetDiffTest.java
 
b/src/test/java/org/apache/sysds/test/functions/builtin/setoperations/BuiltinSetDiffTest.java
index 62a4787..4d0eddb 100644
--- 
a/src/test/java/org/apache/sysds/test/functions/builtin/setoperations/BuiltinSetDiffTest.java
+++ 
b/src/test/java/org/apache/sysds/test/functions/builtin/setoperations/BuiltinSetDiffTest.java
@@ -26,11 +26,11 @@ import org.junit.runners.Parameterized;
 
 @RunWith(Parameterized.class)
 public class BuiltinSetDiffTest extends SetOperationsTestBase {
-    private final static String TEST_NAME = "setdiff";
-    private final static String TEST_DIR = "functions/builtin/";
-    private static final String TEST_CLASS_DIR = TEST_DIR + 
BuiltinSetDiffTest.class.getSimpleName() + "/";
+       private final static String TEST_NAME = "setdiff";
+       private final static String TEST_DIR = "functions/builtin/";
+       private static final String TEST_CLASS_DIR = TEST_DIR + 
BuiltinSetDiffTest.class.getSimpleName() + "/";
 
-    public BuiltinSetDiffTest(Types.ExecType execType){
-        super(TEST_NAME, TEST_DIR, TEST_CLASS_DIR, execType);
-    }
+       public BuiltinSetDiffTest(Types.ExecType execType){
+               super(TEST_NAME, TEST_DIR, TEST_CLASS_DIR, execType);
+       }
 }
\ No newline at end of file
diff --git 
a/src/test/java/org/apache/sysds/test/functions/builtin/setoperations/BuiltinSymmetricDifferenceTest.java
 
b/src/test/java/org/apache/sysds/test/functions/builtin/setoperations/BuiltinSymmetricDifferenceTest.java
index 09afad2..fec4b08 100644
--- 
a/src/test/java/org/apache/sysds/test/functions/builtin/setoperations/BuiltinSymmetricDifferenceTest.java
+++ 
b/src/test/java/org/apache/sysds/test/functions/builtin/setoperations/BuiltinSymmetricDifferenceTest.java
@@ -22,11 +22,11 @@ package 
org.apache.sysds.test.functions.builtin.setoperations;
 import org.apache.sysds.common.Types;
 
 public class BuiltinSymmetricDifferenceTest extends SetOperationsTestBase {
-    private final static String TEST_NAME = "symmetricDifference";
-    private final static String TEST_DIR = "functions/builtin/";
-    private static final String TEST_CLASS_DIR = TEST_DIR + 
BuiltinSymmetricDifferenceTest.class.getSimpleName() + "/";
+       private final static String TEST_NAME = "symmetricDifference";
+       private final static String TEST_DIR = "functions/builtin/";
+       private static final String TEST_CLASS_DIR = TEST_DIR + 
BuiltinSymmetricDifferenceTest.class.getSimpleName() + "/";
 
-    public BuiltinSymmetricDifferenceTest(Types.ExecType execType) {
-        super(TEST_NAME, TEST_DIR, TEST_CLASS_DIR, execType);
-    }
+       public BuiltinSymmetricDifferenceTest(Types.ExecType execType) {
+               super(TEST_NAME, TEST_DIR, TEST_CLASS_DIR, execType);
+       }
 }
diff --git 
a/src/test/java/org/apache/sysds/test/functions/builtin/setoperations/BuiltinUnionTest.java
 
b/src/test/java/org/apache/sysds/test/functions/builtin/setoperations/BuiltinUnionTest.java
index 8c5c02f..2092bb6 100644
--- 
a/src/test/java/org/apache/sysds/test/functions/builtin/setoperations/BuiltinUnionTest.java
+++ 
b/src/test/java/org/apache/sysds/test/functions/builtin/setoperations/BuiltinUnionTest.java
@@ -20,20 +20,13 @@
 package org.apache.sysds.test.functions.builtin.setoperations;
 
 import org.apache.sysds.common.Types;
-import org.apache.sysds.runtime.matrix.data.MatrixValue;
-import org.apache.sysds.test.AutomatedTestBase;
-import org.apache.sysds.test.TestConfiguration;
-import org.apache.sysds.test.TestUtils;
-import org.junit.Test;
-
-import java.util.HashMap;
 
 public class BuiltinUnionTest  extends SetOperationsTestBase {
-    private final static String TEST_NAME = "union";
-    private final static String TEST_DIR = "functions/builtin/";
-    private static final String TEST_CLASS_DIR = TEST_DIR + 
BuiltinUnionTest.class.getSimpleName() + "/";
+       private final static String TEST_NAME = "union";
+       private final static String TEST_DIR = "functions/builtin/";
+       private static final String TEST_CLASS_DIR = TEST_DIR + 
BuiltinUnionTest.class.getSimpleName() + "/";
 
-    public BuiltinUnionTest(Types.ExecType execType) {
-        super(TEST_NAME, TEST_DIR, TEST_CLASS_DIR, execType);
-    }
+       public BuiltinUnionTest(Types.ExecType execType) {
+               super(TEST_NAME, TEST_DIR, TEST_CLASS_DIR, execType);
+       }
 }
\ No newline at end of file
diff --git 
a/src/test/java/org/apache/sysds/test/functions/builtin/setoperations/SetOperationsTestBase.java
 
b/src/test/java/org/apache/sysds/test/functions/builtin/setoperations/SetOperationsTestBase.java
index 3aedd39..3c42aa2 100644
--- 
a/src/test/java/org/apache/sysds/test/functions/builtin/setoperations/SetOperationsTestBase.java
+++ 
b/src/test/java/org/apache/sysds/test/functions/builtin/setoperations/SetOperationsTestBase.java
@@ -20,6 +20,7 @@
 package org.apache.sysds.test.functions.builtin.setoperations;
 
 import org.apache.sysds.common.Types;
+import org.apache.sysds.common.Types.ExecType;
 import org.apache.sysds.runtime.matrix.data.MatrixValue;
 import org.apache.sysds.test.AutomatedTestBase;
 import org.apache.sysds.test.TestConfiguration;
@@ -32,144 +33,139 @@ import org.junit.runners.Parameterized;
 import java.util.*;
 
 @RunWith(Parameterized.class)
+@net.jcip.annotations.NotThreadSafe
 public abstract class SetOperationsTestBase extends AutomatedTestBase {
-    private final String TEST_NAME;
-    private final String TEST_DIR ;
-    private final String TEST_CLASS_DIR;
-
-    private final Types.ExecType execType;
-
-    public SetOperationsTestBase(String test_name, String test_dir, String 
test_class_dir, Types.ExecType execType){
-        TEST_NAME = test_name;
-        TEST_DIR = test_dir;
-        TEST_CLASS_DIR = test_class_dir;
-
-        this.execType = execType;
-    }
-
-    @Parameterized.Parameters
-    public static Collection<Object[]> types(){
-        return Arrays.asList(new Object[][]{
-                {Types.ExecType.CP},
-                {Types.ExecType.SPARK}
-        });
-    }
-
-    @Override
-    public void setUp() {
-        TestUtils.clearAssertionInformation();
-        addTestConfiguration(TEST_NAME, new TestConfiguration(TEST_CLASS_DIR, 
TEST_NAME, new String[]{"R"}));
-    }
-
-    @Test
-    public void testPosNumbersAscending() {
-        double[][] X = {{1}, {2}, {3}};
-        double[][] Y = {{2}, {3}, {4}};
-
-        runUnitTest(X, Y, execType);
-    }
-
-    @Test
-    public void testPosNumbersRandomOrder() {
-        double[][] X = {{9}, {2}, {3}};
-        double[][] Y = {{2}, {3}, {4}};
-
-        runUnitTest(X, Y, execType);
-    }
-
-    @Test
-    public void testComplexPosNumbers() {
-        double[][] X =  {{12},{22},{13},{4},{6},{7},{8},{9},{12},{12}};
-        double[][] Y = {{1},{2},{11},{12},{13},{18},{20},{21},{12}};
-        runUnitTest(X, Y, execType);
-    }
-
-    @Test
-    public void testNegNumbers() {
-        double[][] X = {{-10},{-5},{2}};
-        double[][] Y = {{2},{-3}};
-        runUnitTest(X, Y, execType);
-    }
-
-    @Test
-    public void testFloatingPNumbers() {
-        double[][] X = {{2},{2.5},{4}};
-        double[][] Y = {{2.4},{2}};
-        runUnitTest(X, Y, execType);
-    }
-
-    @Test
-    public void testNegAndFloating() {
-        double[][] X =  {{1.4}, {-1.3}, {10}, {4}};
-        double[][] Y = {{1.3},{-1.4},{10},{9}};
-        runUnitTest(X, Y, execType);
-    }
-
-    @Test
-    public void testMinValue() {
-        double[][] X =  {{Double.MIN_VALUE}, {2},{4}};
-        double[][] Y = {{2},{15}};
-        runUnitTest(X, Y, execType);
-    }
-
-    @Test
-    public void testCombined() {
-        double[][] X =  {{Double.MIN_VALUE}, {4}, {-1.3}, {10}, {4}};
-        double[][] Y = {{Double.MIN_VALUE},{15},{-1.2},{-25.3}};
-        runUnitTest(X, Y, execType);
-    }
-
-    @Test
-    public void testYSuperSetOfX() {
-        double[][] X = TestUtils.seq(2, 200, 4);
-        double[][] Y = TestUtils.seq(2, 200, 2);
-        runUnitTest(X, Y, execType);
-    }
-
-    @Test
-    public void testXSuperSetOfY() {
-        double[][] X = TestUtils.seq(2, 200, 2);
-        double[][] Y = TestUtils.seq(2, 200, 4);
-        runUnitTest(X, Y, execType);
-    }
-
-    private void runUnitTest(double[][] X, double[][]Y, Types.ExecType 
instType) {
-        Types.ExecMode platformOld = setExecMode(instType);
-        try {
-            loadTestConfiguration(getTestConfiguration(TEST_NAME));
-            String HOME = SCRIPT_DIR + TEST_DIR;
-            fullDMLScriptName = HOME + TEST_NAME + ".dml";
-            programArgs = new String[]{ "-args", input("X"),input("Y"), 
output("R")};
-            fullRScriptName = HOME + TEST_NAME + ".R";
-            rCmd = "Rscript" + " " + fullRScriptName + " " + inputDir() + " " 
+ expectedDir();
-
-            writeInputMatrixWithMTD("X", X, true);
-            writeInputMatrixWithMTD("Y", Y, true);
-
-            runTest(true, false, null, -1);
-            runRScript(true);
-
-            HashMap<MatrixValue.CellIndex, Double> dmlfile = 
readDMLMatrixFromOutputDir("R");
-            HashMap<MatrixValue.CellIndex, Double> rfile  = 
readRMatrixFromExpectedDir("R");
-
-
-
-            ArrayList<Double> dml_values = new ArrayList<>(dmlfile.values());
-            ArrayList<Double> r_values = new ArrayList<>(rfile.values());
-            Collections.sort(dml_values);
-            Collections.sort(r_values);
-
-            Assert.assertEquals(dml_values.size(), r_values.size());
-            Assert.assertEquals(dml_values, r_values);
-
-
-            //Junit way collection equal ignore order.
-            //Assert.assertTrue(dml_values.size() == r_values.size() && 
dml_values.containsAll(r_values) && r_values.containsAll(dml_values));
-        }
-        finally {
-            rtplatform = platformOld;
-        }
-    }
-
-
+       private final String TEST_NAME;
+       private final String TEST_DIR ;
+       private final String TEST_CLASS_DIR;
+
+       private final ExecType _execType;
+
+       public SetOperationsTestBase(String test_name, String test_dir, String 
test_class_dir, Types.ExecType execType){
+               TEST_NAME = test_name;
+               TEST_DIR = test_dir;
+               TEST_CLASS_DIR = test_class_dir;
+               _execType = execType;
+       }
+
+       @Parameterized.Parameters
+       public static Collection<Object[]> types(){
+               return Arrays.asList(new Object[][]{
+                               {Types.ExecType.CP},
+                               {Types.ExecType.SPARK}
+               });
+       }
+
+       @Override
+       public void setUp() {
+               TestUtils.clearAssertionInformation();
+               addTestConfiguration(TEST_NAME, new 
TestConfiguration(TEST_CLASS_DIR, TEST_NAME, new String[]{"R"}));
+       }
+
+       @Test
+       public void testPosNumbersAscending() {
+               double[][] X = {{1}, {2}, {3}};
+               double[][] Y = {{2}, {3}, {4}};
+
+               runUnitTest(X, Y, _execType);
+       }
+
+       @Test
+       public void testPosNumbersRandomOrder() {
+               double[][] X = {{9}, {2}, {3}};
+               double[][] Y = {{2}, {3}, {4}};
+
+               runUnitTest(X, Y, _execType);
+       }
+
+       @Test
+       public void testComplexPosNumbers() {
+               double[][] X =  {{12},{22},{13},{4},{6},{7},{8},{9},{12},{12}};
+               double[][] Y = {{1},{2},{11},{12},{13},{18},{20},{21},{12}};
+               runUnitTest(X, Y, _execType);
+       }
+
+       @Test
+       public void testNegNumbers() {
+               double[][] X = {{-10},{-5},{2}};
+               double[][] Y = {{2},{-3}};
+               runUnitTest(X, Y, _execType);
+       }
+
+       @Test
+       public void testFloatingPNumbers() {
+               double[][] X = {{2},{2.5},{4}};
+               double[][] Y = {{2.4},{2}};
+               runUnitTest(X, Y, _execType);
+       }
+
+       @Test
+       public void testNegAndFloating() {
+               double[][] X =  {{1.4}, {-1.3}, {10}, {4}};
+               double[][] Y = {{1.3},{-1.4},{10},{9}};
+               runUnitTest(X, Y, _execType);
+       }
+
+       @Test
+       public void testMinValue() {
+               double[][] X =  {{Double.MIN_VALUE}, {2},{4}};
+               double[][] Y = {{2},{15}};
+               runUnitTest(X, Y, _execType);
+       }
+
+       @Test
+       public void testCombined() {
+               double[][] X =  {{Double.MIN_VALUE}, {4}, {-1.3}, {10}, {4}};
+               double[][] Y = {{Double.MIN_VALUE},{15},{-1.2},{-25.3}};
+               runUnitTest(X, Y, _execType);
+       }
+
+       @Test
+       public void testYSuperSetOfX() {
+               double[][] X = TestUtils.seq(2, 200, 4);
+               double[][] Y = TestUtils.seq(2, 200, 2);
+               runUnitTest(X, Y, _execType);
+       }
+
+       @Test
+       public void testXSuperSetOfY() {
+               double[][] X = TestUtils.seq(2, 200, 2);
+               double[][] Y = TestUtils.seq(2, 200, 4);
+               runUnitTest(X, Y, _execType);
+       }
+
+       private void runUnitTest(double[][] X, double[][]Y, Types.ExecType 
instType) {
+               Types.ExecMode platformOld = setExecMode(instType);
+               try {
+                       loadTestConfiguration(getTestConfiguration(TEST_NAME));
+                       String HOME = SCRIPT_DIR + TEST_DIR;
+                       fullDMLScriptName = HOME + TEST_NAME + ".dml";
+                       programArgs = new String[]{ "-args", 
input("X"),input("Y"), output("R")};
+                       fullRScriptName = HOME + TEST_NAME + ".R";
+                       rCmd = "Rscript" + " " + fullRScriptName + " " + 
inputDir() + " " + expectedDir();
+
+                       writeInputMatrixWithMTD("X", X, true);
+                       writeInputMatrixWithMTD("Y", Y, true);
+
+                       runTest(true, false, null, -1);
+                       runRScript(true);
+
+                       HashMap<MatrixValue.CellIndex, Double> dmlfile = 
readDMLMatrixFromOutputDir("R");
+                       HashMap<MatrixValue.CellIndex, Double> rfile  = 
readRMatrixFromExpectedDir("R");
+
+                       ArrayList<Double> dml_values = new 
ArrayList<>(dmlfile.values());
+                       ArrayList<Double> r_values = new 
ArrayList<>(rfile.values());
+                       Collections.sort(dml_values);
+                       Collections.sort(r_values);
+
+                       Assert.assertEquals(dml_values.size(), r_values.size());
+                       Assert.assertEquals(dml_values, r_values);
+
+                       //Junit way collection equal ignore order.
+                       //Assert.assertTrue(dml_values.size() == 
r_values.size() && dml_values.containsAll(r_values) && 
r_values.containsAll(dml_values));
+               }
+               finally {
+                       rtplatform = platformOld;
+               }
+       }
 }

Reply via email to