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
commit f038787f3887787f32d0d8a52aa1856ad14a7e00 Author: Matthias Boehm <[email protected]> AuthorDate: Thu Oct 26 11:39:24 2023 +0200 [MINOR] Fix warnings and code quality issues --- src/main/java/org/apache/sysds/hops/FunctionOp.java | 2 -- .../org/apache/sysds/hops/ipa/InterProceduralAnalysis.java | 2 -- .../java/org/apache/sysds/hops/rewrite/ProgramRewriter.java | 2 -- src/main/java/org/apache/sysds/parser/DMLProgram.java | 1 - .../java/org/apache/sysds/parser/ParForStatementBlock.java | 2 -- .../java/org/apache/sysds/runtime/frame/data/FrameBlock.java | 5 ----- .../sysds/runtime/frame/data/lib/FrameFromMatrixBlock.java | 1 - .../runtime/instructions/gpu/context/GPUContextPool.java | 1 - .../org/apache/sysds/runtime/lineage/LineageCacheConfig.java | 2 ++ .../org/apache/sysds/runtime/lineage/LineageCacheEntry.java | 2 +- .../org/apache/sysds/runtime/matrix/data/LibMatrixMult.java | 1 - .../org/apache/sysds/performance/micro/InformationLoss.java | 4 ++-- .../apache/sysds/test/component/frame/FrameCustomTest.java | 6 +++--- .../sysds/test/component/frame/array/CustomArrayTests.java | 4 ++-- .../sysds/test/component/frame/array/FrameArrayTests.java | 12 ++++++------ .../sysds/test/component/frame/array/NegativeArrayTests.java | 8 ++++---- .../frame/transform/TransformCompressedTestSingleCol.java | 1 - .../functions/compress/matrixByBin/CompressByBinTest.java | 7 ++++--- .../functions/pipelines/BuiltinImageTransformLinTest.java | 1 - 19 files changed, 24 insertions(+), 40 deletions(-) diff --git a/src/main/java/org/apache/sysds/hops/FunctionOp.java b/src/main/java/org/apache/sysds/hops/FunctionOp.java index e5e66f2ccf..45f21e975b 100644 --- a/src/main/java/org/apache/sysds/hops/FunctionOp.java +++ b/src/main/java/org/apache/sysds/hops/FunctionOp.java @@ -25,8 +25,6 @@ import java.util.List; import org.apache.sysds.api.DMLScript; import org.apache.sysds.lops.Compression; -import org.apache.sysds.lops.Data; -import org.apache.sysds.lops.DeCompression; import org.apache.sysds.lops.FunctionCallCP; import org.apache.sysds.lops.Lop; import org.apache.sysds.common.Types.ExecType; diff --git a/src/main/java/org/apache/sysds/hops/ipa/InterProceduralAnalysis.java b/src/main/java/org/apache/sysds/hops/ipa/InterProceduralAnalysis.java index d7a3fc7f8c..d0ea21a8aa 100644 --- a/src/main/java/org/apache/sysds/hops/ipa/InterProceduralAnalysis.java +++ b/src/main/java/org/apache/sysds/hops/ipa/InterProceduralAnalysis.java @@ -21,8 +21,6 @@ package org.apache.sysds.hops.ipa; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.log4j.Level; -import org.apache.log4j.Logger; import org.apache.sysds.common.Types.DataType; import org.apache.sysds.common.Types.ValueType; import org.apache.sysds.conf.ConfigurationManager; diff --git a/src/main/java/org/apache/sysds/hops/rewrite/ProgramRewriter.java b/src/main/java/org/apache/sysds/hops/rewrite/ProgramRewriter.java index 21c70a6850..1754b72b5e 100644 --- a/src/main/java/org/apache/sysds/hops/rewrite/ProgramRewriter.java +++ b/src/main/java/org/apache/sysds/hops/rewrite/ProgramRewriter.java @@ -22,8 +22,6 @@ package org.apache.sysds.hops.rewrite; import java.util.ArrayList; import java.util.List; -import org.apache.log4j.Level; -import org.apache.log4j.Logger; import org.apache.sysds.api.DMLScript; import org.apache.sysds.conf.ConfigurationManager; import org.apache.sysds.conf.CompilerConfig.ConfigType; diff --git a/src/main/java/org/apache/sysds/parser/DMLProgram.java b/src/main/java/org/apache/sysds/parser/DMLProgram.java index 5b5b5be60f..99de236651 100644 --- a/src/main/java/org/apache/sysds/parser/DMLProgram.java +++ b/src/main/java/org/apache/sysds/parser/DMLProgram.java @@ -20,7 +20,6 @@ package org.apache.sysds.parser; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; diff --git a/src/main/java/org/apache/sysds/parser/ParForStatementBlock.java b/src/main/java/org/apache/sysds/parser/ParForStatementBlock.java index 5ed91adbd3..8856ee07b2 100644 --- a/src/main/java/org/apache/sysds/parser/ParForStatementBlock.java +++ b/src/main/java/org/apache/sysds/parser/ParForStatementBlock.java @@ -35,8 +35,6 @@ import org.apache.sysds.hops.OptimizerUtils; import org.apache.sysds.hops.rewrite.HopRewriteUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.log4j.Level; -import org.apache.log4j.Logger; import org.apache.sysds.common.Builtins; import org.apache.sysds.common.Types.DataType; import org.apache.sysds.common.Types.OpOp1; diff --git a/src/main/java/org/apache/sysds/runtime/frame/data/FrameBlock.java b/src/main/java/org/apache/sysds/runtime/frame/data/FrameBlock.java index 456fc9afc7..3efafbb30b 100644 --- a/src/main/java/org/apache/sysds/runtime/frame/data/FrameBlock.java +++ b/src/main/java/org/apache/sysds/runtime/frame/data/FrameBlock.java @@ -24,9 +24,7 @@ import java.io.DataOutput; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; -import java.io.ObjectInputStream; import java.io.ObjectOutput; -import java.io.ObjectOutputStream; import java.io.Serializable; import java.lang.ref.SoftReference; import java.lang.reflect.InvocationTargetException; @@ -71,7 +69,6 @@ import org.apache.sysds.runtime.instructions.cp.IntObject; import org.apache.sysds.runtime.instructions.cp.ScalarObject; import org.apache.sysds.runtime.io.IOUtilFunctions; import org.apache.sysds.runtime.matrix.data.MatrixBlock; -import org.apache.sysds.runtime.matrix.data.MatrixBlockDataInput; import org.apache.sysds.runtime.matrix.data.Pair; import org.apache.sysds.runtime.matrix.operators.BinaryOperator; import org.apache.sysds.runtime.meta.DataCharacteristics; @@ -79,8 +76,6 @@ import org.apache.sysds.runtime.meta.MatrixCharacteristics; import org.apache.sysds.runtime.util.CommonThreadPool; import org.apache.sysds.runtime.util.DMVUtils; import org.apache.sysds.runtime.util.EMAUtils; -import org.apache.sysds.runtime.util.FastBufferedDataInputStream; -import org.apache.sysds.runtime.util.FastBufferedDataOutputStream; import org.apache.sysds.runtime.util.IndexRange; import org.apache.sysds.runtime.util.UtilFunctions; import org.apache.sysds.utils.MemoryEstimates; diff --git a/src/main/java/org/apache/sysds/runtime/frame/data/lib/FrameFromMatrixBlock.java b/src/main/java/org/apache/sysds/runtime/frame/data/lib/FrameFromMatrixBlock.java index 7e75c621a5..eeac27e2e1 100644 --- a/src/main/java/org/apache/sysds/runtime/frame/data/lib/FrameFromMatrixBlock.java +++ b/src/main/java/org/apache/sysds/runtime/frame/data/lib/FrameFromMatrixBlock.java @@ -20,7 +20,6 @@ package org.apache.sysds.runtime.frame.data.lib; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; diff --git a/src/main/java/org/apache/sysds/runtime/instructions/gpu/context/GPUContextPool.java b/src/main/java/org/apache/sysds/runtime/instructions/gpu/context/GPUContextPool.java index aa9bb8563a..049f4923b6 100644 --- a/src/main/java/org/apache/sysds/runtime/instructions/gpu/context/GPUContextPool.java +++ b/src/main/java/org/apache/sysds/runtime/instructions/gpu/context/GPUContextPool.java @@ -30,7 +30,6 @@ import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.sysds.runtime.DMLRuntimeException; -import org.apache.sysds.runtime.lineage.LineageGPUCacheEviction; import org.apache.sysds.utils.GPUStatistics; import jcuda.driver.JCudaDriver; diff --git a/src/main/java/org/apache/sysds/runtime/lineage/LineageCacheConfig.java b/src/main/java/org/apache/sysds/runtime/lineage/LineageCacheConfig.java index 67eeed9481..5df5302c97 100644 --- a/src/main/java/org/apache/sysds/runtime/lineage/LineageCacheConfig.java +++ b/src/main/java/org/apache/sysds/runtime/lineage/LineageCacheConfig.java @@ -100,7 +100,9 @@ public class LineageCacheConfig protected static final double CPU_CACHE_FRAC = 0.05; // 5% of JVM heap size private static ReuseCacheType _cacheType = null; + @SuppressWarnings("unused") private static CachedItemHead _itemH = null; + @SuppressWarnings("unused") private static CachedItemTail _itemT = null; private static boolean _compilerAssistedRW = false; private static boolean _onlyEstimate = false; diff --git a/src/main/java/org/apache/sysds/runtime/lineage/LineageCacheEntry.java b/src/main/java/org/apache/sysds/runtime/lineage/LineageCacheEntry.java index e019f9810d..3bf53cbeea 100644 --- a/src/main/java/org/apache/sysds/runtime/lineage/LineageCacheEntry.java +++ b/src/main/java/org/apache/sysds/runtime/lineage/LineageCacheEntry.java @@ -355,7 +355,7 @@ public class LineageCacheEntry { if (_timestamp < 0) throw new DMLRuntimeException ("Execution timestamp shouldn't be -ve. Key: "+_key); // Weights for scoring components in GPU - double w1 = 0; + //double w1 = 0; double w2 = 1; double w3 = 1; // Generate initial score diff --git a/src/main/java/org/apache/sysds/runtime/matrix/data/LibMatrixMult.java b/src/main/java/org/apache/sysds/runtime/matrix/data/LibMatrixMult.java index abf6621a78..711197352a 100644 --- a/src/main/java/org/apache/sysds/runtime/matrix/data/LibMatrixMult.java +++ b/src/main/java/org/apache/sysds/runtime/matrix/data/LibMatrixMult.java @@ -49,7 +49,6 @@ import org.apache.sysds.runtime.data.SparseBlock.Type; import org.apache.sysds.runtime.data.SparseBlockCSR; import org.apache.sysds.runtime.data.SparseBlockFactory; import org.apache.sysds.runtime.data.SparseBlockMCSR; -import org.apache.sysds.runtime.data.SparseRow; import org.apache.sysds.runtime.data.SparseRowScalar; import org.apache.sysds.runtime.functionobjects.SwapIndex; import org.apache.sysds.runtime.functionobjects.ValueFunction; diff --git a/src/test/java/org/apache/sysds/performance/micro/InformationLoss.java b/src/test/java/org/apache/sysds/performance/micro/InformationLoss.java index 88fd767e76..68dbdb21ce 100644 --- a/src/test/java/org/apache/sysds/performance/micro/InformationLoss.java +++ b/src/test/java/org/apache/sysds/performance/micro/InformationLoss.java @@ -113,8 +113,8 @@ public class InformationLoss { private static Pair<MatrixBlock, MatrixBlock> getMinMax(final MatrixBlock org) throws Exception { ExecutorService pool = CommonThreadPool.get(16); - Future<MatrixBlock> minF = pool.submit(() -> (MatrixBlock) org.colMin(16)); - Future<MatrixBlock> maxF = pool.submit(() -> (MatrixBlock) org.colMax(16)); + Future<MatrixBlock> minF = pool.submit(() -> org.colMin(16)); + Future<MatrixBlock> maxF = pool.submit(() -> org.colMax(16)); MatrixBlock min = minF.get(); MatrixBlock max = maxF.get(); diff --git a/src/test/java/org/apache/sysds/test/component/frame/FrameCustomTest.java b/src/test/java/org/apache/sysds/test/component/frame/FrameCustomTest.java index f5fbfd8588..9d6c7aa482 100644 --- a/src/test/java/org/apache/sysds/test/component/frame/FrameCustomTest.java +++ b/src/test/java/org/apache/sysds/test/component/frame/FrameCustomTest.java @@ -32,7 +32,7 @@ public class FrameCustomTest { @Test public void castToFrame() { - double maxp1 = ((double) Integer.MAX_VALUE) + 1.0; + double maxp1 = Integer.MAX_VALUE + 1.0; MatrixBlock mb = TestUtils.generateTestMatrixBlock(100, 100, maxp1, maxp1, 1.0, 23); FrameBlock f = DataConverter.convertToFrameBlock(mb); assertTrue(f.getSchema()[0] == ValueType.INT64); @@ -40,7 +40,7 @@ public class FrameCustomTest { @Test public void castToFrame3() { - double maxp1 = ((double) Integer.MAX_VALUE) - 1.0; + double maxp1 = Integer.MAX_VALUE - 1.0; MatrixBlock mb = TestUtils.generateTestMatrixBlock(100, 100, maxp1, maxp1, 1.0, 23); FrameBlock f = DataConverter.convertToFrameBlock(mb); assertTrue(f.getSchema()[0] == ValueType.INT32); @@ -56,7 +56,7 @@ public class FrameCustomTest { @Test public void castToFrame2() { - double maxp1 = ((double) Integer.MAX_VALUE) + 1.1111; + double maxp1 = Integer.MAX_VALUE + 1.1111; MatrixBlock mb = TestUtils.generateTestMatrixBlock(100, 100, maxp1, maxp1, 1.0, 23); FrameBlock f = DataConverter.convertToFrameBlock(mb); assertTrue(f.getSchema()[0] == ValueType.FP64); diff --git a/src/test/java/org/apache/sysds/test/component/frame/array/CustomArrayTests.java b/src/test/java/org/apache/sysds/test/component/frame/array/CustomArrayTests.java index 94a5810bf4..90c41db1a4 100644 --- a/src/test/java/org/apache/sysds/test/component/frame/array/CustomArrayTests.java +++ b/src/test/java/org/apache/sysds/test/component/frame/array/CustomArrayTests.java @@ -857,7 +857,7 @@ public class CustomArrayTests { public void testDDCIn() { try { Array<Long> a = null; - Array<Long> b = new DDCArray<Long>(new LongArray(new long[] {1, 2, 3, 4}), // + Array<Long> b = new DDCArray<>(new LongArray(new long[] {1, 2, 3, 4}), // MapToFactory.create(10, new int[] {0, 0, 0, 0, 1, 1, 1, 2, 2, 3, 3}, 4)); Array<Long> c = ArrayFactory.set(a, b, 10, 19, 20); assertEquals((long) c.get(0), 0L); @@ -873,7 +873,7 @@ public class CustomArrayTests { public void testDDCInOptional() { try { Array<Long> a = null; - Array<Long> b = new DDCArray<Long>(new OptionalArray<Long>(new Long[] {1L, 2L, 3L, 4L}), // + Array<Long> b = new DDCArray<>(new OptionalArray<>(new Long[] {1L, 2L, 3L, 4L}), // MapToFactory.create(10, new int[] {0, 0, 0, 0, 1, 1, 1, 2, 2, 3, 3}, 4)); Array<Long> c = ArrayFactory.set(a, b, 10, 19, 20); assertEquals(c.get(0), null); diff --git a/src/test/java/org/apache/sysds/test/component/frame/array/FrameArrayTests.java b/src/test/java/org/apache/sysds/test/component/frame/array/FrameArrayTests.java index 71211ab52c..165f1327b2 100644 --- a/src/test/java/org/apache/sysds/test/component/frame/array/FrameArrayTests.java +++ b/src/test/java/org/apache/sysds/test/component/frame/array/FrameArrayTests.java @@ -309,10 +309,10 @@ public class FrameArrayTests { switch(a.getValueType()) { case BOOLEAN: - assertFalse(a.equals((Object) ArrayFactory.create(new char[] {'a', 'b'}))); + assertFalse(a.equals(ArrayFactory.create(new char[] {'a', 'b'}))); break; default: - assertFalse(a.equals((Object) ArrayFactory.create(new boolean[] {true, false}))); + assertFalse(a.equals(ArrayFactory.create(new boolean[] {true, false}))); } } catch(Exception e) { @@ -324,7 +324,7 @@ public class FrameArrayTests { @Test public void equalsSelf() { try { - assertTrue(a.equals((Object) a)); + assertTrue(a.equals(a)); } catch(Exception e) { e.printStackTrace(); @@ -335,7 +335,7 @@ public class FrameArrayTests { @Test public void equalsClone() { try { - assertTrue(a.equals((Object) a.clone())); + assertTrue(a.equals(a.clone())); } catch(Exception e) { e.printStackTrace(); @@ -358,7 +358,7 @@ public class FrameArrayTests { public void sameValueTypeNotEquals() { try { Array<?> b = ArrayFactory.allocate(a.getValueType(), a.size() == 1 ? 2 : 1); - assertFalse(a.equals((Object) b)); + assertFalse(a.equals(b)); } catch(Exception e) { e.printStackTrace(); @@ -386,7 +386,7 @@ public class FrameArrayTests { ArrayFactory.set(t, ddc, 0, 29, t.size()); switch(t.getValueType()) { case BOOLEAN: - assertEquals(t.get(0), (Boolean) false); + assertEquals(t.get(0), false); break; default: diff --git a/src/test/java/org/apache/sysds/test/component/frame/array/NegativeArrayTests.java b/src/test/java/org/apache/sysds/test/component/frame/array/NegativeArrayTests.java index dd471e3159..105785ebc9 100644 --- a/src/test/java/org/apache/sysds/test/component/frame/array/NegativeArrayTests.java +++ b/src/test/java/org/apache/sysds/test/component/frame/array/NegativeArrayTests.java @@ -294,7 +294,7 @@ public class NegativeArrayTests { @Test(expected = DMLRuntimeException.class) public void testInvalidRLen() { Array<Long> a = null; - Array<Long> b = new OptionalArray<Long>(new Long[] {1L, 2L, 3L, 4L}); + Array<Long> b = new OptionalArray<>(new Long[] {1L, 2L, 3L, 4L}); ArrayFactory.set(a, b, 10, 20, 20); } @@ -308,21 +308,21 @@ public class NegativeArrayTests { @Test(expected = DMLRuntimeException.class) public void testInvalidBLength() { Array<Long> a = null; - Array<Long> b = new OptionalArray<Long>(new Long[] {1L, 2L, 3L, 4L}); + Array<Long> b = new OptionalArray<>(new Long[] {1L, 2L, 3L, 4L}); ArrayFactory.set(a, b, 10, 15, 20);// one to short } @Test(expected = DMLRuntimeException.class) public void testInvalidALength() { Array<?> a = ArrayFactory.allocate( ValueType.INT32, 10); - Array<Long> b = new OptionalArray<Long>(new Long[] {1L, 2L, 3L, 4L}); + Array<Long> b = new OptionalArray<>(new Long[] {1L, 2L, 3L, 4L}); ArrayFactory.set(a, b, 10, 14, 20);// one to short } @Test(expected = DMLRuntimeException.class) public void testInvalidRL() { Array<?> a = ArrayFactory.allocate( ValueType.INT32, 10); - Array<Long> b = new OptionalArray<Long>(new Long[] {1L, 2L, 3L, 4L}); + Array<Long> b = new OptionalArray<>(new Long[] {1L, 2L, 3L, 4L}); ArrayFactory.set(a, b, -1, 15, 20);// one to short } } diff --git a/src/test/java/org/apache/sysds/test/component/frame/transform/TransformCompressedTestSingleCol.java b/src/test/java/org/apache/sysds/test/component/frame/transform/TransformCompressedTestSingleCol.java index 14a552c993..3a5d05919e 100644 --- a/src/test/java/org/apache/sysds/test/component/frame/transform/TransformCompressedTestSingleCol.java +++ b/src/test/java/org/apache/sysds/test/component/frame/transform/TransformCompressedTestSingleCol.java @@ -147,7 +147,6 @@ public class TransformCompressedTestSingleCol { data.getNumColumns(), meta); MatrixBlock outNormal = encoderNormal.encode(data, k); - meta = null; MultiColumnEncoder encoderCompressed = EncoderFactory.createEncoder(spec, data.getColumnNames(), data.getNumColumns(), meta); MatrixBlock outCompressed = encoderCompressed.encode(data, k, true); diff --git a/src/test/java/org/apache/sysds/test/functions/compress/matrixByBin/CompressByBinTest.java b/src/test/java/org/apache/sysds/test/functions/compress/matrixByBin/CompressByBinTest.java index 8265b261d2..1fe40002c2 100644 --- a/src/test/java/org/apache/sysds/test/functions/compress/matrixByBin/CompressByBinTest.java +++ b/src/test/java/org/apache/sysds/test/functions/compress/matrixByBin/CompressByBinTest.java @@ -52,7 +52,7 @@ public class CompressByBinTest extends AutomatedTestBase { private final static int nbins = 10; - private final static int[] dVector = new int[cols]; + //private final static int[] dVector = new int[cols]; @Override public void setUp() { @@ -146,7 +146,7 @@ public class CompressByBinTest extends AutomatedTestBase { // Create one column for(int i = 0, j = 0; i < rows; i++) { X[i][c] = vals[j]; - if(i == (int) ((j + 1) * (rows / nbins))) + if(i == ((j + 1) * (rows / nbins))) j++; } } @@ -156,6 +156,7 @@ public class CompressByBinTest extends AutomatedTestBase { return X; } + @SuppressWarnings("unchecked") private FrameBlock generateFrameData(ColumnEncoderBin.BinMethod binMethod, Types.ValueType[] schema) { FrameBlock Xf; if(binMethod == ColumnEncoderBin.BinMethod.EQUI_WIDTH) { @@ -173,7 +174,7 @@ public class CompressByBinTest extends AutomatedTestBase { Array<Float> f = (Array<Float>) ArrayFactory.allocate(Types.ValueType.FP32, rows); for(int i = 0, j = 0; i < rows; i++) { f.set(i, vals[j]); - if(i == (int) ((j + 1) * (rows / nbins))) + if(i == ((j + 1) * (rows / nbins))) j++; } Xf.appendColumn(f); diff --git a/src/test/java/org/apache/sysds/test/functions/pipelines/BuiltinImageTransformLinTest.java b/src/test/java/org/apache/sysds/test/functions/pipelines/BuiltinImageTransformLinTest.java index e240b8e6fa..8448af7262 100644 --- a/src/test/java/org/apache/sysds/test/functions/pipelines/BuiltinImageTransformLinTest.java +++ b/src/test/java/org/apache/sysds/test/functions/pipelines/BuiltinImageTransformLinTest.java @@ -24,7 +24,6 @@ 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.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized;
