Skip to content

Commit d98a93b

Browse files
committed
Update RewriterAlphabetEncoder.java
1 parent 2520d16 commit d98a93b

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/main/java/org/apache/sysds/hops/rewriter/RewriterAlphabetEncoder.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ public class RewriterAlphabetEncoder {
4747
new Operand("colSums", 1, MATRIX),
4848
new Operand("max", 1, MATRIX),
4949
new Operand("min", 1, MATRIX),
50-
new Operand("ncol", 1, true, MATRIX),
51-
new Operand("nrow", 1, true, MATRIX),
52-
new Operand("length", 1, true, MATRIX),
50+
new Operand("ncol", 0, true, MATRIX),
51+
new Operand("nrow", 0, true, MATRIX),
52+
new Operand("length", 0, true, MATRIX),
5353
/*new Operand("fncol", 1, true, MATRIX),
5454
new Operand("fnrow", 1, true, MATRIX),
5555
new Operand("flength", 1, true, MATRIX),*/
@@ -312,7 +312,12 @@ private static List<RewriterStatement> recursivelyFindAllCombinations(List<Opera
312312
}
313313

314314
int nOps = operands.get(0).numArgs;
315-
int[] slices = new int[nOps-1];
315+
316+
if (nOps == 0) {
317+
return List.of(buildStmt(op, null));
318+
}
319+
320+
int[] slices = new int[Math.max(nOps-1, 0)];
316321

317322
List<RewriterStatement> possibleStmts = new ArrayList<>();
318323

@@ -371,8 +376,8 @@ private static RewriterStatement buildStmt(Operand op, RewriterStatement[] stack
371376
case "ncol":
372377
case "nrow":
373378
case "length": {
374-
String actualOp = op.op.substring(1);
375-
stmt.withInstruction(actualOp).withOps(stack).consolidate(ctx);
379+
String actualOp = op.op;
380+
stmt.withInstruction(actualOp).withOps(new RewriterDataType().as(UUID.randomUUID().toString()).ofType("MATRIX").consolidate(ctx)).consolidate(ctx);
376381
break;
377382
}
378383
case "fncol":

0 commit comments

Comments
 (0)