Changeset: 81dead2a0533 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=81dead2a0533
Modified Files:
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql_statement.c
sql/backends/monet5/sql_statement.h
Branch: graph0
Log Message:
CODEGEN: do not sort the candidates in case of a select
The function "graph.intersect_join_lists" can be now invoked with
unsorted inputs. The sorting occurs inside the function itself.
diffs (110 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
@@ -4791,50 +4791,22 @@ rel2bin_graph(backend *be, sql_rel* rel,
join_left = releqjoin(be, lhs, domain_list, /*used_hash = */
false, cmp_equal, /* need_left = */ false);
join_right = releqjoin(be, rhs, domain_list, /*used_hash = */
false, cmp_equal, /* need_left = */ false);
-
- // intersect the two lists, so that we have only the columns
part of the domain
+ // generate the query parameters
+ lst1 = sa_list(sql->sa);
+ list_append(lst1, void2oid(stmt_result(be, join_left, 0)));
+ list_append(lst1, void2oid(stmt_result(be, join_right, 0)));
+ list_append(lst1, void2oid(stmt_result(be, join_left, 1)));
+ list_append(lst1, void2oid(stmt_result(be, join_right, 1)));
+ query = stmt_list(be, lst1); lst1 = NULL;
+
+ // in case of a SELECT intersect the two lists, so that we have
only the columns part of the domain
+ // there is no more need to ensure the candidates are sorted,
graph.intersect_join_lists can deal
+ // with it
if(rel->op == op_graph_select){
- stmt *jll = stmt_result(be, join_left, 0);
- stmt *jlr = stmt_result(be, join_left, 1);
- stmt *jrl = stmt_result(be, join_right, 0);
- stmt *jrr = stmt_result(be, join_right, 1);
-
- // sort left & right
- jll = stmt_order(be, jll, /* direction (0 = DESC, 1 =
ASC) = */ 1);
- jlr = stmt_project(be, stmt_result(be, jll, 1), jlr);
- jrl = stmt_order(be, jrl, /* direction (0 = DESC, 1 =
ASC) = */ 1);
- jrr = stmt_project(be, stmt_result(be, jrl, 1), jrr);
-
- // remove those damn VOIDs
- jll = void2oid(jll);
- jlr = void2oid(jlr);
- jrl = void2oid(jrl);
- jrr = void2oid(jrr);
-
- // intersect the elements
- lst1 = sa_list(sql->sa);
- list_append(lst1, jll);
- list_append(lst1, jrl);
- list_append(lst1, jlr);
- list_append(lst1, jrr);
- query = stmt_gr8_intersect_join_lists(be, stmt_list(be,
lst1));
- lst1 = NULL;
-
- } else { // this is join
- assert(rel->op == op_graph_join);
-
- // generate the query parameters
- lst1 = sa_list(sql->sa);
- list_append(lst1, void2oid(stmt_result(be, join_left,
0)));
- list_append(lst1, void2oid(stmt_result(be, join_right,
0)));
- list_append(lst1, void2oid(stmt_result(be, join_left,
1)));
- list_append(lst1, void2oid(stmt_result(be, join_right,
1)));
- query = stmt_list(be, lst1);
- lst1 = NULL;
+ query = stmt_gr8_intersect_join_lists(be, query);
+ } else { // op_graph_join
+ spfw_flags |= SPFW_JOIN;
}
-
- if(rel->op == op_graph_join)
- spfw_flags |= SPFW_JOIN;
} while(0);
// weights
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
@@ -3666,7 +3666,7 @@ stmt_gr8_intersect_join_lists(backend *b
stmt *
-stmt_gr8_spfw(backend *be, stmt *query, stmt *edge_from, stmt *edge_to, stmt
*weights, int flags) {
+stmt_gr8_spfw(backend *be, stmt *query, stmt *edge_from, stmt *edge_to, stmt
*weights, int global_flags) {
InstrPtr q = NULL;
stmt *s = NULL;
int dest = -1;
@@ -3700,7 +3700,7 @@ stmt_gr8_spfw(backend *be, stmt *query,
for(node *n = weights->op4.lval->h; n; n = n->next){ // weights
EVIL_PUSH(n->data);
}
- q = pushInt(be->mb, q, flags);
+ q = pushInt(be->mb, q, global_flags);
#undef EVIL_PUSH
@@ -3716,7 +3716,7 @@ stmt_gr8_spfw(backend *be, stmt *query,
s = stmt_create(be->mvc->sa, st_gr8_spfw);
s->nr = dest;
s->q = q;
- s->flag = flags;
+ s->flag = global_flags;
s->op1 = query;
s->op2 = stmt_list(be, append(append(sa_list(be->mvc->sa), edge_from),
edge_to));
s->op3 = weights;
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
@@ -244,7 +244,7 @@ extern stmt *stmt_gr8_concat(backend *be
extern stmt *stmt_gr8_slices(backend *be, stmt *op, int num); // the opposite
of concat, split a column in
extern stmt *stmt_gr8_void2oid(backend *be, stmt *op); // transform a BAT of
type voids into oids
extern stmt *stmt_gr8_intersect_join_lists(backend *be, stmt* query); //
remove mismatching tuples from the given query list (needed for the select
semantic)
-extern stmt *stmt_gr8_spfw(backend *be, stmt *query, stmt *edge_from, stmt
*edge_to, stmt *weights, int flags); // shortest path op~
+extern stmt *stmt_gr8_spfw(backend *be, stmt *query, stmt *edge_from, stmt
*edge_to, stmt *weights, int global_flags); // shortest path op~
extern sql_subtype *tail_type(stmt *st);
extern int stmt_has_null(stmt *s);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list