Changeset: f6983dd28584 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f6983dd28584
Modified Files:
monetdb5/extras/jaql/Tests/variable00.mal
monetdb5/extras/jaql/Tests/variable00.stable.out
monetdb5/extras/jaql/jaqlgencode.c
Branch: jacqueline
Log Message:
expand: clean BATs up more
while we cannot produce a real clean set of BATs, we can do more efforts
to remove whatever we know is now stale from the kind and array BATs
diffs (146 lines):
diff --git a/monetdb5/extras/jaql/Tests/variable00.mal
b/monetdb5/extras/jaql/Tests/variable00.mal
--- a/monetdb5/extras/jaql/Tests/variable00.mal
+++ b/monetdb5/extras/jaql/Tests/variable00.mal
@@ -2,3 +2,5 @@ jaql.x("A = [1,2,4,{\"a\": 5}];");
jaql.x("A;");
jaql.x("A -> filter $ <= 2;");
jaql.x("A -> filter each v v.a >= 5;");
+jaql.x("n = [ [3,65,8,72], [5,98,2,65] ];");
+jaql.x("n -> expand -> transform each n (n * 2);");
diff --git a/monetdb5/extras/jaql/Tests/variable00.stable.out
b/monetdb5/extras/jaql/Tests/variable00.stable.out
--- a/monetdb5/extras/jaql/Tests/variable00.stable.out
+++ b/monetdb5/extras/jaql/Tests/variable00.stable.out
@@ -21,10 +21,13 @@ function user.main():void;
jaql.x("A;");
jaql.x("A -> filter $ <= 2;");
jaql.x("A -> filter each v v.a >= 5;");
+ jaql.x("n = [ [3,65,8,72], [5,98,2,65] ];");
+ jaql.x("n -> expand -> transform each n (n * 2);");
end main;
[ 1, 2, 4, { "a": 5 } ]
[ 1, 2 ]
[ { "a": 5 } ]
+[ 6, 130, 16, 144, 10, 196, 4, 130 ]
# 21:12:04 >
# 21:12:04 > "Done."
diff --git a/monetdb5/extras/jaql/jaqlgencode.c
b/monetdb5/extras/jaql/jaqlgencode.c
--- a/monetdb5/extras/jaql/jaqlgencode.c
+++ b/monetdb5/extras/jaql/jaqlgencode.c
@@ -1864,15 +1864,42 @@ dumptree(jc *j, MalBlkPtr mb, tree *t)
break;
case j_expand:
a = dumpwalkvar(mb, j1, j5);
- a = dumprefvar(mb, t->tval2, a, j1, j6, j7);
+ c = dumprefvar(mb, t->tval2, a, j1, j6, j7);
+
q = newInstruction(mb, ASSIGNsymbol);
setModuleId(q, algebraRef);
setFunctionId(q, semijoinRef);
q = pushReturn(mb, q, newTmpVariable(mb,
TYPE_any));
q = pushArgument(mb, q, j1);
- q = pushArgument(mb, q, a);
+ q = pushArgument(mb, q, c);
a = getArg(q, 0);
pushInstruction(mb, q);
+
+ /* immediately cleanup j1 */
+ q = newInstruction(mb, ASSIGNsymbol);
+ setModuleId(q, algebraRef);
+ setFunctionId(q, putName("kdifference", 11));
+ q = pushReturn(mb, q, newTmpVariable(mb,
TYPE_any));
+ q = pushArgument(mb, q, j1);
+ q = pushArgument(mb, q, c);
+ j1 = getArg(q, 0);
+ pushInstruction(mb, q);
+ q = newInstruction(mb, ASSIGNsymbol);
+ setModuleId(q, batRef);
+ setFunctionId(q, reverseRef);
+ q = pushReturn(mb, q, newTmpVariable(mb,
TYPE_any));
+ q = pushArgument(mb, q, c);
+ b = getArg(q, 0);
+ pushInstruction(mb, q);
+ q = newInstruction(mb, ASSIGNsymbol);
+ setModuleId(q, algebraRef);
+ setFunctionId(q, putName("kdifference", 11));
+ q = pushReturn(mb, q, newTmpVariable(mb,
TYPE_any));
+ q = pushArgument(mb, q, j1);
+ q = pushArgument(mb, q, b);
+ j1 = getArg(q, 0);
+ pushInstruction(mb, q);
+
q = newInstruction(mb, ASSIGNsymbol);
setModuleId(q, algebraRef);
setFunctionId(q, uselectRef);
@@ -1889,54 +1916,42 @@ dumptree(jc *j, MalBlkPtr mb, tree *t)
q = pushReturn(mb, q, newTmpVariable(mb,
TYPE_any));
q = pushArgument(mb, q, j5);
q = pushArgument(mb, q, a);
- a = getArg(q, 0);
+ d = getArg(q, 0);
pushInstruction(mb, q);
q = newInstruction(mb, ASSIGNsymbol);
setModuleId(q, algebraRef);
setFunctionId(q, projectRef);
q = pushReturn(mb, q, newTmpVariable(mb,
TYPE_any));
q = pushOid(mb, q, 0); /* 0@0 = outermost
array */
- q = pushArgument(mb, q, a);
+ q = pushArgument(mb, q, d);
b = getArg(q, 0);
pushInstruction(mb, q);
- q = newInstruction(mb, ASSIGNsymbol);
- setModuleId(q, algebraRef);
- setFunctionId(q, putName("selectH", 7));
- q = pushReturn(mb, q, newTmpVariable(mb,
TYPE_any));
- q = pushArgument(mb, q, j1);
- q = pushOid(mb, q, 0);
- a = getArg(q, 0);
- pushInstruction(mb, q);
- q = newInstruction(mb, ASSIGNsymbol);
- setModuleId(q, algebraRef);
- setFunctionId(q, semijoinRef);
- q = pushReturn(mb, q, newTmpVariable(mb,
TYPE_any));
- q = pushArgument(mb, q, j5);
- q = pushArgument(mb, q, a);
- a = getArg(q, 0);
- pushInstruction(mb, q);
- q = newInstruction(mb, ASSIGNsymbol);
- setModuleId(q, algebraRef);
- setFunctionId(q, sunionRef);
- q = pushReturn(mb, q, newTmpVariable(mb,
TYPE_any));
- q = pushArgument(mb, q, a);
- q = pushArgument(mb, q, b);
- a = getArg(q, 0);
- pushInstruction(mb, q);
+
+ /* remove old arrays and 0@0 array from j5 */
q = newInstruction(mb, ASSIGNsymbol);
setModuleId(q, algebraRef);
setFunctionId(q, putName("sdifference", 11));
q = pushReturn(mb, q, newTmpVariable(mb,
TYPE_any));
q = pushArgument(mb, q, j5);
- q = pushArgument(mb, q, a);
- a = getArg(q, 0);
+ q = pushArgument(mb, q, d);
+ j5 = getArg(q, 0);
pushInstruction(mb, q);
q = newInstruction(mb, ASSIGNsymbol);
+ setModuleId(q, algebraRef);
+ setFunctionId(q, putName("kdifference", 11));
+ q = pushReturn(mb, q, newTmpVariable(mb,
TYPE_any));
+ q = pushArgument(mb, q, j5);
+ q = pushArgument(mb, q, b);
+ j5 = getArg(q, 0);
+ pushInstruction(mb, q);
+
+ /* append to top-level array */
+ q = newInstruction(mb, ASSIGNsymbol);
setModuleId(q, batRef);
setFunctionId(q, insertRef);
q = pushReturn(mb, q, newTmpVariable(mb,
TYPE_any));
- q = pushArgument(mb, q, a);
q = pushArgument(mb, q, b);
+ q = pushArgument(mb, q, j5);
j5 = getArg(q, 0);
pushInstruction(mb, q);
break;
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list