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

Codegen: handle shortest path computations in the select operator


diffs (50 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
@@ -2611,6 +2611,7 @@ rel2bin_select( mvc *sql, sql_rel *rel, 
        node *en, *n;
        stmt *sub = NULL, *sel = NULL;
        stmt *predicate = NULL;
+       list *shooortestpaths = sa_list(sql->sa);
 
        if (rel->l) { /* first construct the sub relation */
                sub = subrel_bin(sql, rel->l, refs);
@@ -2659,6 +2660,10 @@ rel2bin_select( mvc *sql, sql_rel *rel, 
                } else {
                        sel = s;
                }
+
+               if(s->type == st_spfw && (s->flag & SPFW_SHORTEST_PATH)){
+                       list_append(shooortestpaths, s);
+               }
        }
 
        /* construct relation */
@@ -2674,6 +2679,13 @@ rel2bin_select( mvc *sql, sql_rel *rel, 
                        list_append(l, col);
                }
        }
+       for (n = shooortestpaths->h; n; n = n->next){
+               stmt *spfw = n->data;
+               stmt *s = stmt_result(sql->sa, spfw, 2);
+               s = stmt_alias(sql->sa, s, spfw->tname, spfw->cname);
+               list_append(l, s);
+       }
+
        return stmt_list(sql->sa, l);
 }
 
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
@@ -1675,8 +1675,8 @@ stmt_spfw(sql_allocator *sa, stmt* query
        s->op2 = graph;
        s->flag = flags;
 
-       // strong suspects these are the output cols of the operator
-       s->nrcols = 1;
+       s->nrcols = 2;
+       if(flags & SPFW_SHORTEST_PATH) { s->nrcols++; }
 
        return s;
 }
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to