Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove function mattablecolumninfo_addinternal #6642

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion tsl/src/continuous_aggs/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ extern void RemoveRangeTableEntries(Query *query);
extern Query *build_union_query(CAggTimebucketInfo *tbinfo, int matpartcolno, Query *q1, Query *q2,
int materialize_htid);
extern void mattablecolumninfo_init(MatTableColumnInfo *matcolinfo, List *grouplist);
extern void mattablecolumninfo_addinternal(MatTableColumnInfo *matcolinfo);
extern bool function_allowed_in_cagg_definition(Oid funcid);
extern Oid get_watermark_function_oid(void);
extern Oid cagg_get_boundary_converter_funcoid(Oid typoid);
79 changes: 0 additions & 79 deletions tsl/src/continuous_aggs/materialize.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,82 +376,3 @@ mattablecolumninfo_init(MatTableColumnInfo *matcolinfo, List *grouplist)
matcolinfo->matpartcolno = -1;
matcolinfo->matpartcolname = NULL;
}

/*
* Add internal columns for the materialization table.
*/
void
mattablecolumninfo_addinternal(MatTableColumnInfo *matcolinfo)
{
Index maxRef;
int colno = list_length(matcolinfo->partial_seltlist) + 1;
ColumnDef *col;
Var *chunkfn_arg1;
FuncExpr *chunk_fnexpr;
Oid chunkfnoid;
Oid argtype[] = { OIDOID };
Oid rettype = INT4OID;
TargetEntry *chunk_te;
Oid sortop, eqop;
bool hashable;
ListCell *lc;
SortGroupClause *grpcl;

/* Add a chunk_id column for materialization table */
Node *vexpr = (Node *) makeVar(1, colno, INT4OID, -1, InvalidOid, 0);
col = makeColumnDef(CONTINUOUS_AGG_CHUNK_ID_COL_NAME,
exprType(vexpr),
exprTypmod(vexpr),
exprCollation(vexpr));
matcolinfo->matcollist = lappend(matcolinfo->matcollist, col);

/*
* Need to add an entry to the target list for computing chunk_id column
* : chunk_for_tuple( htid, table.*).
*/
chunkfnoid =
LookupFuncName(list_make2(makeString(FUNCTIONS_SCHEMA_NAME), makeString(CHUNKIDFROMRELID)),
sizeof(argtype) / sizeof(argtype[0]),
argtype,
false);
chunkfn_arg1 = makeVar(1, TableOidAttributeNumber, OIDOID, -1, 0, 0);

chunk_fnexpr = makeFuncExpr(chunkfnoid,
rettype,
list_make1(chunkfn_arg1),
InvalidOid,
InvalidOid,
COERCE_EXPLICIT_CALL);
chunk_te = makeTargetEntry((Expr *) chunk_fnexpr,
colno,
pstrdup(CONTINUOUS_AGG_CHUNK_ID_COL_NAME),
false);
matcolinfo->partial_seltlist = lappend(matcolinfo->partial_seltlist, chunk_te);
/* Any internal column needs to be added to the group-by clause as well. */
maxRef = 0;
foreach (lc, matcolinfo->partial_seltlist)
{
Index ref = ((TargetEntry *) lfirst(lc))->ressortgroupref;

if (ref > maxRef)
maxRef = ref;
}
chunk_te->ressortgroupref =
maxRef + 1; /* used by sortgroupclause to identify the targetentry */
grpcl = makeNode(SortGroupClause);
get_sort_group_operators(exprType((Node *) chunk_te->expr),
false,
true,
false,
&sortop,
&eqop,
NULL,
&hashable);
grpcl->tleSortGroupRef = chunk_te->ressortgroupref;
grpcl->eqop = eqop;
grpcl->sortop = sortop;
grpcl->nulls_first = false;
grpcl->hashable = hashable;

matcolinfo->partial_grouplist = lappend(matcolinfo->partial_grouplist, grpcl);
}