Skip to content

span: remove INVERTED check from builder#76865

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
RaduBerinde:inv-check-test
Feb 22, 2022
Merged

span: remove INVERTED check from builder#76865
craig[bot] merged 1 commit intocockroachdb:masterfrom
RaduBerinde:inv-check-test

Conversation

@RaduBerinde
Copy link
Copy Markdown
Member

This check has been carried over since we first added support for JSON
indexes; at that point inverted spans were always single key and thus
had inclusive boundaries.

The check as it stands now is incorrect - there is no reason why we
should always treat an end key as inclusive for an inverted index. In
practice, the only current cases where we might have an exclusive end
key are with geospatial queries, where the spans are not "tight"
anyway (i.e. false positives are allowed). This might change in the
future though, e.g. if we add support for range queries for JSON
elements.

Release note: None

@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@RaduBerinde
Copy link
Copy Markdown
Member Author

I didn't manage to find a query that results in an exclusive end span (in a real server or in the execbuilder tests).

Copy link
Copy Markdown
Member

@yuzefovich yuzefovich left a comment

Choose a reason for hiding this comment

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

I'll defer to Becca for approval.

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @RaduBerinde and @rytaft)


pkg/sql/span/span_builder.go, line 227 at r1 (raw file):

// roachpb.Spans and appends them to the provided spans. It appends multiple
// spans in the case that multiple, non-adjacent column families should be
// scanned. The forDelete parameter indicates whether these spans will be used

nit: forDelete has been removed recently.


pkg/sql/span/span_builder.go, line 264 at r1 (raw file):

	}

	// We need to advance the end key if it is inclusive or the index is

nit: the comment needs an update.

This check has been carried over since we first added support for JSON
indexes; at that point inverted spans were always single key and thus
had inclusive boundaries.

The check as it stands now is incorrect - there is no reason why we
should always treat an end key as inclusive for an inverted index. In
practice, the only current cases where we might have an exclusive end
key are with geospatial queries, where the spans are not "tight"
anyway (i.e.  false positives are allowed). This might change in the
future though, e.g. if we add support for range queries for JSON
elements.

Release note: None
Copy link
Copy Markdown
Collaborator

@rytaft rytaft left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @RaduBerinde)

Copy link
Copy Markdown
Member Author

@RaduBerinde RaduBerinde left a comment

Choose a reason for hiding this comment

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

TFTRs!

bors r+

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @RaduBerinde)

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Feb 22, 2022

Build succeeded:

@craig craig bot merged commit 97cc8de into cockroachdb:master Feb 22, 2022
@RaduBerinde RaduBerinde deleted the inv-check-test branch March 19, 2022 01:33
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.

4 participants