You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@systemml.apache.org by "Mike Dusenberry (JIRA)" <ji...@apache.org> on 2016/03/22 20:09:25 UTC
[jira] [Created] (SYSTEMML-590) Assume Parent's Namespace for
Nested UDF calls.
Mike Dusenberry created SYSTEMML-590:
----------------------------------------
Summary: Assume Parent's Namespace for Nested UDF calls.
Key: SYSTEMML-590
URL: https://issues.apache.org/jira/browse/SYSTEMML-590
Project: SystemML
Issue Type: Sub-task
Reporter: Mike Dusenberry
Currently, if a UDF body involves calling another UDF, the default, global namespace is assumed, unless a namespace is explicitly indicated. This becomes a problem when a file contains UDFs, and is then sourced from another file.
Imagine a file {{funcs.dml}} as follows:
{code}
f = function(double x, int a) return (double ans) {
x2 = g(x)
ans = a * x2
}
g = function(double x) return (double ans) {
ans = x * x
}
{code}
Then, let's try to call {{f}}:
{code}
script = """
source ("funcs.dml") as funcs
ans = funcs::f(3, 1)
print(ans)
"""
ml.reset()
ml.executeScript(script)
{code}
This results in an error since {{f}} is in the {{funcs}} namespace, but the call to {{g}} assumes {{g}} is still in the default namespace. Clearly, the user intends to the use the {{g}} that is located in the same file.
Currently, we would need to adjust {{funcs.dml}} as follows to explicitly assume that {{f}} and {{g}} are in a {{funcs}} namespace:
{code}
f = function(double x, int a) return (double ans) {
f = function(double x, int a) return (double ans) {
x2 = funcs::g(x)
ans = a * x2
}
g = function(double x) return (double ans) {
ans = x * x
}
{code}
Instead, it would be better to simply first look for {{g}} in its parent's namespace. In this case, the "parent" would be the function {{f}}, and the namespace we have selected is {{funcs}}. Then, namespace assumptions would not be necessary.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)