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

sql: enable storage for tsvector/tsquery #92957

Merged
merged 1 commit into from
Dec 13, 2022

Conversation

jordanlewis
Copy link
Member

@jordanlewis jordanlewis commented Dec 2, 2022

This commit adds the ability to store tsvector and tsquery data in ordinary, unindexed columns.

Updates #41288
This functionality is gated behind the 23.1 version.

Epic: CRDB-22357

Release note (sql change): permit non-indexed storage of tsvector and tsquery datatypes

@jordanlewis jordanlewis requested a review from a team December 2, 2022 21:08
@jordanlewis jordanlewis requested a review from a team as a code owner December 2, 2022 21:08
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
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.

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


pkg/sql/catalog/colinfo/col_type_info.go line 101 at r1 (raw file):

			return unimplemented.NewWithIssueDetailf(23468, t.String(),
				"arrays of JSON unsupported as column type")
		}

should we allow arrays of TSQuery / TSVector?


pkg/sql/randgen/type.go line 159 at r1 (raw file):

	}
	ctx := context.Background()
	evalCtx := eval.MakeTestingEvalContext(clustersettings.MakeTestingClusterSettings())

feels kind of bad to introduce a testing eval context here since this isn't explicitly a test... (I know it's probably only used for tests, though). I don't really have a good suggestion, but wondering if you considered any other options?

Copy link
Member Author

@jordanlewis jordanlewis left a comment

Choose a reason for hiding this comment

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

Comments resolved!

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


pkg/sql/catalog/colinfo/col_type_info.go line 101 at r1 (raw file):

Previously, rytaft (Rebecca Taft) wrote…

should we allow arrays of TSQuery / TSVector?

At some point, yes, but we currently disallow them: #90886

This code is in CheckArrayElementType.

I was missing a test case for this though, thanks for pointing it out, added one.


pkg/sql/randgen/type.go line 159 at r1 (raw file):

Previously, rytaft (Rebecca Taft) wrote…

feels kind of bad to introduce a testing eval context here since this isn't explicitly a test... (I know it's probably only used for tests, though). I don't really have a good suggestion, but wondering if you considered any other options?

Good point...

I simplified it a little bit, but looking at the code for MakeTestingClusterSettings, the function of that code is literally just to initialize a fake cluster version from 0, so I think we'll need to keep that at minimum.

Another option I guess would be to find a way to propagate a cluster settings just for the things that use randgen? But it seems like more effort than it's worth to me.

Did you have another idea? Happy to do something else here just don't really know what it would be.

Copy link
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 2 of 2 files at r2, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @jordanlewis)


pkg/sql/randgen/type.go line 159 at r1 (raw file):

Previously, jordanlewis (Jordan Lewis) wrote…

Good point...

I simplified it a little bit, but looking at the code for MakeTestingClusterSettings, the function of that code is literally just to initialize a fake cluster version from 0, so I think we'll need to keep that at minimum.

Another option I guess would be to find a way to propagate a cluster settings just for the things that use randgen? But it seems like more effort than it's worth to me.

Did you have another idea? Happy to do something else here just don't really know what it would be.

This seems better. I'm ok with this, but maybe it's worth adding an explicit comment that these functions should only be called from test code?

@jordanlewis
Copy link
Member Author

There are a ton of different functions that invoke the random types, so I feel like adding a comment to all of them is a little silly. I added a comment to the doc, which also feels kind of weak.

But good news - I worked with @rickystewart and @ajwerner to open up #93470, which programmatically asserts that these can only be used in test 🎉

TFTR!

bors r+

@craig
Copy link
Contributor

craig bot commented Dec 13, 2022

Build failed (retrying...):

@jordanlewis
Copy link
Member Author

bors r-

@craig
Copy link
Contributor

craig bot commented Dec 13, 2022

Canceled.

This commit adds the ability to store tsvector and tsquery data in
ordinary, unindexed columns.

This functionality is gated behind the 23.1 version.

Release note (sql change): permit non-indexed storage of tsvector and
tsquery datatypes
@jordanlewis jordanlewis requested a review from a team as a code owner December 13, 2022 01:43
@jordanlewis jordanlewis requested review from miretskiy and removed request for a team December 13, 2022 01:43
@jordanlewis
Copy link
Member Author

bors r+

@craig
Copy link
Contributor

craig bot commented Dec 13, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Dec 13, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Dec 13, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Dec 13, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Dec 13, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Dec 13, 2022

Build succeeded:

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.

3 participants