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


The following commit(s) were added to refs/heads/main by this push:
     new 818b58dd57 [MINOR] Create matrix sketches exclusively using 
MatrixSketchFactory
818b58dd57 is described below

commit 818b58dd57c0a3f619e609f2062504c8ec24aeee
Author: Badrul Chowdhury <[email protected]>
AuthorDate: Fri Dec 9 17:26:31 2022 -0800

    [MINOR] Create matrix sketches exclusively using MatrixSketchFactory
    
    This patch ensures that all matrix sketches are instantiated via 
MatrixSketchFactory
    
    Closes #1749
---
 .../sysds/runtime/matrix/data/LibMatrixCountDistinct.java     | 11 +++++------
 .../sketch/{SketchFactory.java => MatrixSketchFactory.java}   |  2 +-
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git 
a/src/main/java/org/apache/sysds/runtime/matrix/data/LibMatrixCountDistinct.java
 
b/src/main/java/org/apache/sysds/runtime/matrix/data/LibMatrixCountDistinct.java
index c70f72ad3f..eea5dbb075 100644
--- 
a/src/main/java/org/apache/sysds/runtime/matrix/data/LibMatrixCountDistinct.java
+++ 
b/src/main/java/org/apache/sysds/runtime/matrix/data/LibMatrixCountDistinct.java
@@ -36,8 +36,7 @@ import org.apache.sysds.runtime.data.SparseBlockCSR;
 import org.apache.sysds.runtime.data.SparseBlockFactory;
 import org.apache.sysds.runtime.instructions.spark.data.CorrMatrixBlock;
 import org.apache.sysds.runtime.matrix.data.sketch.MatrixSketch;
-import org.apache.sysds.runtime.matrix.data.sketch.SketchFactory;
-import 
org.apache.sysds.runtime.matrix.data.sketch.countdistinctapprox.KMVSketch;
+import org.apache.sysds.runtime.matrix.data.sketch.MatrixSketchFactory;
 import org.apache.sysds.runtime.matrix.operators.CountDistinctOperator;
 import org.apache.sysds.runtime.matrix.operators.CountDistinctOperatorTypes;
 import org.apache.sysds.utils.Hash.HashType;
@@ -105,7 +104,7 @@ public interface LibMatrixCountDistinct {
                                        res = countDistinctValuesNaive(in, op);
                                        break;
                                case KMV:
-                                       res = new KMVSketch(op).getValue(in);
+                                       res = 
MatrixSketchFactory.get(op).getValue(in);
                                        break;
                                default:
                                        throw new DMLException("Invalid 
estimator type for aggregation: " + 
LibMatrixCountDistinct.class.getSimpleName());
@@ -361,17 +360,17 @@ public interface LibMatrixCountDistinct {
        }
 
        static MatrixBlock countDistinctValuesFromSketch(CountDistinctOperator 
op, CorrMatrixBlock corrBlkIn) {
-               MatrixSketch sketch = SketchFactory.get(op);
+               MatrixSketch sketch = MatrixSketchFactory.get(op);
                return sketch.getValueFromSketch(corrBlkIn);
        }
 
        static CorrMatrixBlock createSketch(CountDistinctOperator op, 
MatrixBlock blkIn) {
-               MatrixSketch sketch = SketchFactory.get(op);
+               MatrixSketch sketch = MatrixSketchFactory.get(op);
                return sketch.create(blkIn);
        }
 
        static CorrMatrixBlock unionSketch(CountDistinctOperator op, 
CorrMatrixBlock corrBlkIn0, CorrMatrixBlock corrBlkIn1) {
-               MatrixSketch sketch = SketchFactory.get(op);
+               MatrixSketch sketch = MatrixSketchFactory.get(op);
                return sketch.union(corrBlkIn0, corrBlkIn1);
        }
 }
diff --git 
a/src/main/java/org/apache/sysds/runtime/matrix/data/sketch/SketchFactory.java 
b/src/main/java/org/apache/sysds/runtime/matrix/data/sketch/MatrixSketchFactory.java
similarity index 98%
rename from 
src/main/java/org/apache/sysds/runtime/matrix/data/sketch/SketchFactory.java
rename to 
src/main/java/org/apache/sysds/runtime/matrix/data/sketch/MatrixSketchFactory.java
index 434582374d..2a2c926aa6 100644
--- 
a/src/main/java/org/apache/sysds/runtime/matrix/data/sketch/SketchFactory.java
+++ 
b/src/main/java/org/apache/sysds/runtime/matrix/data/sketch/MatrixSketchFactory.java
@@ -26,7 +26,7 @@ import 
org.apache.sysds.runtime.matrix.operators.CountDistinctOperator;
 import org.apache.sysds.runtime.matrix.operators.CountDistinctOperatorTypes;
 import org.apache.sysds.runtime.matrix.operators.Operator;
 
-public class SketchFactory {
+public class MatrixSketchFactory {
        public static MatrixSketch get(Operator op) {
                if (op instanceof CountDistinctOperator) {
                        CountDistinctOperator cdop = (CountDistinctOperator) op;

Reply via email to