This is an automated email from the ASF dual-hosted git repository. baunsgaard pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/systemds.git
commit a3ea6c13e89a26e319038294e585cef27365606c Author: baunsgaard <[email protected]> AuthorDate: Fri Sep 16 13:13:35 2022 +0200 [SYSTEMDS-2699] CLA IO Compressed Matrices This commit cleans up the IO interface of the Column groups to remove the option of creating ColumnGroups from the serialization constructors, that provide the opportunity to construct the column groups wrongly. With this change opportunities for exploiting the non empty structure of all column groups is closer, and the change make the IO and Serialization of column groups one step closer. --- .../sysds/runtime/compress/colgroup/AColGroup.java | 27 ++---- .../compress/colgroup/AColGroupCompressed.java | 4 - .../runtime/compress/colgroup/AColGroupOffset.java | 34 +++---- .../runtime/compress/colgroup/AColGroupValue.java | 4 - .../compress/colgroup/ADictBasedColGroup.java | 12 --- .../compress/colgroup/AMorphingMMColGroup.java | 7 -- .../sysds/runtime/compress/colgroup/APreAgg.java | 8 -- .../sysds/runtime/compress/colgroup/ASDC.java | 19 +--- .../sysds/runtime/compress/colgroup/ASDCZero.java | 5 - .../runtime/compress/colgroup/ColGroupConst.java | 15 ++- .../runtime/compress/colgroup/ColGroupDDC.java | 15 ++- .../runtime/compress/colgroup/ColGroupDDCFOR.java | 23 ++--- .../compress/colgroup/ColGroupDeltaDDC.java | 101 ++++++++++----------- .../runtime/compress/colgroup/ColGroupEmpty.java | 12 ++- .../runtime/compress/colgroup/ColGroupIO.java | 57 ++++++------ .../colgroup/ColGroupLinearFunctional.java | 20 ++-- .../runtime/compress/colgroup/ColGroupOLE.java | 21 +++-- .../runtime/compress/colgroup/ColGroupRLE.java | 20 ++-- .../runtime/compress/colgroup/ColGroupSDC.java | 30 ++---- .../runtime/compress/colgroup/ColGroupSDCFOR.java | 27 ++---- .../compress/colgroup/ColGroupSDCSingle.java | 23 ++--- .../compress/colgroup/ColGroupSDCSingleZeros.java | 21 ++--- .../compress/colgroup/ColGroupSDCZeros.java | 21 ++--- .../compress/colgroup/ColGroupUncompressed.java | 15 +-- .../ColGroupMorphingPerformanceCompare.java | 5 - 25 files changed, 208 insertions(+), 338 deletions(-) diff --git a/src/main/java/org/apache/sysds/runtime/compress/colgroup/AColGroup.java b/src/main/java/org/apache/sysds/runtime/compress/colgroup/AColGroup.java index b9ba6a5df4..ffee7563b7 100644 --- a/src/main/java/org/apache/sysds/runtime/compress/colgroup/AColGroup.java +++ b/src/main/java/org/apache/sysds/runtime/compress/colgroup/AColGroup.java @@ -68,10 +68,6 @@ public abstract class AColGroup implements Serializable { /** The ColGroup Indexes contained in the ColGroup */ protected int[] _colIndexes; - /** Empty constructor, used for serializing into an empty new object of ColGroup. */ - protected AColGroup() { - // empty - } /** * Main constructor. @@ -174,18 +170,12 @@ public abstract class AColGroup implements Serializable { out.writeInt(_colIndexes[i]); } - /** - * Deserialize column group from data input. - * - * @param in data input - * @throws IOException if IOException occurs - */ - protected void readFields(DataInput in) throws IOException { - // column group type is read in ColGroupIO + protected static int[] readCols(DataInput in) throws IOException { final int numCols = in.readInt(); - _colIndexes = new int[numCols]; + int[] cols = new int[numCols]; for(int i = 0; i < numCols; i++) - _colIndexes[i] = in.readInt(); + cols[i] = in.readInt(); + return cols; } /** @@ -358,7 +348,7 @@ public abstract class AColGroup implements Serializable { * @param right The MatrixBlock on the right of this matrix multiplication * @return The new Column Group or null that is the result of the matrix multiplication. */ - public final AColGroup rightMultByMatrix(MatrixBlock right){ + public final AColGroup rightMultByMatrix(MatrixBlock right) { return rightMultByMatrix(right, null); } @@ -367,8 +357,9 @@ public abstract class AColGroup implements Serializable { * * This method can return null, meaning that the output overlapping group would have been empty. * - * @param right The MatrixBlock on the right of this matrix multiplication - * @param allCols A pre-materialized list of all col indexes, that can be shared across all column groups if use full, can be set to null. + * @param right The MatrixBlock on the right of this matrix multiplication + * @param allCols A pre-materialized list of all col indexes, that can be shared across all column groups if use + * full, can be set to null. * @return The new Column Group or null that is the result of the matrix multiplication. */ public abstract AColGroup rightMultByMatrix(MatrixBlock right, int[] allCols); @@ -406,7 +397,7 @@ public abstract class AColGroup implements Serializable { * @param lhs The left hand side Column group to multiply with, the left hand side should be considered * transposed. Also it should be guaranteed that this column group is not empty. * @param result The result matrix to insert the result of the multiplication into - * @param nRows Number of rows in the lhs colGroup + * @param nRows Number of rows in the lhs colGroup */ public abstract void leftMultByAColGroup(AColGroup lhs, MatrixBlock result, int nRows); diff --git a/src/main/java/org/apache/sysds/runtime/compress/colgroup/AColGroupCompressed.java b/src/main/java/org/apache/sysds/runtime/compress/colgroup/AColGroupCompressed.java index 1af529c08a..75319e08eb 100644 --- a/src/main/java/org/apache/sysds/runtime/compress/colgroup/AColGroupCompressed.java +++ b/src/main/java/org/apache/sysds/runtime/compress/colgroup/AColGroupCompressed.java @@ -45,10 +45,6 @@ public abstract class AColGroupCompressed extends AColGroup { private static final long serialVersionUID = 6219835795420081223L; - protected AColGroupCompressed() { - super(); - } - protected AColGroupCompressed(int[] colIndices) { super(colIndices); } diff --git a/src/main/java/org/apache/sysds/runtime/compress/colgroup/AColGroupOffset.java b/src/main/java/org/apache/sysds/runtime/compress/colgroup/AColGroupOffset.java index 2e263df164..516caecab6 100644 --- a/src/main/java/org/apache/sysds/runtime/compress/colgroup/AColGroupOffset.java +++ b/src/main/java/org/apache/sysds/runtime/compress/colgroup/AColGroupOffset.java @@ -45,16 +45,6 @@ public abstract class AColGroupOffset extends APreAgg { protected boolean _zeros; - /** - * Constructor for serialization - * - * @param numRows Number of rows contained - */ - protected AColGroupOffset(int numRows) { - super(); - _numRows = numRows; - } - protected AColGroupOffset(int[] colIndices, int numRows, boolean zeros, ADictionary dict, int[] cachedCounts) { super(colIndices, dict, cachedCounts); _numRows = numRows; @@ -104,20 +94,18 @@ public abstract class AColGroupOffset extends APreAgg { return ret; } - @Override - public void readFields(DataInput in) throws IOException { - super.readFields(in); - - // read bitmaps - _ptr = new int[in.readInt()]; - for(int i = 0; i < _ptr.length; i++) - _ptr[i] = in.readInt(); - - _data = new char[in.readInt()]; - for(int i = 0; i < _data.length; i++) - _data[i] = in.readChar(); + public static int[] readPointers(DataInput in) throws IOException { + int[] ptr = new int[in.readInt()]; + for(int i = 0; i < ptr.length; i++) + ptr[i] = in.readInt(); + return ptr; + } - _zeros = in.readBoolean(); + public static char[] readData(DataInput in) throws IOException { + char[] data = new char[in.readInt()]; + for(int i = 0; i < data.length; i++) + data[i] = in.readChar(); + return data; } @Override diff --git a/src/main/java/org/apache/sysds/runtime/compress/colgroup/AColGroupValue.java b/src/main/java/org/apache/sysds/runtime/compress/colgroup/AColGroupValue.java index 615f0cc5e6..85b64783dc 100644 --- a/src/main/java/org/apache/sysds/runtime/compress/colgroup/AColGroupValue.java +++ b/src/main/java/org/apache/sysds/runtime/compress/colgroup/AColGroupValue.java @@ -37,10 +37,6 @@ public abstract class AColGroupValue extends ADictBasedColGroup implements Clone /** The count of each distinct value contained in the dictionary */ private SoftReference<int[]> counts = null; - protected AColGroupValue() { - super(); - } - /** * A abstract class for column groups that contain ADictionary for values. * diff --git a/src/main/java/org/apache/sysds/runtime/compress/colgroup/ADictBasedColGroup.java b/src/main/java/org/apache/sysds/runtime/compress/colgroup/ADictBasedColGroup.java index 467d6dac5d..8ce8b6731e 100644 --- a/src/main/java/org/apache/sysds/runtime/compress/colgroup/ADictBasedColGroup.java +++ b/src/main/java/org/apache/sysds/runtime/compress/colgroup/ADictBasedColGroup.java @@ -18,7 +18,6 @@ */ package org.apache.sysds.runtime.compress.colgroup; -import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import java.util.Arrays; @@ -27,7 +26,6 @@ import java.util.Set; import org.apache.sysds.runtime.compress.colgroup.dictionary.ADictionary; import org.apache.sysds.runtime.compress.colgroup.dictionary.Dictionary; -import org.apache.sysds.runtime.compress.colgroup.dictionary.DictionaryFactory; import org.apache.sysds.runtime.compress.colgroup.dictionary.MatrixBlockDictionary; import org.apache.sysds.runtime.compress.utils.Util; import org.apache.sysds.runtime.data.DenseBlock; @@ -39,10 +37,6 @@ public abstract class ADictBasedColGroup extends AColGroupCompressed { /** Distinct value tuples associated with individual bitmaps. */ protected ADictionary _dict; - protected ADictBasedColGroup() { - super(); - } - /** * A Abstract class for column groups that contain ADictionary for values. * @@ -143,12 +137,6 @@ public abstract class ADictBasedColGroup extends AColGroupCompressed { protected abstract void decompressToSparseBlockDenseDictionary(SparseBlock ret, int rl, int ru, int offR, int offC, double[] values); - @Override - public void readFields(DataInput in) throws IOException { - super.readFields(in); - _dict = DictionaryFactory.read(in); - } - @Override public void write(DataOutput out) throws IOException { super.write(out); 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 ff609fefce..6e4acd0466 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 @@ -35,13 +35,6 @@ import org.apache.sysds.runtime.matrix.data.MatrixBlock; public abstract class AMorphingMMColGroup extends AColGroupValue { private static final long serialVersionUID = -4265713396790607199L; - /** - * Constructor for serialization - */ - protected AMorphingMMColGroup() { - super(); - } - /** * A Abstract class for column groups that contain ADictionary for values. * diff --git a/src/main/java/org/apache/sysds/runtime/compress/colgroup/APreAgg.java b/src/main/java/org/apache/sysds/runtime/compress/colgroup/APreAgg.java index 41f0963e1e..ffe58023f8 100644 --- a/src/main/java/org/apache/sysds/runtime/compress/colgroup/APreAgg.java +++ b/src/main/java/org/apache/sysds/runtime/compress/colgroup/APreAgg.java @@ -39,14 +39,6 @@ public abstract class APreAgg extends AColGroupValue { private static boolean loggedWarningForDirect = false; - /** - * Constructor for serialization - * - */ - protected APreAgg() { - super(); - } - /** * A Abstract class for column groups that contain ADictionary for values. * diff --git a/src/main/java/org/apache/sysds/runtime/compress/colgroup/ASDC.java b/src/main/java/org/apache/sysds/runtime/compress/colgroup/ASDC.java index e598553b3e..91c4eb6f92 100644 --- a/src/main/java/org/apache/sysds/runtime/compress/colgroup/ASDC.java +++ b/src/main/java/org/apache/sysds/runtime/compress/colgroup/ASDC.java @@ -34,34 +34,23 @@ public abstract class ASDC extends AMorphingMMColGroup { /** Sparse row indexes for the data */ protected AOffset _indexes; - - final protected int _numRows; - /** - * Constructor for serialization - * - * @param numRows Number of rows contained - */ - protected ASDC(int numRows) { - super(); - _numRows = numRows; - } + final protected int _numRows; - protected ASDC(int[] colIndices, int numRows, ADictionary dict, AOffset offsets, - int[] cachedCounts) { + protected ASDC(int[] colIndices, int numRows, ADictionary dict, AOffset offsets, int[] cachedCounts) { super(colIndices, dict, cachedCounts); _indexes = offsets; _numRows = numRows; } - public int getNumRows(){ + public int getNumRows() { return _numRows; } public abstract double[] getDefaultTuple(); - public AOffset getOffsets(){ + public AOffset getOffsets() { return _indexes; } } diff --git a/src/main/java/org/apache/sysds/runtime/compress/colgroup/ASDCZero.java b/src/main/java/org/apache/sysds/runtime/compress/colgroup/ASDCZero.java index a0a1fd58e1..59786ddfcb 100644 --- a/src/main/java/org/apache/sysds/runtime/compress/colgroup/ASDCZero.java +++ b/src/main/java/org/apache/sysds/runtime/compress/colgroup/ASDCZero.java @@ -34,11 +34,6 @@ public abstract class ASDCZero extends APreAgg { protected AOffset _indexes; final protected int _numRows; - protected ASDCZero(int numRows) { - super(); - _numRows = numRows; - } - protected ASDCZero(int[] colIndices, int numRows, ADictionary dict, AOffset offsets, int[] cachedCounts) { super(colIndices, dict, cachedCounts); _indexes = offsets; diff --git a/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupConst.java b/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupConst.java index 57db52f158..c87b8ed4fe 100644 --- a/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupConst.java +++ b/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupConst.java @@ -19,9 +19,13 @@ package org.apache.sysds.runtime.compress.colgroup; +import java.io.DataInput; +import java.io.IOException; + import org.apache.sysds.runtime.compress.DMLCompressionException; import org.apache.sysds.runtime.compress.colgroup.dictionary.ADictionary; import org.apache.sysds.runtime.compress.colgroup.dictionary.Dictionary; +import org.apache.sysds.runtime.compress.colgroup.dictionary.DictionaryFactory; import org.apache.sysds.runtime.compress.colgroup.dictionary.MatrixBlockDictionary; import org.apache.sysds.runtime.compress.cost.ComputationCostEstimator; import org.apache.sysds.runtime.compress.lib.CLALibLeftMultBy; @@ -40,11 +44,6 @@ public class ColGroupConst extends ADictBasedColGroup { private static final long serialVersionUID = -7387793538322386611L; - /** Constructor for serialization */ - protected ColGroupConst() { - super(); - } - /** * Constructs an Constant Colum Group, that contains only one tuple, with the given value. * @@ -514,6 +513,12 @@ public class ColGroupConst extends ADictBasedColGroup { return null; } + public static ColGroupConst read(DataInput in) throws IOException { + int[] cols = readCols(in); + ADictionary dict = DictionaryFactory.read(in); + return new ColGroupConst(cols, dict); + } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupDDC.java b/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupDDC.java index 1321bafc0e..10dcc58eef 100644 --- a/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupDDC.java +++ b/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupDDC.java @@ -26,6 +26,7 @@ import java.io.IOException; import org.apache.commons.lang.NotImplementedException; import org.apache.sysds.runtime.compress.colgroup.dictionary.ADictionary; import org.apache.sysds.runtime.compress.colgroup.dictionary.Dictionary; +import org.apache.sysds.runtime.compress.colgroup.dictionary.DictionaryFactory; import org.apache.sysds.runtime.compress.colgroup.dictionary.MatrixBlockDictionary; import org.apache.sysds.runtime.compress.colgroup.mapping.AMapToData; import org.apache.sysds.runtime.compress.colgroup.mapping.MapToFactory; @@ -49,11 +50,6 @@ public class ColGroupDDC extends APreAgg { protected AMapToData _data; - /** Constructor for serialization */ - protected ColGroupDDC() { - super(); - } - private ColGroupDDC(int[] colIndexes, ADictionary dict, AMapToData data, int[] cachedCounts) { super(colIndexes, dict, cachedCounts); _data = data; @@ -427,10 +423,11 @@ public class ColGroupDDC extends APreAgg { _data.write(out); } - @Override - public void readFields(DataInput in) throws IOException { - super.readFields(in); - _data = MapToFactory.readIn(in); + public static ColGroupDDC read(DataInput in) throws IOException { + int[] cols = AColGroup.readCols(in); + ADictionary dict = DictionaryFactory.read(in); + AMapToData data = MapToFactory.readIn(in); + return new ColGroupDDC(cols, dict, data, null); } @Override diff --git a/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupDDCFOR.java b/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupDDCFOR.java index 9def9b075d..3d89d7626a 100644 --- a/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupDDCFOR.java +++ b/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupDDCFOR.java @@ -28,6 +28,7 @@ import org.apache.commons.lang.NotImplementedException; import org.apache.sysds.runtime.DMLRuntimeException; import org.apache.sysds.runtime.compress.DMLCompressionException; import org.apache.sysds.runtime.compress.colgroup.dictionary.ADictionary; +import org.apache.sysds.runtime.compress.colgroup.dictionary.DictionaryFactory; import org.apache.sysds.runtime.compress.colgroup.dictionary.MatrixBlockDictionary; import org.apache.sysds.runtime.compress.colgroup.mapping.AMapToData; import org.apache.sysds.runtime.compress.colgroup.mapping.MapToFactory; @@ -57,11 +58,6 @@ public class ColGroupDDCFOR extends AMorphingMMColGroup { /** Reference values in this column group */ protected double[] _reference; - /** Constructor for serialization */ - protected ColGroupDDCFOR() { - super(); - } - private ColGroupDDCFOR(int[] colIndexes, ADictionary dict, double[] reference, AMapToData data, int[] cachedCounts) { super(colIndexes, dict, cachedCounts); if(data.getUnique() != dict.getNumberOfValues(colIndexes.length)) @@ -91,10 +87,10 @@ public class ColGroupDDCFOR extends AMorphingMMColGroup { // It is assumed whoever call this does not use an empty Dictionary in g. final int nCol = g.getColIndices().length; final MatrixBlockDictionary mbd = g._dict.getMBDict(nCol); - if(mbd != null){ + if(mbd != null) { final MatrixBlock mb = mbd.getMatrixBlock(); - + final double[] ref = ColGroupUtils.extractMostCommonValueInColumns(mb); if(ref != null) { MatrixBlockDictionary mDict = mbd.binOpRight(new BinaryOperator(Minus.getMinusFnObject()), ref); @@ -217,13 +213,12 @@ public class ColGroupDDCFOR extends AMorphingMMColGroup { out.writeDouble(d); } - @Override - public void readFields(DataInput in) throws IOException { - super.readFields(in); - _data = MapToFactory.readIn(in); - _reference = new double[_colIndexes.length]; - for(int i = 0; i < _colIndexes.length; i++) - _reference[i] = in.readDouble(); + public static ColGroupDDCFOR read(DataInput in) throws IOException { + int[] cols = AColGroup.readCols(in); + ADictionary dict = DictionaryFactory.read(in); + AMapToData data = MapToFactory.readIn(in); + double[] ref = ColGroupIO.readDoubleArray(cols.length, in); + return new ColGroupDDCFOR(cols, dict, ref, data, null); } @Override diff --git a/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupDeltaDDC.java b/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupDeltaDDC.java index c26504ecfe..2ec72f7cca 100644 --- a/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupDeltaDDC.java +++ b/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupDeltaDDC.java @@ -19,69 +19,62 @@ package org.apache.sysds.runtime.compress.colgroup; -import org.apache.commons.lang.NotImplementedException; -import org.apache.sysds.runtime.compress.colgroup.dictionary.ADictionary; -import org.apache.sysds.runtime.compress.colgroup.mapping.AMapToData; -import org.apache.sysds.runtime.data.DenseBlock; -import org.apache.sysds.runtime.data.SparseBlock; -import org.apache.sysds.runtime.matrix.operators.ScalarOperator; - /** * Class to encapsulate information about a column group that is first delta encoded then encoded with dense dictionary * encoding (DeltaDDC). */ -public class ColGroupDeltaDDC extends ColGroupDDC { +// public class ColGroupDeltaDDC extends ColGroupDDC { - private static final long serialVersionUID = -1045556313148564147L; +// private static final long serialVersionUID = -1045556313148564147L; - /** Constructor for serialization */ - protected ColGroupDeltaDDC() { - } +// /** Constructor for serialization */ +// protected ColGroupDeltaDDC() { +// } - private ColGroupDeltaDDC(int[] colIndexes, ADictionary dict, AMapToData data, int[] cachedCounts) { - super(); - LOG.info("Carefully use of DeltaDDC since implementation is not finished."); - _colIndexes = colIndexes; - _dict = dict; - _data = data; - } +// private ColGroupDeltaDDC(int[] colIndexes, ADictionary dict, AMapToData data, int[] cachedCounts) { +// super(); +// LOG.info("Carefully use of DeltaDDC since implementation is not finished."); +// _colIndexes = colIndexes; +// _dict = dict; +// _data = data; +// } - public static AColGroup create(int[] colIndices, ADictionary dict, AMapToData data, int[] cachedCounts) { - if(dict == null) - throw new NotImplementedException("Not implemented constant delta group"); - else - return new ColGroupDeltaDDC(colIndices, dict, data, cachedCounts); - } +// public static AColGroup create(int[] colIndices, ADictionary dict, AMapToData data, int[] cachedCounts) { +// if(dict == null) +// throw new NotImplementedException("Not implemented constant delta group"); +// else +// return new ColGroupDeltaDDC(colIndices, dict, data, cachedCounts); +// } - public CompressionType getCompType() { - return CompressionType.DeltaDDC; - } +// public CompressionType getCompType() { +// return CompressionType.DeltaDDC; +// } - @Override - protected void decompressToDenseBlockDenseDictionary(DenseBlock db, int rl, int ru, int offR, int offC, - double[] values) { - final int nCol = _colIndexes.length; - for(int i = rl, offT = rl + offR; i < ru; i++, offT++) { - final double[] c = db.values(offT); - final int off = db.pos(offT) + offC; - final int rowIndex = _data.getIndex(i) * nCol; - final int prevOff = (off == 0) ? off : off - nCol; - for(int j = 0; j < nCol; j++) { - // Here we use the values in the previous row to compute current values along with the delta - double newValue = c[prevOff + j] + values[rowIndex + j]; - c[off + _colIndexes[j]] += newValue; - } - } - } +// @Override +// protected void decompressToDenseBlockDenseDictionary(DenseBlock db, int rl, int ru, int offR, int offC, +// double[] values) { +// final int nCol = _colIndexes.length; +// for(int i = rl, offT = rl + offR; i < ru; i++, offT++) { +// final double[] c = db.values(offT); +// final int off = db.pos(offT) + offC; +// final int rowIndex = _data.getIndex(i) * nCol; +// final int prevOff = (off == 0) ? off : off - nCol; +// for(int j = 0; j < nCol; j++) { +// // Here we use the values in the previous row to compute current values along with the delta +// double newValue = c[prevOff + j] + values[rowIndex + j]; +// c[off + _colIndexes[j]] += newValue; +// } +// } +// } - @Override - protected void decompressToSparseBlockDenseDictionary(SparseBlock ret, int rl, int ru, int offR, int offC, - double[] values) { - throw new NotImplementedException(); - } +// @Override +// protected void decompressToSparseBlockDenseDictionary(SparseBlock ret, int rl, int ru, int offR, int offC, +// double[] values) { +// throw new NotImplementedException(); +// } - @Override - public AColGroup scalarOperation(ScalarOperator op) { - return new ColGroupDeltaDDC(_colIndexes, _dict.applyScalarOp(op), _data, getCachedCounts()); - } -} +// @Override +// public AColGroup scalarOperation(ScalarOperator op) { +// return new ColGroupDeltaDDC(_colIndexes, _dict.applyScalarOp(op), _data, getCachedCounts()); +// } +// } diff --git a/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupEmpty.java b/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupEmpty.java index 2a427caea9..ce1c61dde4 100644 --- a/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupEmpty.java +++ b/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupEmpty.java @@ -19,6 +19,8 @@ package org.apache.sysds.runtime.compress.colgroup; +import java.io.DataInput; +import java.io.IOException; import java.util.Arrays; import org.apache.sysds.runtime.DMLRuntimeException; @@ -39,11 +41,6 @@ import org.apache.sysds.runtime.matrix.operators.UnaryOperator; public class ColGroupEmpty extends AColGroupCompressed { private static final long serialVersionUID = -2307677253622099958L; - /** Constructor for serialization */ - protected ColGroupEmpty() { - super(); - } - /** * Constructs an Constant Colum Group, that contains only one tuple, with the given value. * @@ -304,4 +301,9 @@ public class ColGroupEmpty extends AColGroupCompressed { public boolean isEmpty() { return true; } + + public static ColGroupEmpty read(DataInput in) throws IOException { + int[] cols = readCols(in); + return new ColGroupEmpty(cols); + } } diff --git a/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupIO.java b/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupIO.java index a15e36d2ee..f5a1fb2d80 100644 --- a/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupIO.java +++ b/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupIO.java @@ -48,20 +48,13 @@ public interface ColGroupIO { // Read in how many colGroups there are final int nColGroups = in.readInt(); - final boolean trace = LOG.isTraceEnabled(); // Allocate that amount into an ArrayList final List<AColGroup> _colGroups = new ArrayList<>(nColGroups); // Read each ColGroup one at a time. - for(int i = 0; i < nColGroups; i++) { - ColGroupType ctype = ColGroupType.values()[in.readByte()]; - if(trace) - LOG.trace("Reading in : " + ctype); - final AColGroup grp = constructColGroup(ctype, nRows); - grp.readFields(in); - _colGroups.add(grp); - } + for(int i = 0; i < nColGroups; i++) + _colGroups.add(readColGroup(in, nRows)); return _colGroups; } @@ -93,36 +86,44 @@ public interface ColGroupIO { return ret; } - private static AColGroup constructColGroup(ColGroupType ctype, int nRows) { + public static AColGroup readColGroup(DataInput in, int nRows) throws IOException { + final ColGroupType ctype = ColGroupType.values()[in.readByte()]; switch(ctype) { - case UNCOMPRESSED: - return new ColGroupUncompressed(); + case DDC: + return ColGroupDDC.read(in); + case DDCFOR: + return ColGroupDDCFOR.read(in); case OLE: - return new ColGroupOLE(nRows); + return ColGroupOLE.read(in, nRows); case RLE: - return new ColGroupRLE(nRows); - case DDC: - return new ColGroupDDC(); - case DeltaDDC: - return new ColGroupDeltaDDC(); + return ColGroupRLE.read(in, nRows); case CONST: - return new ColGroupConst(); + return ColGroupConst.read(in); case EMPTY: - return new ColGroupEmpty(); + return ColGroupEmpty.read(in); + case UNCOMPRESSED: + return ColGroupUncompressed.read(in); case SDC: - return new ColGroupSDC(nRows); + return ColGroupSDC.read(in, nRows); case SDCSingle: - return new ColGroupSDCSingle(nRows); + return ColGroupSDCSingle.read(in, nRows); case SDCSingleZeros: - return new ColGroupSDCSingleZeros(nRows); + return ColGroupSDCSingleZeros.read(in, nRows); case SDCZeros: - return new ColGroupSDCZeros(nRows); + return ColGroupSDCZeros.read(in, nRows); case SDCFOR: - return new ColGroupSDCFOR(nRows); - case DDCFOR: - return new ColGroupDDCFOR(); + return ColGroupSDCFOR.read(in, nRows); + case LinearFunctional: + return ColGroupLinearFunctional.read(in, nRows); default: - throw new DMLRuntimeException("Unsupported ColGroup Type used: " + ctype); + throw new DMLRuntimeException("Unsupported ColGroup Type used: " + ctype); } } + + public static double[] readDoubleArray(int length, DataInput in) throws IOException { + double[] ret = new double[length]; + for(int i = 0; i < length; i++) + ret[i] = in.readDouble(); + return ret; + } } diff --git a/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupLinearFunctional.java b/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupLinearFunctional.java index 832207b94b..bffb7a24cd 100644 --- a/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupLinearFunctional.java +++ b/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupLinearFunctional.java @@ -57,11 +57,6 @@ public class ColGroupLinearFunctional extends AColGroupCompressed { protected int _numRows; - /** Constructor for serialization */ - protected ColGroupLinearFunctional() { - super(); - } - /** * Constructs a Linear Functional Column Group that compresses its content using a linear functional. * @@ -417,12 +412,10 @@ public class ColGroupLinearFunctional extends AColGroupCompressed { throw new DMLCompressionException("This method should never be called"); } - @Override public void leftMultByAColGroup(AColGroup lhs, MatrixBlock result, int nRows) { - if(lhs instanceof ColGroupEmpty) + if(lhs instanceof ColGroupEmpty) return; - MatrixBlock tmpRet = new MatrixBlock(lhs.getNumCols(), _colIndexes.length, 0); @@ -526,14 +519,17 @@ public class ColGroupLinearFunctional extends AColGroupCompressed { throw new NotImplementedException(); } - @Override - public void readFields(DataInput in) throws IOException { - throw new NotImplementedException(); + public static ColGroupLinearFunctional read(DataInput in, int nRows) throws IOException { + int[] cols = readCols(in); + double[] coefficients = ColGroupIO.readDoubleArray(2 * cols.length, in); + return new ColGroupLinearFunctional(cols, coefficients, nRows); } @Override public void write(DataOutput out) throws IOException { - throw new NotImplementedException(); + super.write(out); + for(double d : _coefficents) + out.writeDouble(d); } @Override diff --git a/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupOLE.java b/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupOLE.java index 19ad6ddaf6..1e28e9805a 100644 --- a/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupOLE.java +++ b/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupOLE.java @@ -19,6 +19,8 @@ package org.apache.sysds.runtime.compress.colgroup; +import java.io.DataInput; +import java.io.IOException; import java.util.Arrays; import org.apache.commons.lang.NotImplementedException; @@ -43,15 +45,6 @@ import org.apache.sysds.runtime.matrix.operators.UnaryOperator; public class ColGroupOLE extends AColGroupOffset { private static final long serialVersionUID = 5723227906925121066L; - /** - * Constructor for serialization - * - * @param numRows Number of rows contained - */ - protected ColGroupOLE(int numRows) { - super(numRows); - } - private ColGroupOLE(int[] colIndices, int numRows, boolean zero, ADictionary dict, char[] bitmaps, int[] bitmapOffs, int[] counts) { super(colIndices, numRows, zero, dict, counts); @@ -644,4 +637,14 @@ public class ColGroupOLE extends AColGroupOffset { public double getCost(ComputationCostEstimator e, int nRows) { throw new NotImplementedException(); } + + public static ColGroupOLE read(DataInput in, int nRows) throws IOException { + int[] cols = readCols(in); + ADictionary dict = DictionaryFactory.read(in); + int[] ptr = readPointers(in); + char[] data = readData(in); + boolean zeros = in.readBoolean(); + return new ColGroupOLE(cols, nRows, zeros, dict, data, ptr, null); + } + } diff --git a/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupRLE.java b/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupRLE.java index ee7cd280ae..995e88c84e 100644 --- a/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupRLE.java +++ b/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupRLE.java @@ -19,6 +19,8 @@ package org.apache.sysds.runtime.compress.colgroup; +import java.io.DataInput; +import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -43,15 +45,6 @@ import org.apache.sysds.runtime.matrix.operators.UnaryOperator; public class ColGroupRLE extends AColGroupOffset { private static final long serialVersionUID = -1560710477952862791L; - /** - * Constructor for serialization - * - * @param numRows Number of rows contained - */ - protected ColGroupRLE(int numRows) { - super(numRows); - } - private ColGroupRLE(int[] colIndexes, int numRows, boolean zeros, ADictionary dict, char[] bitmaps, int[] bitmapOffs, int[] cachedCounts) { super(colIndexes, numRows, zeros, dict, cachedCounts); @@ -976,6 +969,15 @@ public class ColGroupRLE extends AColGroupOffset { return e.getCost(_numRows, _data.length, nCols, nVals, _dict.getSparsity()); } + public static ColGroupRLE read(DataInput in, int nRows) throws IOException { + int[] cols = readCols(in); + ADictionary dict = DictionaryFactory.read(in); + int[] ptr = readPointers(in); + char[] data = readData(in); + boolean zeros = in.readBoolean(); + return new ColGroupRLE(cols, nRows, zeros, dict, data, ptr,null); + } + /** * Encodes the bitmap as a series of run lengths and offsets. * diff --git a/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupSDC.java b/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupSDC.java index eec893df05..b3c83cb9df 100644 --- a/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupSDC.java +++ b/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupSDC.java @@ -28,6 +28,7 @@ import org.apache.sysds.runtime.DMLRuntimeException; import org.apache.sysds.runtime.compress.DMLCompressionException; import org.apache.sysds.runtime.compress.colgroup.dictionary.ADictionary; import org.apache.sysds.runtime.compress.colgroup.dictionary.Dictionary; +import org.apache.sysds.runtime.compress.colgroup.dictionary.DictionaryFactory; import org.apache.sysds.runtime.compress.colgroup.mapping.AMapToData; import org.apache.sysds.runtime.compress.colgroup.mapping.MapToFactory; import org.apache.sysds.runtime.compress.colgroup.offset.AIterator; @@ -57,15 +58,6 @@ public class ColGroupSDC extends ASDC { /** The default value stored in this column group */ protected double[] _defaultTuple; - /** - * Constructor for serialization - * - * @param numRows Number of rows contained - */ - protected ColGroupSDC(int numRows) { - super(numRows); - } - protected ColGroupSDC(int[] colIndices, int numRows, ADictionary dict, double[] defaultTuple, AOffset offsets, AMapToData data, int[] cachedCounts) { super(colIndices, numRows, dict, offsets, cachedCounts); @@ -81,7 +73,6 @@ public class ColGroupSDC extends ASDC { _data = data; _defaultTuple = defaultTuple; - } public static AColGroup create(int[] colIndices, int numRows, ADictionary dict, double[] defaultTuple, @@ -112,11 +103,11 @@ public class ColGroupSDC extends ASDC { } @Override - public double[] getDefaultTuple(){ + public double[] getDefaultTuple() { return _defaultTuple; } - public AMapToData getMapping(){ + public AMapToData getMapping() { return _data; } @@ -431,14 +422,13 @@ public class ColGroupSDC extends ASDC { out.writeDouble(d); } - @Override - public void readFields(DataInput in) throws IOException { - super.readFields(in); - _indexes = OffsetFactory.readIn(in); - _data = MapToFactory.readIn(in); - _defaultTuple = new double[_colIndexes.length]; - for(int i = 0; i < _colIndexes.length; i++) - _defaultTuple[i] = in.readDouble(); + public static ColGroupSDC read(DataInput in, int nRows) throws IOException { + int[] cols = readCols(in); + ADictionary dict = DictionaryFactory.read(in); + AOffset indexes = OffsetFactory.readIn(in); + AMapToData data = MapToFactory.readIn(in); + double[] defaultTuple = ColGroupIO.readDoubleArray(cols.length, in); + return new ColGroupSDC(cols, nRows, dict, defaultTuple, indexes, data, null); } @Override diff --git a/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupSDCFOR.java b/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupSDCFOR.java index ab5005f3c6..9ea41cb6d7 100644 --- a/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupSDCFOR.java +++ b/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupSDCFOR.java @@ -26,6 +26,7 @@ import java.util.Arrays; import org.apache.sysds.runtime.compress.DMLCompressionException; import org.apache.sysds.runtime.compress.colgroup.dictionary.ADictionary; +import org.apache.sysds.runtime.compress.colgroup.dictionary.DictionaryFactory; import org.apache.sysds.runtime.compress.colgroup.mapping.AMapToData; import org.apache.sysds.runtime.compress.colgroup.mapping.MapToFactory; import org.apache.sysds.runtime.compress.colgroup.offset.AIterator; @@ -63,15 +64,6 @@ public class ColGroupSDCFOR extends ASDC { /** Reference values in this column group */ protected double[] _reference; - /** - * Constructor for serialization - * - * @param numRows Number of rows contained - */ - protected ColGroupSDCFOR(int numRows) { - super(numRows); - } - private ColGroupSDCFOR(int[] colIndices, int numRows, ADictionary dict, AOffset indexes, AMapToData data, int[] cachedCounts, double[] reference) { super(colIndices, numRows, dict, indexes, cachedCounts); @@ -113,7 +105,7 @@ public class ColGroupSDCFOR extends ASDC { } @Override - public double[] getDefaultTuple(){ + public double[] getDefaultTuple() { return _reference; } @@ -211,14 +203,13 @@ public class ColGroupSDCFOR extends ASDC { out.writeDouble(d); } - @Override - public void readFields(DataInput in) throws IOException { - super.readFields(in); - _indexes = OffsetFactory.readIn(in); - _data = MapToFactory.readIn(in); - _reference = new double[_colIndexes.length]; - for(int i = 0; i < _colIndexes.length; i++) - _reference[i] = in.readDouble(); + public static ColGroupSDCFOR read(DataInput in, int nRows) throws IOException { + int[] cols = readCols(in); + ADictionary dict = DictionaryFactory.read(in); + AOffset indexes = OffsetFactory.readIn(in); + AMapToData data = MapToFactory.readIn(in); + double[] reference = ColGroupIO.readDoubleArray(cols.length, in); + return new ColGroupSDCFOR(cols, nRows, dict, indexes, data, null, reference); } @Override diff --git a/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupSDCSingle.java b/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupSDCSingle.java index e83401a957..e1e8a58864 100644 --- a/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupSDCSingle.java +++ b/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupSDCSingle.java @@ -28,6 +28,7 @@ import org.apache.commons.lang.NotImplementedException; import org.apache.sysds.runtime.DMLRuntimeException; import org.apache.sysds.runtime.compress.colgroup.dictionary.ADictionary; import org.apache.sysds.runtime.compress.colgroup.dictionary.Dictionary; +import org.apache.sysds.runtime.compress.colgroup.dictionary.DictionaryFactory; import org.apache.sysds.runtime.compress.colgroup.offset.AIterator; import org.apache.sysds.runtime.compress.colgroup.offset.AOffset; import org.apache.sysds.runtime.compress.colgroup.offset.AOffsetIterator; @@ -55,15 +56,6 @@ public class ColGroupSDCSingle extends ASDC { /** The default value stored in this column group */ protected double[] _defaultTuple; - /** - * Constructor for serialization - * - * @param numRows Number of rows contained - */ - protected ColGroupSDCSingle(int numRows) { - super(numRows); - } - private ColGroupSDCSingle(int[] colIndices, int numRows, ADictionary dict, double[] defaultTuple, AOffset offsets, int[] cachedCounts) { super(colIndices, numRows, dict == null ? Dictionary.createNoCheck(new double[colIndices.length]) : dict, offsets, @@ -434,13 +426,12 @@ public class ColGroupSDCSingle extends ASDC { out.writeDouble(d); } - @Override - public void readFields(DataInput in) throws IOException { - super.readFields(in); - _indexes = OffsetFactory.readIn(in); - _defaultTuple = new double[_colIndexes.length]; - for(int i = 0; i < _colIndexes.length; i++) - _defaultTuple[i] = in.readDouble(); + public static ColGroupSDCSingle read(DataInput in, int nRows) throws IOException { + int[] cols = readCols(in); + ADictionary dict = DictionaryFactory.read(in); + AOffset indexes = OffsetFactory.readIn(in); + double[] defaultTuple = ColGroupIO.readDoubleArray(cols.length, in); + return new ColGroupSDCSingle(cols, nRows, dict, defaultTuple, indexes, null); } @Override diff --git a/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupSDCSingleZeros.java b/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupSDCSingleZeros.java index 139b433c0c..7b1c92cad8 100644 --- a/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupSDCSingleZeros.java +++ b/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupSDCSingleZeros.java @@ -28,6 +28,7 @@ import org.apache.commons.lang.NotImplementedException; import org.apache.sysds.runtime.compress.DMLCompressionException; import org.apache.sysds.runtime.compress.colgroup.dictionary.ADictionary; import org.apache.sysds.runtime.compress.colgroup.dictionary.Dictionary; +import org.apache.sysds.runtime.compress.colgroup.dictionary.DictionaryFactory; import org.apache.sysds.runtime.compress.colgroup.offset.AIterator; import org.apache.sysds.runtime.compress.colgroup.offset.AOffset; import org.apache.sysds.runtime.compress.colgroup.offset.AOffsetIterator; @@ -52,15 +53,6 @@ import org.apache.sysds.runtime.matrix.operators.UnaryOperator; public class ColGroupSDCSingleZeros extends ASDCZero { private static final long serialVersionUID = 8033235615964315078L; - /** - * Constructor for serialization - * - * @param numRows Number of rows contained - */ - protected ColGroupSDCSingleZeros(int numRows) { - super(numRows); - } - private ColGroupSDCSingleZeros(int[] colIndices, int numRows, ADictionary dict, AOffset offsets, int[] cachedCounts) { super(colIndices, numRows, dict, offsets, cachedCounts); @@ -95,7 +87,7 @@ public class ColGroupSDCSingleZeros extends ASDCZero { return; else if(it.value() >= ru) _indexes.cacheIterator(it, ru); - else{ + else { decompressToDenseBlockDenseDictionaryWithProvidedIterator(db, rl, ru, offR, offC, values, it); _indexes.cacheIterator(it, ru); } @@ -563,10 +555,11 @@ public class ColGroupSDCSingleZeros extends ASDCZero { _indexes.write(out); } - @Override - public void readFields(DataInput in) throws IOException { - super.readFields(in); - _indexes = OffsetFactory.readIn(in); + public static ColGroupSDCSingleZeros read(DataInput in, int nRows) throws IOException { + int[] cols = readCols(in); + ADictionary dict = DictionaryFactory.read(in); + AOffset indexes = OffsetFactory.readIn(in); + return new ColGroupSDCSingleZeros(cols, nRows, dict, indexes, null); } @Override diff --git a/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupSDCZeros.java b/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupSDCZeros.java index 6e3b399ccb..91d16da037 100644 --- a/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupSDCZeros.java +++ b/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupSDCZeros.java @@ -27,6 +27,7 @@ import java.util.Arrays; import org.apache.sysds.runtime.compress.DMLCompressionException; import org.apache.sysds.runtime.compress.colgroup.dictionary.ADictionary; import org.apache.sysds.runtime.compress.colgroup.dictionary.Dictionary; +import org.apache.sysds.runtime.compress.colgroup.dictionary.DictionaryFactory; import org.apache.sysds.runtime.compress.colgroup.mapping.AMapToData; import org.apache.sysds.runtime.compress.colgroup.mapping.MapToFactory; import org.apache.sysds.runtime.compress.colgroup.offset.AIterator; @@ -59,15 +60,6 @@ public class ColGroupSDCZeros extends ASDCZero { /** Pointers to row indexes in the dictionary. Note the dictionary has one extra entry. */ protected AMapToData _data; - /** - * Constructor for serialization - * - * @param numRows Number of rows contained - */ - protected ColGroupSDCZeros(int numRows) { - super(numRows); - } - private ColGroupSDCZeros(int[] colIndices, int numRows, ADictionary dict, AOffset indexes, AMapToData data, int[] cachedCounts) { super(colIndices, numRows, dict, indexes, cachedCounts); @@ -549,11 +541,12 @@ public class ColGroupSDCZeros extends ASDCZero { _data.write(out); } - @Override - public void readFields(DataInput in) throws IOException { - super.readFields(in); - _indexes = OffsetFactory.readIn(in); - _data = MapToFactory.readIn(in); + public static ColGroupSDCZeros read(DataInput in, int nRows) throws IOException { + int[] cols = readCols(in); + ADictionary dict = DictionaryFactory.read(in); + AOffset indexes = OffsetFactory.readIn(in); + AMapToData data = MapToFactory.readIn(in); + return new ColGroupSDCZeros(cols, nRows, dict, indexes, data, null); } @Override diff --git a/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupUncompressed.java b/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupUncompressed.java index 6a72136ab6..96a4b2b447 100644 --- a/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupUncompressed.java +++ b/src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupUncompressed.java @@ -65,11 +65,6 @@ public class ColGroupUncompressed extends AColGroup { */ private MatrixBlock _data; - /** Constructor for serialization */ - protected ColGroupUncompressed() { - super(); - } - private ColGroupUncompressed(MatrixBlock mb, int[] colIndexes) { super(colIndexes); _data = mb; @@ -454,11 +449,11 @@ public class ColGroupUncompressed extends AColGroup { } } - @Override - public void readFields(DataInput in) throws IOException { - super.readFields(in); - _data = new MatrixBlock(); - _data.readFields(in); + public static ColGroupUncompressed read(DataInput in) throws IOException { + int[] cols = readCols(in); + MatrixBlock data = new MatrixBlock(); + data.readFields(in); + return new ColGroupUncompressed(data, cols); } @Override diff --git a/src/test/java/org/apache/sysds/test/component/compress/colgroup/ColGroupMorphingPerformanceCompare.java b/src/test/java/org/apache/sysds/test/component/compress/colgroup/ColGroupMorphingPerformanceCompare.java index 14962b038a..8b67f9ae19 100644 --- a/src/test/java/org/apache/sysds/test/component/compress/colgroup/ColGroupMorphingPerformanceCompare.java +++ b/src/test/java/org/apache/sysds/test/component/compress/colgroup/ColGroupMorphingPerformanceCompare.java @@ -153,11 +153,6 @@ public class ColGroupMorphingPerformanceCompare { private static final long serialVersionUID = -7157464508602251065L; private final MatrixBlock mbDict; - protected SDCNoMorph(int numRows) { - super(numRows); - mbDict = null; - } - public SDCNoMorph(ColGroupSDC g) { this(g.getColIndices(), g.getNumRows(), g.getDictionary(), g.getDefaultTuple(), g.getOffsets(), g.getMapping(), null);
