LOG ERROR in multi-phase aggregation planning with CSQ
@@ -3717,6 +3717,11 @@ Node* finalize_split_expr_mutator(Node *node, MppGroupContext *ctx)
elog(ERROR,"Unexpected failure of multi-phase aggregation planning");
}
+ /* sanity check. */
+ if (attrno < 1 || attrno > list_length(ctx->top_tlist))
+ elog(ERROR, "invalid attrno %d, should be in the range [1, %d]",
+ attrno, list_length(ctx->top_tlist));
+
tle = (TargetEntry*) list_nth(ctx->top_tlist, attrno - 1);
return (Node*) tle->expr;
