Uploaded image for project: 'SystemDS'
  1. SystemDS
  2. SYSTEMDS-590 Improve Namespace Handling for UDFs
  3. SYSTEMDS-654

DML Functions Should Override Builtin Functions

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • SystemML 0.10
    • SystemML 0.10
    • None
    • None

    Description

      Currently, if a user defines a DML-bodied function that has the same name as a builtin function, an error will be returned. This occurs both if the function is defined in the same file as it is being called (which could look like a builtin function call, although the user does not wish it to be), or if the function is defined in a separate file and called with a namespace notation. As we grow the language with an increasing number of builtin functions, this is not the desired behavior. Instead, any DML functions should override any builtin functions.

      Example 1:

      min = function(int i) {
        print("hi" + i)
      }
      tmp = min(1)  # fail!
      
      : org.apache.sysml.parser.LanguageException: Unsupported Parameters : ERROR: null -- line 6, column 0 -- Expecting matrix parameter for function MIN
      	at org.apache.sysml.parser.Expression.raiseValidateError(Expression.java:421)
      	at org.apache.sysml.parser.BuiltinFunctionExpression.checkMatrixParam(BuiltinFunctionExpression.java:1221)
      	at org.apache.sysml.parser.BuiltinFunctionExpression.validateExpression(BuiltinFunctionExpression.java:314)
      	at org.apache.sysml.parser.StatementBlock.validate(StatementBlock.java:598)
      	at org.apache.sysml.parser.DMLTranslator.validateParseTree(DMLTranslator.java:136)
      	at org.apache.sysml.api.MLContext.executeUsingSimplifiedCompilationChain(MLContext.java:1325)
      	at org.apache.sysml.api.MLContext.compileAndExecuteScript(MLContext.java:1227)
      	at org.apache.sysml.api.MLContext.executeScript(MLContext.java:1165)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:231)
      	at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:381)
      	at py4j.Gateway.invoke(Gateway.java:259)
      	at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:133)
      	at py4j.commands.CallCommand.execute(CallCommand.java:79)
      	at py4j.GatewayConnection.run(GatewayConnection.java:209)
      	at java.lang.Thread.run(Thread.java:745)
      

      Example 2:

      # util.dml
      min = function(int i) {
        print("hi" + i)
      }
      
      source("util.dml") as util
      tmp = util::min(1)  # fail!
      

      Attachments

        Issue Links

          Activity

            People

              gweidner Glenn Weidner
              dusenberrymw Mike Dusenberry
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: