Baunsgaard commented on code in PR #1833: URL: https://github.com/apache/systemds/pull/1833#discussion_r1216846026
########## src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupDeltaDDC.java: ########## @@ -19,11 +19,271 @@ 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.dictionary.DeltaDictionary; +import org.apache.sysds.runtime.compress.colgroup.indexes.IColIndex; +import org.apache.sysds.runtime.compress.colgroup.mapping.AMapToData; +import org.apache.sysds.runtime.compress.colgroup.scheme.ICLAScheme; +import org.apache.sysds.runtime.compress.cost.ComputationCostEstimator; +import org.apache.sysds.runtime.data.DenseBlock; +import org.apache.sysds.runtime.data.SparseBlock; +import org.apache.sysds.runtime.functionobjects.Builtin; +import org.apache.sysds.runtime.instructions.cp.CM_COV_Object; +import org.apache.sysds.runtime.matrix.data.MatrixBlock; +import org.apache.sysds.runtime.matrix.operators.BinaryOperator; +import org.apache.sysds.runtime.matrix.operators.CMOperator; +import org.apache.sysds.runtime.matrix.operators.ScalarOperator; +import org.apache.sysds.runtime.matrix.operators.UnaryOperator; + /** * 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 AColGroupCompressed implements AMapToDataGroup { + + private static final long serialVersionUID = -1045556313148564147L; + private AMapToData _data; + private DeltaDictionary _dict; + //TODO Confirm if casting from ADictionary to DeltaDictionary is reasonable + private ColGroupDeltaDDC(IColIndex colIndexes, ADictionary dict, AMapToData data) { + super(colIndexes); + _data = data; + _dict = (DeltaDictionary) dict; + } + + //TODO Confirm if other parameters for constructors are required, such as cachedCounts + public static AColGroup create(IColIndex colIndexes, ADictionary dict, AMapToData data) { + if(data.getUnique() == 1) + return ColGroupConst.create(colIndexes, dict); + else if(dict == null) + return new ColGroupEmpty(colIndexes); Review Comment: yes, if the column can be encoded as a constant or an empty column group the return should be an empty column group. The case you write is exactly the case we need to support. But ! While it would be good that we return the specialized instance of const and empty column groups, you do not have to add it if it is confusing, just make sure that the thing that is returned from the construct is correct, or throw an error if incorrect. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@systemds.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org