Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
419b91c0
Commit
419b91c0
authored
Mar 21, 1999
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correct some comments, fix a small memory wastage when datatype
is pass-by-value.
parent
beb1851d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
12 deletions
+15
-12
src/backend/executor/nodeAgg.c
src/backend/executor/nodeAgg.c
+15
-12
No files found.
src/backend/executor/nodeAgg.c
View file @
419b91c0
...
@@ -67,10 +67,14 @@ static Datum aggGetAttr(TupleTableSlot *tuple, Aggref *aggref, bool *isNull);
...
@@ -67,10 +67,14 @@ static Datum aggGetAttr(TupleTableSlot *tuple, Aggref *aggref, bool *isNull);
* value1[i] = initcond1
* value1[i] = initcond1
* value2[i] = initcond2
* value2[i] = initcond2
* forall tuples do
* forall tuples do
* value1[i] = sfunc1(
aggregate_attribute, value1[i]
)
* value1[i] = sfunc1(
value1[i], aggregated_value
)
* value2[i] = sfunc2(value2[i])
* value2[i] = sfunc2(value2[i])
* value1[i] = finalfunc(value1[i], value2[i])
* value1[i] = finalfunc(value1[i], value2[i])
*
*
* If initcond1 is NULL then the first non-NULL aggregated_value is
* assigned directly to value1[i]. sfunc1 isn't applied until value1[i]
* is non-NULL.
*
* If the outer subplan is a Group node, ExecAgg returns as many tuples
* If the outer subplan is a Group node, ExecAgg returns as many tuples
* as there are groups.
* as there are groups.
*
*
...
@@ -272,7 +276,6 @@ ExecAgg(Agg *node)
...
@@ -272,7 +276,6 @@ ExecAgg(Agg *node)
{
{
Aggref
*
aggref
=
lfirst
(
alist
);
Aggref
*
aggref
=
lfirst
(
alist
);
AttrNumber
attnum
;
AttrNumber
attnum
;
int2
attlen
=
0
;
Datum
newVal
=
(
Datum
)
NULL
;
Datum
newVal
=
(
Datum
)
NULL
;
AggFuncInfo
*
aggfns
=
&
aggFuncInfo
[
++
aggno
];
AggFuncInfo
*
aggfns
=
&
aggFuncInfo
[
++
aggno
];
Datum
args
[
2
];
Datum
args
[
2
];
...
@@ -309,6 +312,7 @@ ExecAgg(Agg *node)
...
@@ -309,6 +312,7 @@ ExecAgg(Agg *node)
{
{
if
(
noInitValue
[
aggno
])
if
(
noInitValue
[
aggno
])
{
{
int
attlen
=
0
;
int
byVal
=
0
;
int
byVal
=
0
;
/*
/*
...
@@ -352,16 +356,16 @@ ExecAgg(Agg *node)
...
@@ -352,16 +356,16 @@ ExecAgg(Agg *node)
default:
default:
elog
(
ERROR
,
"ExecAgg: Bad Agg->Target for Agg %d"
,
aggno
);
elog
(
ERROR
,
"ExecAgg: Bad Agg->Target for Agg %d"
,
aggno
);
}
}
if
(
attlen
==
-
1
)
{
/* variable length */
attlen
=
VARSIZE
((
struct
varlena
*
)
newVal
);
}
value1
[
aggno
]
=
(
Datum
)
palloc
(
attlen
);
if
(
byVal
)
if
(
byVal
)
value1
[
aggno
]
=
newVal
;
value1
[
aggno
]
=
newVal
;
else
else
memmove
((
char
*
)
(
value1
[
aggno
]),
(
char
*
)
newVal
,
attlen
);
{
if
(
attlen
==
-
1
)
/* variable length */
attlen
=
VARSIZE
((
struct
varlena
*
)
newVal
);
value1
[
aggno
]
=
(
Datum
)
palloc
(
attlen
);
memcpy
((
char
*
)
(
value1
[
aggno
]),
(
char
*
)
newVal
,
attlen
);
}
noInitValue
[
aggno
]
=
0
;
noInitValue
[
aggno
]
=
0
;
nulls
[
aggno
]
=
0
;
nulls
[
aggno
]
=
0
;
}
}
...
@@ -380,10 +384,9 @@ ExecAgg(Agg *node)
...
@@ -380,10 +384,9 @@ ExecAgg(Agg *node)
if
(
aggfns
->
xfn2
.
fn_addr
!=
NULL
)
if
(
aggfns
->
xfn2
.
fn_addr
!=
NULL
)
{
{
Datum
xfn2_val
=
value2
[
aggno
];
args
[
0
]
=
value2
[
aggno
];
value2
[
aggno
]
=
(
Datum
)
fmgr_c
(
&
aggfns
->
xfn2
,
value2
[
aggno
]
=
(
Datum
)
fmgr_c
(
&
aggfns
->
xfn2
,
(
FmgrValues
*
)
&
xfn2_val
,
&
isNull2
);
(
FmgrValues
*
)
args
,
&
isNull2
);
Assert
(
!
isNull2
);
Assert
(
!
isNull2
);
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment