Skip to content

Commit

Permalink
Enable window functions
Browse files Browse the repository at this point in the history
  • Loading branch information
def- committed Oct 13, 2023
1 parent f8c2894 commit bec3f94
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions expr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ using impedance::matched;
shared_ptr<value_expr> value_expr::factory(prod *p, sqltype *type_constraint, bool can_return_set)
{
try {
// ERROR: aggregate window functions not yet supported
//if (1 == d20() && p->level < d6() && window_function::allowed(p))
// return make_shared<window_function>(p, type_constraint);
if (1 == d20() && p->level < d6() && window_function::allowed(p))
return make_shared<window_function>(p, type_constraint);
if (1 == d42() && p->level < d6() && type_constraint && type_constraint->name.rfind("list", 0) != 0 && type_constraint->name.rfind("map", 0) != 0 && type_constraint->name.rfind("record", 0) != 0 && type_constraint->name.rfind("any", 0) != 0)
return make_shared<coalesce>(p, type_constraint);
else if (1 == d42() && p->level < d6() && type_constraint && type_constraint->name.rfind("list", 0) != 0 && type_constraint->name.rfind("map", 0) != 0 && type_constraint->name.rfind("record", 0) != 0 && type_constraint->name.rfind("any", 0) != 0)
Expand Down Expand Up @@ -557,7 +556,7 @@ window_function::window_function(prod *p, sqltype *type_constraint)
: value_expr(p)
{
match();
aggregate = make_shared<funcall>(this, type_constraint, true);
aggregate = make_shared<funcall>(this, type_constraint, true, true);
type = aggregate->type;
partition_by.push_back(make_shared<column_reference>(this));
while(d6() > 4)
Expand Down

0 comments on commit bec3f94

Please sign in to comment.