You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@systemds.apache.org by GitBox <gi...@apache.org> on 2022/04/20 07:46:10 UTC

[GitHub] [systemds] Baunsgaard commented on a diff in pull request #1590: [MINOR] Fix federated rmempty

Baunsgaard commented on code in PR #1590:
URL: https://github.com/apache/systemds/pull/1590#discussion_r853828775


##########
src/main/java/org/apache/sysds/runtime/instructions/fed/ParameterizedBuiltinFEDInstruction.java:
##########
@@ -906,8 +906,8 @@ public GetMatrixCharacteristics(long varID) {
 		@Override
 		public FederatedResponse execute(ExecutionContext ec, Data... data) {
 			MatrixBlock mb = ((MatrixObject) data[0]).acquireReadAndRelease();
-			int r = mb.getDenseBlockValues() != null ? mb.getNumRows() : 0;
-			int c = mb.getDenseBlockValues() != null ? mb.getNumColumns() : 0;
+			int r = mb.getDenseBlockValues() != null || mb.isInSparseFormat() ? mb.getNumRows() : 0;
+			int c = mb.getDenseBlockValues() != null || mb.isInSparseFormat() ? mb.getNumColumns() : 0;

Review Comment:
   Cool, thanks for the fix.
   But i think we can improve it to work with any matrix type, since you could use mb.isEmpty()
   also, minor thing, in this code you use two calls, and you could make do with one, if you split the code in if else.
   
   ```
   if(mb.isEmpty())
     return new .... SUCESS, new int[] {0,0});
   return new ... SUCESS, new int[] {mb.getNumRows(), mb.getNumColumns()};
   ```
   
   Then everything works with compressed matrices as well :)
   



-- 
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-unsubscribe@systemds.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org