You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@systemds.apache.org by mb...@apache.org on 2021/08/13 21:17:11 UTC

[systemds] branch master updated: [MINOR] Improved error handling eval (returns) and parser (slice/fcall)

This is an automated email from the ASF dual-hosted git repository.

mboehm7 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/systemds.git


The following commit(s) were added to refs/heads/master by this push:
     new c97a245  [MINOR] Improved error handling eval (returns) and parser (slice/fcall)
c97a245 is described below

commit c97a2454570c92966f4290c9b117547df3f152e0
Author: Matthias Boehm <mb...@gmail.com>
AuthorDate: Fri Aug 13 23:16:37 2021 +0200

    [MINOR] Improved error handling eval (returns) and parser (slice/fcall)
---
 .../java/org/apache/sysds/parser/dml/DmlSyntacticValidator.java    | 7 ++++---
 .../sysds/runtime/instructions/cp/EvalNaryCPInstruction.java       | 4 ++++
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/sysds/parser/dml/DmlSyntacticValidator.java b/src/main/java/org/apache/sysds/parser/dml/DmlSyntacticValidator.java
index dc56248..8c8a449 100644
--- a/src/main/java/org/apache/sysds/parser/dml/DmlSyntacticValidator.java
+++ b/src/main/java/org/apache/sysds/parser/dml/DmlSyntacticValidator.java
@@ -558,11 +558,12 @@ public class DmlSyntacticValidator implements DmlListener {
 	}
 
 	@Override
-	public void exitFunctionCallMultiAssignmentStatement(
-			FunctionCallMultiAssignmentStatementContext ctx) {
+	public void exitFunctionCallMultiAssignmentStatement(FunctionCallMultiAssignmentStatementContext ctx) {
+		if( ctx.name == null )
+			throw new ParseException("Missing name of multi-assignment function call (see parser issues above).");
 		String[] names = getQualifiedNames(ctx.name.getText());
 		if(names == null) {
-			notifyErrorListeners("incorrect function name (only namespace.functionName allowed. Hint: If you are trying to use builtin functions, you can skip the namespace)", ctx.name);
+			notifyErrorListeners("incorrect function name (only namespace::functionName allowed. Hint: If you are trying to use builtin functions, you can skip the namespace)", ctx.name);
 			return;
 		}
 		String namespace = names[0];
diff --git a/src/main/java/org/apache/sysds/runtime/instructions/cp/EvalNaryCPInstruction.java b/src/main/java/org/apache/sysds/runtime/instructions/cp/EvalNaryCPInstruction.java
index 4548b7b..db5676f 100644
--- a/src/main/java/org/apache/sysds/runtime/instructions/cp/EvalNaryCPInstruction.java
+++ b/src/main/java/org/apache/sysds/runtime/instructions/cp/EvalNaryCPInstruction.java
@@ -159,6 +159,10 @@ public class EvalNaryCPInstruction extends BuiltinNaryCPInstruction {
 				mb = DataConverter.convertToMatrixBlock(((FrameObject) newOutput).acquireRead());
 				ec.cleanupCacheableData((FrameObject) newOutput);
 			}
+			else {
+				throw new DMLRuntimeException("Invalid eval return type: "+newOutput.getDataType().name()
+					+ " (valid: matrix/frame/scalar; where frames or scalars are converted to output matrices)");
+			}
 			outputMO.acquireModify(mb);
 			outputMO.release();
 			ec.setVariable(output.getName(), outputMO);