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

opt: support COLLATE expressions #32500

Merged
merged 1 commit into from Nov 21, 2018

Conversation

Projects
None yet
3 participants
@justinj
Copy link
Member

justinj commented Nov 20, 2018

This commit adds support for COLLATE expressions. In particular, this
allows doing comparisons against existing collated string indexes, which
was not possible before.

Release note (sql change): Queries involving COLLATE expressions are now
supported by the cost-based optimizer.

@justinj justinj requested review from itsbilal , rytaft and andy-kimball Nov 20, 2018

@justinj justinj requested review from cockroachdb/sql-opt-prs as code owners Nov 20, 2018

@cockroach-teamcity

This comment has been minimized.

Copy link
Member

cockroach-teamcity commented Nov 20, 2018

This change is Reviewable

@andy-kimball
Copy link
Contributor

andy-kimball left a comment

:lgtm:

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained


pkg/sql/opt/norm/testdata/rules/scalar, line 1145 at r1 (raw file):

 │    └── tuple [type=tuple]
 └── projections
      └── const: 'hello' COLLATE en_u_ks_level1 [type=collatedstring{en_u_ks_level1}]

How about a case that collates an already collated string, but using a different locale?

@justinj justinj force-pushed the justinj:collate branch from 790ef33 to 03ce86b Nov 20, 2018

@justinj
Copy link
Member

justinj left a comment

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale)


pkg/sql/opt/norm/testdata/rules/scalar, line 1145 at r1 (raw file):

Previously, andy-kimball (Andy Kimball) wrote…

How about a case that collates an already collated string, but using a different locale?

Done, this was already kind of tested in the xform tests (to make sure we didn't generate spans in that case), but this test is more directed. The inner COLLATE should no-op. We could also add a norm rule so that inner collates get eliminated, in case they don't get folded away, but that seems like a pretty uncommon case.

opt: support COLLATE expressions
This commit adds support for COLLATE expressions. In particular, this
allows doing comparisons against existing collated string indexes, which
was not possible before.

Release note (sql change): Queries involving COLLATE expressions are now
supported by the cost-based optimizer.

@justinj justinj force-pushed the justinj:collate branch from 03ce86b to 722a9e9 Nov 20, 2018

@justinj

This comment has been minimized.

Copy link
Member

justinj commented Nov 21, 2018

bors r+

craig bot pushed a commit that referenced this pull request Nov 21, 2018

Merge #32500
32500: opt: support COLLATE expressions r=justinj a=justinj

This commit adds support for COLLATE expressions. In particular, this
allows doing comparisons against existing collated string indexes, which
was not possible before.

Release note (sql change): Queries involving COLLATE expressions are now
supported by the cost-based optimizer.

Co-authored-by: Justin Jaffray <justin@cockroachlabs.com>
@craig

This comment has been minimized.

Copy link

craig bot commented Nov 21, 2018

Build succeeded

@craig craig bot merged commit 722a9e9 into cockroachdb:master Nov 21, 2018

3 checks passed

GitHub CI (Cockroach) TeamCity build finished
Details
bors Build succeeded
Details
license/cla Contributor License Agreement is signed.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment