e-strauss commented on code in PR #2087:
URL: https://github.com/apache/systemds/pull/2087#discussion_r1741856277


##########
src/main/python/systemds/operator/nodes/matrix.py:
##########
@@ -244,6 +244,22 @@ def min(self, axis: int = None) -> 'OperationNode':
         raise ValueError(
             f"Axis has to be either 0, 1 or None, for column, row or complete 
{self.operation}")
 
+    def countDistinct(self, axis: int = None) -> 'OperationNode':
+        """Calculate the number of distinct values of matrix.
+
+        :param axis: can be 0 or 1 to do either row or column aggregation
+        :return: `Matrix` representing operation
+        """
+        if axis == 0:
+            return Matrix(self.sds_context, 'colCountDistinct', [self])
+        elif axis == 1:
+            return Matrix(self.sds_context, 'rowCountDistinct', [self])
+        elif axis is None:
+            return Scalar(self.sds_context, 'countDistinct', [self])
+        raise ValueError(
+            f"Axis has to be either 0, 1 or None, for column, row or complete 
{self.operation}")

Review Comment:
   @Baunsgaard the older test cases for the aggregation like min, max and co, 
it makes sense to add test cases there as well - or are there some in place 
which I havent found?



-- 
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

Reply via email to