Changeset: 7ee21a704937 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7ee21a704937
Modified Files:
        sql/backends/monet5/rel_bin.c
        sql/backends/monet5/sql_gencode.c
        sql/backends/monet5/sql_statement.c
        sql/backends/monet5/sql_statement.h
Branch: graph1
Log Message:

[Codegen] Differentiate between a join and a filter only scenario for the spfw 
stmt


diffs (91 lines):

diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c
--- a/sql/backends/monet5/rel_bin.c
+++ b/sql/backends/monet5/rel_bin.c
@@ -616,6 +616,7 @@ exp_bin(mvc *sql, sql_exp *e, stmt *left
                        sql_subaggr *aggr_count = sql_bind_aggr(sql->sa, 
sql->session->schema, "count", NULL);
                        stmt *domain =NULL, *query =NULL;
                        stmt *spfw =NULL;
+                       int spfw_flags = 0;
 
                        // generate the depending expressions
                        graph = subrel_bin(sql, g->edges, refs);
@@ -660,7 +661,8 @@ exp_bin(mvc *sql, sql_exp *e, stmt *left
                        query = stmt_list(sql->sa, l);
 
                        // run the operator
-                       spfw = stmt_spfw(sql->sa, query, graph);
+                       if(right != NULL){ spfw_flags |= SPFW_CROSS_PRODUCT; }
+                       spfw = stmt_spfw(sql->sa, query, graph, spfw_flags);
 
                        print_tree(sql->sa, spfw);
 
@@ -1754,7 +1756,7 @@ rel2bin_join( mvc *sql, sql_rel *rel, li
                        prop *p;
 
                        /* only handle simple joins here */             
-                       if (exp_has_func(e) && e->flag != cmp_filter) {
+                       if (exp_has_func(e) && (e->type != e_cmp || (e->flag != 
cmp_filter && e->flag != cmp_filter_graph))) {
                                if (!join && !list_length(lje)) {
                                        stmt *l = bin_first_column(sql->sa, 
left);
                                        stmt *r = bin_first_column(sql->sa, 
right);
@@ -1789,8 +1791,9 @@ rel2bin_join( mvc *sql, sql_rel *rel, li
                                idx = 1;
 
                        if (s->type != st_join && 
-                           s->type != st_join2 && 
-                           s->type != st_joinN) {
+                           s->type != st_join2 &&
+                           s->type != st_joinN &&
+                           s->type != st_spfw) {
                                /* predicate */
                                if (!list_length(lje) && s->nrcols == 0) { 
                                        stmt *l = bin_first_column(sql->sa, 
left);
diff --git a/sql/backends/monet5/sql_gencode.c 
b/sql/backends/monet5/sql_gencode.c
--- a/sql/backends/monet5/sql_gencode.c
+++ b/sql/backends/monet5/sql_gencode.c
@@ -2963,6 +2963,7 @@ static int
                                q = pushArgument(mb, q, ((stmt*) n->data)->nr);
                                n = n->next;
                        }
+                       q = pushBit(mb, q, s->flag & SPFW_CROSS_PRODUCT);
 
                        // abi convention
                        s->nr = getDestVar(q); // filter src
diff --git a/sql/backends/monet5/sql_statement.c 
b/sql/backends/monet5/sql_statement.c
--- a/sql/backends/monet5/sql_statement.c
+++ b/sql/backends/monet5/sql_statement.c
@@ -1668,11 +1668,12 @@ stmt_prefixsum(sql_allocator *sa, stmt* 
 
 
 stmt *
-stmt_spfw(sql_allocator *sa, stmt* query, stmt* graph)
+stmt_spfw(sql_allocator *sa, stmt* query, stmt* graph, int flags)
 {
        stmt *s = stmt_create(sa, st_spfw);
        s->op1 = query;
        s->op2 = graph;
+       s->flag = flags;
 
        // strong suspects these are the output cols of the operator
        s->nrcols = 1;
diff --git a/sql/backends/monet5/sql_statement.h 
b/sql/backends/monet5/sql_statement.h
--- a/sql/backends/monet5/sql_statement.h
+++ b/sql/backends/monet5/sql_statement.h
@@ -111,6 +111,8 @@ typedef enum stmt_type {
 #define ANTI ANTISEL
 #define GRP_DONE 32
 
+#define SPFW_CROSS_PRODUCT 0x1 /* Perform a cross product instead of a filter 
op~ */
+
 typedef struct stmt {
        st_type type;
        struct stmt *op1;
@@ -254,7 +256,7 @@ extern stmt *stmt_exp2vrtx(sql_allocator
 extern stmt *stmt_mkpartition(sql_allocator *sa, stmt *st, int partno, int 
num_partitions);
 extern stmt *stmt_prefixsum(sql_allocator *sa, stmt *op, stmt 
*domain_cardinality);
 extern stmt *stmt_slices(sql_allocator *sa, stmt *op, int num);
-extern stmt *stmt_spfw(sql_allocator *sa, stmt *query, stmt *graph);
+extern stmt *stmt_spfw(sql_allocator *sa, stmt *query, stmt *graph, int flags);
 extern stmt *stmt_void2oid(sql_allocator *sa, stmt *op);
 
 
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to