Felix Schüler created SYSTEMML-1264:
---------------------------------------

             Summary: Improve error message for undefined functions
                 Key: SYSTEMML-1264
                 URL: https://issues.apache.org/jira/browse/SYSTEMML-1264
             Project: SystemML
          Issue Type: Bug
            Reporter: Felix Schüler
            Priority: Minor


When using a function that isn't defined we currently throw a parse issue 
suggesting to create a tempvar instead of the LanguageException.

Consider the example script

{code}
a = 5
println("a is: " + 5)
{code}

This will throw the following parse issue:

{code}
17/02/14 12:11:08 INFO api.DMLScript: BEGIN DML run 02/14/2017 12:11:08
17/02/14 12:11:08 ERROR api.DMLScript: scripts/parseIssue.dml line 2:0 function 
call needs to have lvalue (Quickfix: change it to 'tmpVar = println(...)')

--------------------------------------------------------------
The following parse issue was encountered:
scripts/parseIssue.dml [line 2:0] [Validation error] -> println("a is: " + a)
   function call needs to have lvalue (Quickfix: change it to 'tmpVar = 
println(...)')
{code}

After doing that (adding tmpvar = ... in front) it throws the correct error:

{code}
17/02/14 12:12:55 INFO api.DMLScript: BEGIN DML run 02/14/2017 12:12:55
17/02/14 12:12:55 ERROR api.DMLScript: Failed to execute DML script.
org.apache.sysml.parser.LanguageException: ERROR: scripts/parseIssue.dml -- 
line 2, column 0 -- function println is undefined in namespace .defaultNS
        at 
org.apache.sysml.parser.StatementBlock.isMergeableFunctionCallBlock(StatementBlock.java:187)
        at 
org.apache.sysml.parser.StatementBlock.mergeFunctionCalls(StatementBlock.java:315)
        at 
org.apache.sysml.parser.DMLTranslator.liveVariableAnalysis(DMLTranslator.java:209)
        at org.apache.sysml.api.DMLScript.execute(DMLScript.java:599)
        at org.apache.sysml.api.DMLScript.executeScript(DMLScript.java:360)
        at org.apache.sysml.api.DMLScript.main(DMLScript.java:221)
Exception in thread "main" org.apache.sysml.api.DMLException: 
org.apache.sysml.parser.LanguageException: ERROR: scripts/parseIssue.dml -- 
line 2, column 0 -- function println is undefined in namespace .defaultNS
        at org.apache.sysml.api.DMLScript.executeScript(DMLScript.java:374)
        at org.apache.sysml.api.DMLScript.main(DMLScript.java:221)
Caused by: org.apache.sysml.parser.LanguageException: ERROR: 
scripts/parseIssue.dml -- line 2, column 0 -- function println is undefined in 
namespace .defaultNS
        at 
org.apache.sysml.parser.StatementBlock.isMergeableFunctionCallBlock(StatementBlock.java:187)
        at 
org.apache.sysml.parser.StatementBlock.mergeFunctionCalls(StatementBlock.java:315)
        at 
org.apache.sysml.parser.DMLTranslator.liveVariableAnalysis(DMLTranslator.java:209)
        at org.apache.sysml.api.DMLScript.execute(DMLScript.java:599)
        at org.apache.sysml.api.DMLScript.executeScript(DMLScript.java:360)
        ... 1 more
{code}




--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to