Gus Jenkins created SYSTEMML-1822:
-------------------------------------

             Summary: java.lang.ArrayStoreException with for-loop inside UDF
                 Key: SYSTEMML-1822
                 URL: https://issues.apache.org/jira/browse/SYSTEMML-1822
             Project: SystemML
          Issue Type: Bug
            Reporter: Gus Jenkins


Hey I'm working on something and came upon a bug. I boiled the problem down to 
the following. If I run the following code, it works fine. But if I run the 
latter code with a simple for-loop in the UDF, I get an error. Please see 
below. I also included the error message.

{code}
discrete_samples = function(matrix[double] weights) return(double ix){


    ix = 0.00



}



weights = matrix(1, rows = 5, cols = 1)

ix = discrete_samples(weights)

print("Index here: " + ix)
{code}


{code}
discrete_samples = function(matrix[double] weights) return(double ix){


    ix = 0.00
    for(j in 1:5){
        print("Hello")
    }


}



weights = matrix(1, rows = 5, cols = 1)

ix = discrete_samples(weights)

print("Index here: " + ix)
{code}

{code}
stcs-mbp:spark-2.1.1-bin-hadoop2.7 stc$ spark-submit SystemML.jar -f 
/Users/stc/Desktop/systemml/scripts/algorithms/test.dml 
log4j:WARN No appenders could be found for logger 
(org.apache.hadoop.util.Shell).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more 
info.
Exception in thread "main" org.apache.sysml.api.DMLException: 
java.lang.ArrayStoreException: java.lang.Integer
        at org.apache.sysml.api.DMLScript.executeScript(DMLScript.java:533)
        at org.apache.sysml.api.DMLScript.main(DMLScript.java:233)
        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:498)
        at 
org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:743)
        at 
org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:187)
        at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:212)
        at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:126)
        at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
Caused by: java.lang.ArrayStoreException: java.lang.Integer
        at java.util.AbstractCollection.toArray(AbstractCollection.java:196)
        at 
org.apache.sysml.hops.ipa.FunctionCallSizeInfo.toString(FunctionCallSizeInfo.java:306)
        at java.lang.String.valueOf(String.java:2994)
        at java.lang.StringBuilder.append(StringBuilder.java:131)
        at 
org.apache.sysml.hops.ipa.InterProceduralAnalysis.analyzeProgram(InterProceduralAnalysis.java:181)
        at 
org.apache.sysml.parser.DMLTranslator.rewriteHopsDAG(DMLTranslator.java:269)
        at org.apache.sysml.api.DMLScript.execute(DMLScript.java:761)
        at org.apache.sysml.api.DMLScript.executeScript(DMLScript.java:506)
        ... 10 more
{code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to