Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit04b8b08

Browse files
committed
Add countany aggregate function
1 parent5781420 commit04b8b08

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

‎vops.c‎

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,8 +1020,8 @@ Datum vops_count_accumulate(PG_FUNCTION_ARGS)
10201020
PG_FUNCTION_INFO_V1(vops_count_accumulate_any);
10211021
Datumvops_count_accumulate_any(PG_FUNCTION_ARGS)
10221022
{
1023-
vops_tile_hdr*opd=PG_GETARG_VOPS_HDR(0);
1024-
int64count=PG_GETARG_INT64(1);
1023+
int64count=PG_GETARG_INT64(0);
1024+
vops_tile_hdr*opd=PG_GETARG_VOPS_HDR(1);
10251025
uint64mask=filter_mask& ~opd->empty_mask;
10261026
inti;
10271027
for (i=0;i<TILE_SIZE;i++) {
@@ -2632,6 +2632,17 @@ typedef struct
26322632
}vops_mutator_context;
26332633

26342634

2635+
staticOidnodeType(Node*node)
2636+
{
2637+
switch (nodeTag(node))
2638+
{
2639+
caseT_TargetEntry:
2640+
returnexprType((Node*)((TargetEntry*)node)->expr);
2641+
default:
2642+
returnexprType(node);
2643+
}
2644+
}
2645+
26352646
staticvoidreplace_count(vops_mutator_context*ctx)
26362647
{
26372648
Aggref*count=ctx->countall;
@@ -2641,7 +2652,7 @@ static void replace_count(vops_mutator_context* ctx)
26412652
{
26422653
count->aggfnoid=countany_oid;
26432654
count->aggstar= false;
2644-
count->aggargtypes=list_make1_oid(exprType(ctx->vector_col));
2655+
count->aggargtypes=list_make1_oid(nodeType(ctx->vector_col));
26452656
count->args=list_make1(ctx->vector_col);
26462657
}
26472658
else
@@ -2738,7 +2749,7 @@ vops_expression_tree_mutator(Node *node, void *context)
27382749
elseif (IsA(node,NullTest))
27392750
{
27402751
NullTest*test= (NullTest*)node;
2741-
if (!test->argisrow&&is_vops_type(exprType((Node*)test->arg)))
2752+
if (!test->argisrow&&is_vops_type(nodeType((Node*)test->arg)))
27422753
{
27432754
ctx->has_vector_ops= true;
27442755
ctx->vector_col= (Node*)test->arg;
@@ -2764,11 +2775,10 @@ vops_expression_tree_mutator(Node *node, void *context)
27642775
Aggref*agg= (Aggref*)node;
27652776
if (agg->aggfnoid==count_oid) {
27662777
Assert(agg->aggstar);
2778+
ctx->countall=agg;
27672779
if (ctx->has_vector_ops) {
2768-
agg->aggfnoid=countall_oid;
2780+
replace_count(ctx);
27692781
ctx->countall=NULL;
2770-
}else {
2771-
ctx->countall=agg;
27722782
}
27732783
}elseif (!agg->aggstar&& !ctx->has_vector_ops) {
27742784
Assert(list_length(agg->aggargtypes) >=1);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp