Changeset: c1296de1bef6 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c1296de1bef6
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: arrays
Log Message:
combine selections over dimensions and non-dimensions
diffs (88 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
@@ -2850,9 +2850,19 @@ rel2bin_select( mvc *sql, sql_rel *rel,
while(pushDimensionSelections(&sel));
if(sel->op1->type == st_join && sel->op1->op1->type == st_tid &&
isArray(sel->op1->op1->op4.tval) && sel->op1->op2->type ==
st_bat) {
-
- sel = stmt_mbr(sql->sa, sel, sel->op1->op1);
- //clearJoins(&(sel->op1));
+
+ /*find where the selections over dimensions start*/
+ stmt *selDims = sel;
+ while(selDims && selDims->op1->type != st_dimension)
+ selDims = selDims->op3;
+ if(selDims)
+ sel = stmt_mbr(sql->sa, sel, selDims, sel->op1->op1);
+ else
+ sel = stmt_mbr(sql->sa, sel, sel->op1->op1, NULL);
+
+ /*We could split the selections in two groups those over
non-dimensions and
+ * those over dimensions. Anyway, the two do not interact with
each other
+ * but only through the MBR */
}
////if it is an array we need to project the cells
//sel = addCells(sql, sel);
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
@@ -2142,19 +2142,24 @@ static int
break;
}
case st_mbr: {
- int l, r;
+ int l, r, m;
if ((l = _dumpstmt(sql, mb, s->op1)) < 0)
return -1;
if ((r = _dumpstmt(sql, mb, s->op2)) < 0)
return -1;
+ if(s->op3 && (m = _dumpstmt(sql, mb, s->op3)) < 0)
+ return -1;
q = newStmt2(mb, algebraRef, "mbr");
- q = pushArgument(mb, q, l); //the dimsResult
- snprintf(nme, SMALLBUFSIZ, "Y_%d", l);
- if((arraySecondVar = findVariable(mb, nme)) >= 0)
- q = pushArgument(mb, q, arraySecondVar); //the
oids result
- q = pushArgument(mb, q, r); //the array
+ q = pushArgument(mb, q, l); //the oids
+// snprintf(nme, SMALLBUFSIZ, "Y_%d", l);
+// if((arraySecondVar = findVariable(mb, nme)) >= 0)
+// q = pushArgument(mb, q, arraySecondVar); //the
oids result
+ q = pushArgument(mb, q, r); //the array or the candDims
+ if(s->op3)
+ q = pushArgument(mb, q, m); //the array
+
if (q == NULL)
return -1;
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
@@ -1256,10 +1256,11 @@ stmt *stmt_left_join(sql_allocator *sa,
return s;
}
-stmt *stmt_mbr(sql_allocator *sa, stmt *op1, stmt *op2) {
+stmt *stmt_mbr(sql_allocator *sa, stmt *op1, stmt *op2, stmt *op3) {
stmt *s = stmt_create(sa, st_mbr);
s->op1 = op1;
s->op2 = op2;
+ s->op3 = op3;
return s;
}
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
@@ -245,7 +245,7 @@ extern stmt *stmt_aggr(sql_allocator *sa
extern stmt *stmt_alias(sql_allocator *sa, stmt *op1, char *tname, char *name);
extern stmt *stmt_materialise(sql_allocator *sa, stmt *selectStmt, stmt*
joinStmt);
-extern stmt *stmt_mbr(sql_allocator *sa, stmt *op1, stmt *op2);
+extern stmt *stmt_mbr(sql_allocator *sa, stmt *op1, stmt *op2, stmt *op3);
extern stmt *stmt_left_join(sql_allocator *sq, stmt *op1, stmt *op2);
extern stmt *stmt_output(sql_allocator *sa, stmt *l);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list