Skip to content

Commit

Permalink
Handle NamedArgs
Browse files Browse the repository at this point in the history
  • Loading branch information
jnidzwetzki committed Feb 1, 2024
1 parent 3fe816f commit 86547ec
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions tsl/src/continuous_aggs/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@ caggtimebucket_validate(CAggTimebucketInfo *tbinfo, List *groupClause, List *tar
DirectFunctionCall1(date_timestamp, const_arg->constvalue));
}
break;
// TODO: Handle NamedArgs
case TIMESTAMPOID:
/* Origin is always 3rd arg for timestamp variants. */
if (list_length(fe->args) == 3)
Expand All @@ -292,18 +291,10 @@ caggtimebucket_validate(CAggTimebucketInfo *tbinfo, List *groupClause, List *tar
/* Origin can be 3rd or 4th arg for timestamptz variants. */
if (list_length(fe->args) >= 3 && exprType(lthird(fe->args)) == TIMESTAMPTZOID)
{
Node *arg = lthird(fe->args);
custom_origin = true;
if (IsA(lthird(fe->args), Const))
{
tbinfo->origin =
DatumGetTimestampTz(castNode(Const, lthird(fe->args))->constvalue);
}
else if (IsA(lthird(fe->args), NamedArgExpr))
{
Const *constval = check_time_bucket_argument(lthird(fe->args), "third");

tbinfo->origin = DatumGetTimestampTz(constval->constvalue);
}
Const *constval = check_time_bucket_argument(arg, "third");
tbinfo->origin = DatumGetTimestampTz(constval->constvalue);
}
else if (list_length(fe->args) >= 4 &&
exprType(lfourth(fe->args)) == TIMESTAMPTZOID)
Expand Down

0 comments on commit 86547ec

Please sign in to comment.