Changeset: 8cb1af433640 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8cb1af433640
Modified Files:
sql/server/rel_select.c
sql/server/sql_parser.y
Branch: analytics
Log Message:
Use a broader range of expressions when calculating the boundaries.
diffs (67 lines):
diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c
--- a/sql/server/rel_select.c
+++ b/sql/server/rel_select.c
@@ -4703,7 +4703,8 @@ rel_rankop(mvc *sql, sql_rel **rel, symb
dnode *d =
window_specification->h->next->next->data.sym->data.lval->h;
exp_kind ek = {type_value, card_column, FALSE};
int excl = d->next->next->next->data.i_val;
- unsigned char sclass, eclass;
+ sql_subtype* st, *et;
+ unsigned char sclass = 0, eclass = 0;
frame_type = d->next->next->data.i_val;
if(!aggr)
@@ -4728,16 +4729,20 @@ rel_rankop(mvc *sql, sql_rel **rel, symb
fstart = rel_value_exp2(sql, &p, d->data.sym, f, ek, &is_last);
if(!fstart)
return NULL;
- sclass = fstart->tpe.type->eclass;
- if(!(sclass == EC_POS || sclass == EC_NUM || sclass == EC_DEC
|| EC_INTERVAL(sclass)))
+ st = exp_subtype(fstart);
+ if(st)
+ sclass = st->type->eclass;
+ if(!st || !(sclass == EC_POS || sclass == EC_NUM || sclass ==
EC_DEC || EC_INTERVAL(sclass)))
return sql_error(sql, 02, SQLSTATE(42000) "PRECEDING
offset column must be of a countable SQL type");
is_last = 0;
fend = rel_value_exp2(sql, &p, d->next->data.sym, f, ek,
&is_last);
if (!fend)
return NULL;
- eclass = fend->tpe.type->eclass;
- if(!(eclass == EC_POS || eclass == EC_NUM || eclass == EC_DEC
|| EC_INTERVAL(eclass)))
+ et = exp_subtype(fend);
+ if(et)
+ eclass = et->type->eclass;
+ if(!et || !(eclass == EC_POS || eclass == EC_NUM || eclass ==
EC_DEC || EC_INTERVAL(eclass)))
return sql_error(sql, 02, SQLSTATE(42000) "FOLLOWING
offset column must be of a countable SQL type");
if(calculate_window_bounds(sql, &start, &eend, s, gbe ? pe :
NULL, obe ? obe->t->data : in, fstart, fend, frame_type, excl) == NULL)
diff --git a/sql/server/sql_parser.y b/sql/server/sql_parser.y
--- a/sql/server/sql_parser.y
+++ b/sql/server/sql_parser.y
@@ -4190,9 +4190,9 @@ window_frame_extent:
;
window_frame_start:
- UNBOUNDED PRECEDING { sql_subtype *t = sql_bind_localtype("lng");
$$ = _newAtomNode( atom_int(SA, t, GDK_lng_max)); }
- | value_exp PRECEDING { $$ = $1; }
- | CURRENT ROW { sql_subtype *t =
sql_bind_localtype("lng"); $$ = _newAtomNode( atom_int(SA, t, 0)); }
+ UNBOUNDED PRECEDING { sql_subtype *t = sql_bind_localtype("lng"); $$
= _newAtomNode( atom_int(SA, t, GDK_lng_max)); }
+ | simple_atom PRECEDING { $$ = $1; }
+ | CURRENT ROW { sql_subtype *t =
sql_bind_localtype("lng"); $$ = _newAtomNode( atom_int(SA, t, 0)); }
;
window_frame_between:
@@ -4200,9 +4200,9 @@ window_frame_between:
;
window_frame_end:
- UNBOUNDED FOLLOWING { sql_subtype *t = sql_bind_localtype("lng");
$$ = _newAtomNode( atom_int(SA, t, GDK_lng_max)); }
- | value_exp FOLLOWING { $$ = $1; }
- | CURRENT ROW { sql_subtype *t =
sql_bind_localtype("lng"); $$ = _newAtomNode( atom_int(SA, t, 0)); }
+ UNBOUNDED FOLLOWING { sql_subtype *t = sql_bind_localtype("lng"); $$
= _newAtomNode( atom_int(SA, t, GDK_lng_max)); }
+ | simple_atom FOLLOWING { $$ = $1; }
+ | CURRENT ROW { sql_subtype *t =
sql_bind_localtype("lng"); $$ = _newAtomNode( atom_int(SA, t, 0)); }
;
window_frame_exclusion:
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list