Skip to content
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

drop sort when secondary index is available #2080

Merged
merged 24 commits into from
Oct 19, 2023
Merged

drop sort when secondary index is available #2080

merged 24 commits into from
Oct 19, 2023

Conversation

jycor
Copy link
Contributor

@jycor jycor commented Oct 17, 2023

No description provided.

Copy link
Contributor

@max-hoffman max-hoffman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some correctness and reversed tests might be useful. Nulls are the other way secondaries are different, does the presence of NULLs in some secondary index keys behave differently than a regular sort node?

if idxCandidate.IsSpatial() {
continue
}
if isSortFieldsValidPrefix(sfExprs, sfAliases, idxCandidate.Expressions()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the impl of this looks case-insensitive, but it might be useful to test

for i, fieldExpr := range sfExprs {
fieldName := fieldExpr.String()
if alias, ok := sfAliases[strings.ToLower(pkColNames[i])]; ok && alias == fieldName {
if alias, ok := sfAliases[strings.ToLower(idxColExprs[i])]; ok && alias == fieldName {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have tests with aliases? and table aliases?

Base automatically changed from james/reverse to main October 18, 2023 19:32
Copy link
Contributor

@max-hoffman max-hoffman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, nice to catch a bunch of edge cases for this optimization

@jycor jycor merged commit 3dfff83 into main Oct 19, 2023
@jycor jycor deleted the james/reverse-idx branch October 19, 2023 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants