Changeset: e5bfd0b5ed38 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e5bfd0b5ed38
Modified Files:
        monetdb5/extras/jaql/jaql.c
Branch: jacqueline
Log Message:

expand: pull out "inner pipes"

expand knows an odd syntax where it runs for each of its input arrays
first an "inner pipe" on the array, before its element members are
promoted to the top level.  While this "feature" seems to have no
benefit at all in functionality (it is as easily written as a top-level
pipe following the expand), it probably exists to steer code generation
for Hadoop's map-reduce jobs, like top and topn also do.  Since we don't
do that, we just rewrite "inner pipes" to become top level ones, and
leave optimisation to the engine itself, instead of having the user to
explicitly perform/know it.


diffs (35 lines):

diff --git a/monetdb5/extras/jaql/jaql.c b/monetdb5/extras/jaql/jaql.c
--- a/monetdb5/extras/jaql/jaql.c
+++ b/monetdb5/extras/jaql/jaql.c
@@ -233,10 +233,13 @@ make_jaql_expand(tree *var, tree *expr)
        tree *res = GDKzalloc(sizeof(tree));
        res->type = j_expand;
        res->tval1 = var;
+
+       assert(var->type == j_var);
+       assert(expr == NULL || expr->type == j_var);
+
        /* make execution easier by always giving expand an argument to
         * expand, which defaults to the var we're looping over as (usually
         * $, but modified with "each xxx") */
-       assert(var->type == j_var);
        if (expr == NULL) {
                expr = GDKzalloc(sizeof(tree));
                expr->type = j_var;
@@ -251,6 +254,16 @@ make_jaql_expand(tree *var, tree *expr)
                freetree(var);
                return res;
        }
+
+       if (expr->next != NULL) {
+               /* JAQL's confusing "inner pipes" feature -- most probably to
+                * steer Hadoop's map-reduce job generationi -- is just useless
+                * for us and actually making our life harder, so just pull out
+                * this inner pipe, and make it a proper top-level pipe instead 
*/
+               res->next = expr->next;
+               expr->next = NULL;
+       }
+
        res->tval2 = expr;
 
        return res;
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to