Merge pull request #2957 from citusdata/dont-distribute-aggregate-named-invalid

Begin searching AggregateNames from 1, not 0
pull/2963/head
Philip Dubé 2019-09-12 17:02:06 +00:00 committed by GitHub
commit d23185d077
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 37 additions and 5 deletions

View File

@ -2896,7 +2896,9 @@ GetAggregateType(Oid aggFunctionId)
}
aggregateCount = lengthof(AggregateNames);
for (aggregateIndex = 0; aggregateIndex < aggregateCount; aggregateIndex++)
Assert(AGGREGATE_INVALID_FIRST == 0);
for (aggregateIndex = 1; aggregateIndex < aggregateCount; aggregateIndex++)
{
const char *aggregateName = AggregateNames[aggregateIndex];
if (strncmp(aggregateName, aggregateProcName, NAMEDATALEN) == 0)

View File

@ -544,7 +544,6 @@ COPY articles_single_shard TO stdout;
DEBUG: Creating router plan
DEBUG: Plan is router executable
50 10 anjanette 19519
-- error out for queries with aggregates
SELECT avg(word_count)
FROM articles
WHERE author_id = 2;
@ -556,6 +555,16 @@ DETAIL: distribution column value: 2
12356.400000000000
(1 row)
-- error out on unsupported aggregate
SET client_min_messages to 'NOTICE';
CREATE AGGREGATE public.invalid(int) (
sfunc = int4pl,
stype = int
);
SELECT invalid(word_count) FROM articles;
ERROR: unsupported aggregate function invalid
DROP AGGREGATE invalid(int);
SET client_min_messages to 'DEBUG2';
-- max, min, sum, count is somehow implemented
-- differently in distributed planning
SELECT max(word_count) as max, min(word_count) as min,

View File

@ -488,7 +488,6 @@ COPY articles_single_shard TO stdout;
DEBUG: Creating router plan
DEBUG: Plan is router executable
50 10 anjanette 19519
-- error out for queries with aggregates
SELECT avg(word_count)
FROM articles
WHERE author_id = 2;
@ -500,6 +499,16 @@ DETAIL: distribution column value: 2
12356.400000000000
(1 row)
-- error out on unsupported aggregate
SET client_min_messages to 'NOTICE';
CREATE AGGREGATE public.invalid(int) (
sfunc = int4pl,
stype = int
);
SELECT invalid(word_count) FROM articles;
ERROR: unsupported aggregate function invalid
DROP AGGREGATE invalid(int);
SET client_min_messages to 'DEBUG2';
-- max, min, sum, count is somehow implemented
-- differently in distributed planning
SELECT max(word_count) as max, min(word_count) as min,

View File

@ -271,11 +271,24 @@ SELECT id
-- copying from a single shard table does not require the master query
COPY articles_single_shard TO stdout;
-- error out for queries with aggregates
SELECT avg(word_count)
FROM articles
WHERE author_id = 2;
-- error out on unsupported aggregate
SET client_min_messages to 'NOTICE';
CREATE AGGREGATE public.invalid(int) (
sfunc = int4pl,
stype = int
);
SELECT invalid(word_count) FROM articles;
DROP AGGREGATE invalid(int);
SET client_min_messages to 'DEBUG2';
-- max, min, sum, count is somehow implemented
-- differently in distributed planning
SELECT max(word_count) as max, min(word_count) as min,
@ -313,5 +326,4 @@ SELECT * FROM articles TABLESAMPLE BERNOULLI (0) WHERE author_id = 1;
SELECT * FROM articles TABLESAMPLE SYSTEM (100) WHERE author_id = 1 ORDER BY id;
SELECT * FROM articles TABLESAMPLE BERNOULLI (100) WHERE author_id = 1 ORDER BY id;
SET client_min_messages to 'NOTICE';