kev-inn commented on code in PR #1628:
URL: https://github.com/apache/systemds/pull/1628#discussion_r891289159
##########
src/main/java/org/apache/sysds/runtime/instructions/cp/QuantileSortCPInstruction.java:
##########
@@ -119,4 +123,23 @@ public void processInstruction(ExecutionContext ec) {
//set and release output
ec.setMatrixOutput(output.getName(), resultBlock);
}
+
+ public int getNumThreads() {
+ return _numThreads;
+ }
+
+ @Override
+ protected FEDInstruction tryReplaceWithFederated(ExecutionContext ec) {
+ if(!input1.isMatrix())
+ return null;
+
+ MatrixObject mo1 = ec.getMatrixObject(input1);
+ if(!mo1.isFederatedExcept(FType.BROADCAST))
+ return null;
+
+ if(mo1.isFederated(FType.ROW) ||
+ (mo1.getFedMapping().getFederatedRanges().length == 1
&& mo1.isFederated(FType.COL)))
+ return new QuantileSortFEDInstruction(this);
+ return null;
Review Comment:
As you can notice in all implementations I opted to use early return checks
to reduce nesting. The last if on the other hand checks if replacement is
appropriate. This is inconsistent to the checks before, which checked for
failure, but is much more readable/maintainable, than confusing inverted
conditions in my experience.
--
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]