Looping does not work, while inlining does ....

58 views
Skip to first unread message

Iris Eiron

unread,
Oct 13, 2010, 6:05:05 AM10/13/10
to Jaql Users, kevin.be...@gmail.com
Hello,

Below please find two excerpts of code. The first is a loop, which
fails with UndeclaredThrowableException. The second, is a simple
inlining of the loop's code. That completes successfully.

Please advice what's causing this strange behavior,

Thanks,
- Iris

1) --------------------------------------------------------

jaql> $hdfsPath = "/mnt/hdgpfs/shared_home/irise1/hdfs/data/tweeter/
ML/";

jaql> $outputPath = "/mnt/hdgpfs/shared_home/irise1/movielens/output";

jaql> $numRecomsList = [10, 20, 30, 40, 50];

jaql> for (nr in $numRecomsList) (
$numRecoms = double(nr),
hdfsShell(strcat("-getmerge ",$hdfsPath,"/results-xi2.",$numRecoms,"-
recoms.csv ",
$outputPath,"/xi2/",$numRecoms,".csv addln"))

[java.lang.reflect.UndeclaredThrowableException
at
com.ibm.jaql.json.util.JsonIterator.hasNext(JsonIterator.java:150)
at com.ibm.jaql.json.util.JsonIterator.print(JsonIterator.java:
243)
at com.ibm.jaql.lang.StreamPrinter.print(StreamPrinter.java:
59)
at com.ibm.jaql.lang.Jaql.run(Jaql.java:597)
at com.ibm.jaql.lang.Jaql.run(Jaql.java:109)
at
com.ibm.jaql.util.shell.AbstractJaqlShell.run(AbstractJaqlShell.java:
54)
at
com.ibm.jaql.util.shell.AbstractJaqlShell.main(AbstractJaqlShell.java:
100)
at JaqlShell.main(JaqlShell.java:322)
Caused by: java.lang.ClassCastException:
com.ibm.jaql.json.type.JsonLong incompatible with
com.ibm.jaql.json.type.JsonArray
at com.ibm.jaql.lang.expr.core.Expr.iter(Expr.java:331)
at com.ibm.jaql.lang.expr.core.DoExpr.iter(DoExpr.java:149)
at com.ibm.jaql.lang.expr.core.ForExpr$1.moveNext(ForExpr.java:
239)
at
com.ibm.jaql.json.util.JsonIterator.hasNext(JsonIterator.java:147)
... 7 more

2) -------------------------------------

jaql> $numRecoms = 10.0;

jaql> hdfsShell(strcat("-getmerge ",$hdfsPath,"/results-xi2.",
$numRecoms,"-recoms.csv ",
$outputPath,"/xi2/",$numRecoms,".csv addln"))
;
0

jaql> $numRecoms = 20.0;

jaql> hdfsShell(strcat("-getmerge ",$hdfsPath,"/results-xi2.",
$numRecoms,"-recoms.csv ",
$outputPath,"/xi2/",$numRecoms,".csv addln"))
;
0

jaql> $numRecoms = 30.0;

jaql> hdfsShell(strcat("-getmerge ",$hdfsPath,"/results-xi2.",
$numRecoms,"-recoms.csv ",
$outputPath,"/xi2/",$numRecoms,".csv addln"))
;
0

jaql> $numRecoms = 40.0;

jaql> hdfsShell(strcat("-getmerge ",$hdfsPath,"/results-xi2.",
$numRecoms,"-recoms.csv ",
$outputPath,"/xi2/",$numRecoms,".csv addln"))
;
0

jaql> $numRecoms = 50.0;

jaql> hdfsShell(strcat("-getmerge ",$hdfsPath,"/results-xi2.",
$numRecoms,"-recoms.csv ",
$outputPath,"/xi2/",$numRecoms,".csv addln"))
;
0
Reply all
Reply to author
Forward
0 new messages