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: allow implicit casting of string to more array types #54709

Merged
merged 1 commit into from
Sep 29, 2020

Conversation

rafiss
Copy link
Collaborator

@rafiss rafiss commented Sep 23, 2020

Release note (sql change): A string literal like '{X, Y, Z}'
is now automatically casted to an array when appropriate. Support is
added for UUID, Date, Bool, Time, TimeTZ, Timestamp, TimestampTZ, and
Interval arrays. (Int and Decimal were already supported.)

fixes #54672

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@rafiss rafiss force-pushed the uuid-array-cast branch 3 times, most recently from e9fdecb to 34a84d7 Compare September 24, 2020 17:40
@rafiss rafiss changed the title sql: allow implicit casting to uuid[] sql: allow implicit casting of string to more arrays Sep 24, 2020
@rafiss rafiss changed the title sql: allow implicit casting of string to more arrays sql: allow implicit casting of string to more array types Sep 24, 2020
@rafiss rafiss requested a review from arulajmani September 24, 2020 19:08
Copy link
Collaborator

@arulajmani arulajmani left a comment

Choose a reason for hiding this comment

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

Should we add some logic tests as part of this change? I see there's an array logic test file, which may be a good place?

Change looks good to me, though it would be nice to get a quick look from @otan as well as he's way more familiar with this stuff.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @aadityasondhi, @arulajmani, and @solongordon)

@rafiss rafiss requested review from otan and removed request for solongordon September 28, 2020 20:18
@rafiss
Copy link
Collaborator Author

rafiss commented Sep 28, 2020

added the logic test. @otan would you like to look at this? no need to if you're busy, i feel comfortable going ahead as is.

Copy link
Contributor

@otan otan left a comment

Choose a reason for hiding this comment

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

seems fine to me, curious why we can't do the others

@rafiss
Copy link
Collaborator Author

rafiss commented Sep 28, 2020

ah you mean arrays of other types? we could -- i was just being lazy and sort of deferring to the types that were already tested in constant_test.go.

well technically, we don't support json[] but i can do the other ones and add them to that test.

@otan
Copy link
Contributor

otan commented Sep 28, 2020

happy for that to be a separate PR. just wondering where the line stops :P

@rafiss
Copy link
Collaborator Author

rafiss commented Sep 28, 2020

It was easy enough to add FloatArray, INetArray, and VarbitArray to this PR.

unfortunately I had trouble with Box2d, Geometry, and Geography arrays, so not including them here.

@rafiss
Copy link
Collaborator Author

rafiss commented Sep 29, 2020

TFTRs! i'm merging, and will backport to 20.2 after the initial 20.2.0 release goes out

bors r=otan,arulajmani

@rafiss
Copy link
Collaborator Author

rafiss commented Sep 29, 2020

bors r-

fixing formatting in the logic test

@craig
Copy link
Contributor

craig bot commented Sep 29, 2020

Canceled.

Release note (sql change): A string literal like '{X, Y, Z}'
is now automatically casted to an array when appropriate. Support is
added for UUID, Date, Bool, Time, TimeTZ, Timestamp, TimestampTZ, Float,
INet, Varbit and Interval arrays. (Int and Decimal were already supported.)
@rafiss
Copy link
Collaborator Author

rafiss commented Sep 29, 2020

bors r=otan,arulajmani

@craig
Copy link
Contributor

craig bot commented Sep 29, 2020

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Sep 29, 2020

Build succeeded:

@craig craig bot merged commit 0c12d8b into cockroachdb:master Sep 29, 2020
@rafiss rafiss deleted the uuid-array-cast branch September 29, 2020 13:53
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.

sql: allow UUID[] literals to be written as '{uuid-..., uuid-...}'
4 participants