Changeset: 95ded0d1bc4a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/95ded0d1bc4a
Modified Files:
sql/backends/monet5/rel_bin.c
Branch: default
Log Message:
cleanup to align code more between newer branches
diffs (truncated from 457 to 300 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
@@ -373,7 +373,7 @@ row2cols(backend *be, stmt *sub)
for (n = sub->op4.lval->h; n; n = n->next) {
stmt *sc = n->data;
- assert(sc->type == st_alias);
+ assert(sc->label);
const char *cname = column_name(be->mvc->sa, sc);
const char *tname = table_name(be->mvc->sa, sc);
int label = sc->label;
@@ -449,7 +449,6 @@ subrel_project(backend *be, stmt *s, lis
if (c->type != st_alias || c->flag) {
c = stmt_project(be, cand, c);
} else if (c->op1->type == st_mirror && is_tid_chain(cand)) {
/* alias with mirror (ie full row ids) */
- //c = stmt_alias(be, cand, 0, c->tname, c->cname);
c = stmt_as(be, cand, c);
} else { /* st_alias */
stmt *s = c->op1;
@@ -457,7 +456,6 @@ subrel_project(backend *be, stmt *s, lis
s = stmt_const(be, cand, s);
else
s = stmt_project(be, cand, s);
- //c = stmt_alias(be, s, c->flag, c->tname, c->cname);
c = stmt_as(be, s, c);
}
append(l, c);
@@ -1264,7 +1262,7 @@ exp2bin_coalesce(backend *be, sql_exp *f
return res;
}
-// This is the per-column portion of exp2bin_copyfrombinary
+/* This is the per-column portion of exp2bin_copyfrombinary */
static stmt *
emit_loadcolumn(backend *be, stmt *onclient_stmt, stmt *bswap_stmt, int
*count_var, node *file_node, node *type_node)
{
@@ -1276,11 +1274,11 @@ emit_loadcolumn(backend *be, stmt *oncli
int data_type = subtype->type->localtype;
int bat_type = newBatType(data_type);
- // The sql.importColumn operator takes a 'method' string to determine
how to
- // load the data. This leaves the door open to have multiple loaders
for the
- // same backend type, for example nul- and newline terminated strings.
- // For the time being we just use the name of the storage type as the
method
- // name.
+ /* The sql.importColumn operator takes a 'method' string to determine
how to
+ * load the data. This leaves the door open to have multiple loaders
for the
+ * same backend type, for example nul- and newline terminated strings.
+ * For the time being we just use the name of the storage type as the
method
+ * name. */
const char *method = ATOMname(data_type);
int width;
@@ -1300,7 +1298,7 @@ emit_loadcolumn(backend *be, stmt *oncli
if (p != NULL) {
setArgType(mb, p, 0, bat_type);
p = pushReturn(mb, p, new_count_var);
- //
+
p = pushStr(mb, p, method);
p = pushInt(mb, p, width);
p = pushArgument(mb, p, bswap_stmt->nr);
@@ -1324,7 +1322,7 @@ emit_loadcolumn(backend *be, stmt *oncli
return s;
}
-// Try to predict which column will be quickest to load first
+/* Try to predict which column will be quickest to load first */
static int
node_type_score(node *n)
{
@@ -1353,7 +1351,7 @@ exp2bin_copyfrombinary(backend *be, sql_
sql_exp *bswap_exp = arg_list->h->next->next->next->data;
stmt *bswap_stmt = exp_bin(be, bswap_exp, NULL, NULL, NULL, NULL, NULL,
NULL, 0, 0, 0);
- // If it's ON SERVER we can optimize by running the imports in parallel
+ /* If it's ON SERVER we can optimize by running the imports in parallel
*/
bool onserver = false;
if (onclient_exp->type == e_atom) {
atom *onclient_atom = onclient_exp->l;
@@ -1365,10 +1363,10 @@ exp2bin_copyfrombinary(backend *be, sql_
node *const first_type = type_list->h;
node *file, *type;
- // The first column we load determines the number of rows.
- // We pass it on to the other columns.
- // The first column to load should therefore be an 'easy' one.
- // We identify the columns by the address of their type node.
+ /* The first column we load determines the number of rows.
+ * We pass it on to the other columns.
+ * The first column to load should therefore be an 'easy' one.
+ * We identify the columns by the address of their type node. */
node *prototype_file = first_file;
node *prototype_type = first_type;
int score = node_type_score(prototype_type);
@@ -1381,7 +1379,7 @@ exp2bin_copyfrombinary(backend *be, sql_
}
}
- // Emit the columns
+ /* Emit the columns */
int count_var = -1;
list *columns = sa_list(sql->sa);
if (columns == NULL)
@@ -1401,8 +1399,8 @@ exp2bin_copyfrombinary(backend *be, sql_
}
list_append(columns, s);
if (onserver) {
- // Not threading the count variable from one
importColumn to the next
- // makes it possible to run them in parallel in a
dataflow region.
+ /* Not threading the count variable from one
importColumn to the next
+ * makes it possible to run them in parallel in a
dataflow region. */
count_var = orig_count_var;
}
}
@@ -1634,7 +1632,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l
if (!l)
return NULL;
if (from->type->eclass == EC_SEC && to->type->eclass == EC_SEC)
{
- // trivial conversion because EC_SEC is always in
milliseconds
+ /* trivial conversion because EC_SEC is always in
milliseconds */
s = l;
} else if (depth && sel && l->nrcols == 0 && left &&
left->nrcols && exp_unsafe(e, false, true)) {
stmt *rows = bin_find_smallest_column(be, left);
@@ -1784,15 +1782,14 @@ exp_bin(backend *be, sql_exp *e, stmt *l
return NULL;
append(l, stmt_project(be, u, a));
}
- if (r) {
+ if (r) { /* check new ordered aggregation */
list *obe = r->h->data;
if (obe && obe->h) {
- stmt *orderby = NULL, *orderby_vals,
*orderby_ids, *orderby_grp;
+ stmt *orderby = NULL, *orderby_ids,
*orderby_grp;
/* order by */
if (grp) {
orderby = stmt_order(be, grp,
true, true);
- orderby_vals = stmt_result(be,
orderby, 0);
orderby_ids = stmt_result(be,
orderby, 1);
orderby_grp = stmt_result(be,
orderby, 2);
}
@@ -1807,7 +1804,6 @@ exp_bin(backend *be, sql_exp *e, stmt *l
orderby =
stmt_reorder(be, os, is_ascending(oe), nulls_last(oe), orderby_ids,
orderby_grp);
else
orderby =
stmt_order(be, os, is_ascending(oe), nulls_last(oe));
- orderby_vals = stmt_result(be,
orderby, 0);
orderby_ids = stmt_result(be,
orderby, 1);
orderby_grp = stmt_result(be,
orderby, 2);
}
@@ -1816,7 +1812,6 @@ exp_bin(backend *be, sql_exp *e, stmt *l
n->data = stmt_project(be,
orderby_ids, n->data);
if (grp)
grp = stmt_project(be,
orderby_ids, grp);
- (void)orderby_vals;
}
}
as = stmt_list(be, l);
@@ -1840,10 +1835,8 @@ exp_bin(backend *be, sql_exp *e, stmt *l
} break;
case e_column: {
if (right) /* check relation names */
- //s = bin_find_column(be, right, e->l, e->r);
s = bin_find_column_nid(be, right, e->nid);
if (!s && left)
- //s = bin_find_column(be, left, e->l, e->r);
s = bin_find_column_nid(be, left, e->nid);
if (s && grp)
s = stmt_project(be, ext, s);
@@ -2316,7 +2309,6 @@ rel2bin_basetable(backend *be, sql_rel *
assert(!is_func(exp->type));
if (oname[0] == '%' && strcmp(oname, TID) == 0) {
/* tid function sql.tid(t) */
- //const char *rnme = t->base.name;
if (col)
s = stmt_mirror(be, col);
@@ -2324,7 +2316,6 @@ rel2bin_basetable(backend *be, sql_rel *
s = dels?dels:stmt_tid(be, t, 0);
dels = NULL;
}
- //s = stmt_alias(be, s, exp->alias.label, rnme, TID);
} else if (oname[0] == '%') {
sql_idx *i = find_sql_idx(t, oname+1);
@@ -2332,17 +2323,12 @@ rel2bin_basetable(backend *be, sql_rel *
if ((hash_index(i->type) && list_length(i->columns) <=
1) || !idx_has_column(i->type))
continue;
s = (i == fi) ? col : stmt_idx(be, i, NULL/*dels*/,
dels->partition);
- //s = stmt_alias(be, s, exp->alias.label, rname,
exp_name(exp));
} else {
sql_column *c = find_sql_column(t, oname);
s = (c == fcol) ? col : stmt_col(be, c, NULL/*dels*/,
dels->partition);
- //s = stmt_alias(be, s, exp->alias.label, rname,
exp_name(exp));
}
s = stmt_alias(be, s, exp->alias.label, rname, exp_name(exp));
- //s->tname = rname;
- //s->cname = exp_name(exp);
- //s->flag = exp->alias.label;
list_append(l, s);
}
stmt *res = stmt_list(be, l);
@@ -3122,7 +3108,7 @@ rel2bin_groupjoin(backend *be, sql_rel *
/* first project using equi-joins */
for (n = left->op4.lval->h; n; n = n->next) {
stmt *c = n->data;
- assert(c->type == st_alias);
+ assert(c->label);
const char *rnme = table_name(sql->sa, c);
const char *nme = column_name(sql->sa, c);
stmt *s = stmt_project(be, jl, column(be, c));
@@ -3132,7 +3118,7 @@ rel2bin_groupjoin(backend *be, sql_rel *
}
for (n = right->op4.lval->h; n; n = n->next) {
stmt *c = n->data;
- assert(c->type == st_alias);
+ assert(c->label);
const char *rnme = table_name(sql->sa, c);
const char *nme = column_name(sql->sa, c);
stmt *s = stmt_project(be, jr, column(be, c));
@@ -3189,7 +3175,7 @@ rel2bin_groupjoin(backend *be, sql_rel *
l = sa_list(sql->sa);
for (n = left->op4.lval->h; n; n = n->next) {
stmt *c = n->data;
- assert(c->type == st_alias);
+ assert(c->label);
const char *rnme = table_name(sql->sa, c);
const char *nme = column_name(sql->sa, c);
stmt *s = stmt_project(be, jl, column(be, c));
@@ -3200,7 +3186,7 @@ rel2bin_groupjoin(backend *be, sql_rel *
if (!mark && jr) {
for (n = right->op4.lval->h; n; n = n->next) {
stmt *c = n->data;
- assert(c->type == st_alias);
+ assert(c->label);
const char *rnme = table_name(sql->sa, c);
const char *nme = column_name(sql->sa, c);
stmt *s = stmt_project(be, jr, column(be, c));
@@ -3392,7 +3378,7 @@ rel2bin_join(backend *be, sql_rel *rel,
/* first project using equi-joins */
for (n = left->op4.lval->h; n; n = n->next) {
stmt *c = n->data;
- assert(c->type == st_alias);
+ assert(c->label);
const char *rnme = table_name(sql->sa, c);
const char *nme = column_name(sql->sa, c);
stmt *s = stmt_project(be, jl, column(be, c));
@@ -3402,7 +3388,7 @@ rel2bin_join(backend *be, sql_rel *rel,
}
for (n = right->op4.lval->h; n; n = n->next) {
stmt *c = n->data;
- assert(c->type == st_alias);
+ assert(c->label);
const char *rnme = table_name(sql->sa, c);
const char *nme = column_name(sql->sa, c);
stmt *s = stmt_project(be, jr, column(be, c));
@@ -3613,7 +3599,7 @@ rel2bin_antijoin(backend *be, sql_rel *r
/* first project after equi-joins */
for (n = left->op4.lval->h; n; n = n->next) {
stmt *c = n->data;
- assert(c->type == st_alias);
+ assert(c->label);
const char *rnme = table_name(sql->sa, c);
const char *nme = column_name(sql->sa, c);
stmt *s = stmt_project(be, jl, column(be, c));
@@ -3623,7 +3609,7 @@ rel2bin_antijoin(backend *be, sql_rel *r
}
for (n = right->op4.lval->h; n; n = n->next) {
stmt *c = n->data;
- assert(c->type == st_alias);
+ assert(c->label);
const char *rnme = table_name(sql->sa, c);
const char *nme = column_name(sql->sa, c);
stmt *s = stmt_project(be, jr, column(be, c));
@@ -3684,7 +3670,7 @@ rel2bin_antijoin(backend *be, sql_rel *r
/* project all the left columns */
for (n = left->op4.lval->h; n; n = n->next) {
stmt *c = n->data;
- assert(c->type == st_alias);
+ assert(c->label);
const char *rnme = table_name(sql->sa, c);
const char *nme = column_name(sql->sa, c);
stmt *s = stmt_project(be, join, column(be, c));
@@ -3851,7 +3837,7 @@ rel2bin_semijoin(backend *be, sql_rel *r
/* first project after equi-joins */
for (n = left->op4.lval->h; n; n = n->next) {
stmt *c = n->data;
- assert(c->type == st_alias);
+ assert(c->label);
const char *rnme = table_name(sql->sa, c);
const char *nme = column_name(sql->sa, c);
stmt *s = stmt_project(be, jl, column(be, c));
@@ -3861,7 +3847,7 @@ rel2bin_semijoin(backend *be, sql_rel *r
}
for (n = right->op4.lval->h; n; n = n->next) {
stmt *c = n->data;
- assert(c->type == st_alias);
+ assert(c->label);
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]