janniklinde commented on code in PR #2361:
URL: https://github.com/apache/systemds/pull/2361#discussion_r2559944646


##########
src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupDeltaDDC.java:
##########
@@ -19,62 +19,107 @@
 
 package org.apache.sysds.runtime.compress.colgroup;
 
+import org.apache.commons.lang3.NotImplementedException;
+import org.apache.sysds.runtime.DMLRuntimeException;
+import org.apache.sysds.runtime.compress.CompressedMatrixBlock;
+import org.apache.sysds.runtime.compress.DMLCompressionException;
+import org.apache.sysds.runtime.compress.colgroup.dictionary.DeltaDictionary;
+import org.apache.sysds.runtime.compress.colgroup.dictionary.IDictionary;
+import org.apache.sysds.runtime.compress.colgroup.indexes.IColIndex;
+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() {
+               super();
+       }
 
-//     /** Constructor for serialization */
-//     protected ColGroupDeltaDDC() {
-//     }
+       private ColGroupDeltaDDC(IColIndex colIndexes, IDictionary dict, 
AMapToData data, int[] cachedCounts) {
+               super(colIndexes, dict, data, cachedCounts);
+               if(CompressedMatrixBlock.debug) {
+                       if(!(dict instanceof DeltaDictionary))
+                               throw new DMLCompressionException("DeltaDDC 
must use DeltaDictionary");
+               }
+       }
 
-//     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(IColIndex colIndexes, IDictionary dict, 
AMapToData data, int[] cachedCounts) {
+               if(data.getUnique() == 1)
+                       return ColGroupConst.create(colIndexes, dict);

Review Comment:
   This is incorrect for the general case. If your dictionary contains a 
constant value that is nonzero, it does not represent a constant colgroup in 
delta encoding. It only holds if the only entry of the dict is 0.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to