-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
sql: populate pg_catalog.pg_aggregate table #48126
sql: populate pg_catalog.pg_aggregate table #48126
Conversation
Thank you for contributing to CockroachDB. Please ensure you have followed the guidelines for creating a PR. My owl senses detect your PR is good for review. Please keep an eye out for any test failures in CI. I have added a few people who may be able to assist in reviewing:
🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan. |
Small Overview:
|
❌ The GitHub CI (Cockroach) build has failed on 7e73427f. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan. |
@rohany I think you'd be the best person to review this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the submission! I'm fine with leaving aggtransspace
as null.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @abhishek20123g, @jordanlewis, @rohany, and @solongordon)
pkg/sql/pg_catalog.go, line 2988 at r1 (raw file):
returnType := tree.NewDOid(tree.DInt(oid.T_bool)) switch name { case "max", "bit_or":
bit_or and bit_and don't have sort ops, but bool_and and bool_or do.
pkg/sql/pg_catalog.go, line 2996 at r1 (raw file):
err := addRow( h.BuiltinOid(name, &overload).AsRegProc(name), // aggfnoid tree.NewDString("n"), // aggkind
I'm not sure exactly why, but I think this needs to vary - rank
, percent_rank
, cume_dist
, and dense_rank
must be h
, and all of the percentile
ones need to be o
.
pkg/sql/pg_catalog.go, line 2997 at r1 (raw file):
h.BuiltinOid(name, &overload).AsRegProc(name), // aggfnoid tree.NewDString("n"), // aggkind tree.NewDInt(0), // aggnumdirectargs
Use tree.DZero
pkg/sql/pg_catalog.go, line 2998 at r1 (raw file):
tree.NewDString("n"), // aggkind tree.NewDInt(0), // aggnumdirectargs tree.DNull, // aggtransfn
That ones that say (zero if none) in the docs should be DZero, not null, I think. Refer to this: https://www.postgresql.org/docs/12/catalog-pg-aggregate.html
pkg/sql/pg_catalog.go, line 3006 at r1 (raw file):
tree.DNull, // aggminvtransfn tree.DNull, // aggmfinalfn tree.DNull, // aggfinalextra
This and the next should be DFalse, not null.
7e73427
to
d33c19f
Compare
Thank you for updating your pull request. My owl senses detect your PR is good for review. Please keep an eye out for any test failures in CI. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan. |
Thanks for the review @jordanlewis Made Changes as you suggested 😊
|
d33c19f
to
adf60ea
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good!
pkg/sql/sqlbase/constants.go
Outdated
@@ -142,6 +142,7 @@ const ( | |||
PgCatalogPreparedStatementsTableID | |||
PgCatalogPreparedXactsTableID | |||
PgCatalogProcTableID | |||
PgCatalogAggregateTableID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please put this in alphabetical order with the others
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure @jordanlewis
along with that, I have updated PgCatalogID
as it was also not in order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, but that one should stay where it was, at the top of the PGCatalog definitions, to follow the convention in the file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, my bad I should have asked 😊
Corrected
oid oprname aggsortop | ||
|
||
# Check whether correct operator's oid is set for min, bool_and and every. | ||
query OTO colnames |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests look good but I don't quite understand why they don't return any values. A better test would probably produce the oid for min, bool_and and every. same goes for the above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure,
made chnages
adf60ea
to
4bcb121
Compare
Fixes cockroachdb#44616 This commit added virtual Schema and populated pg_catalog.pg_aggregate table, along with its respective testcases. Release justification: low-risk functionality addition. Release note (sql change): This PR adds virtual Schema and populate pg_catalog.pg_aggregate table.
4bcb121
to
4047d45
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @abhishek20123g!
bors r+
Build succeeded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @abhishek20123g, @jordanlewis, @rohany, and @solongordon)
pkg/sql/pg_catalog.go, line 2997 at r3 (raw file):
// Cases to determine aggregate kind. case "rank", "percent_rank", "cume_dict", "dense_rank":
s/cume_dict/cume_dist/g
.
Sorry, @yuzefovich, |
I meant that there is a typo in the code, |
This PR corrects the typo introduced by following PR cockroachdb#48126 that is update reference of builtin function from `cume_dict` to `cume_dist`. Release note (sql change): None
@yuzefovich thank you for identifying the typo. |
This PR corrects the typo introduced by following PR cockroachdb#48126 that is update reference of builtin function from `cume_dict` to `cume_dist`. Release note: None
48351: sql: remove typo in pg_catalog.pg_aggregate table population. r=yuzefovich a=abhishek20123g This PR corrects the typo introduced by following PR #48126 that is update reference of builtin function from `cume_dict` to `cume_dist`. Release note: None Co-authored-by: abhishek20123g <abhishek20123g@gmail.com>
Fixes #44616
This commit added virtual Schema and populated pg_catalog.pg_aggregate table,
along with its respective testcases.
Release justification: low-risk functionality addition.
Release note (sql change): This PR adds virtual Schema and populate
pg_catalog.pg_aggregate table.