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

colexecbase: add all remaining casts from strings #83958

Merged
merged 3 commits into from
Jul 11, 2022

Conversation

yuzefovich
Copy link
Member

@yuzefovich yuzefovich commented Jul 7, 2022

tree: minor cleanup

This commit does a few minor things:

  • actually uses the error in a few places when constructing a ParseError
  • refactors some of the interval-parsing functions to expose them to be
    used in the follow-up commit
  • extracts a helper method to construct an error when timestamp exceeds
    bounds.

Release note: None

colexecbase: sort native cast info lexicographically

This commit sorts the information about natively supported casts
lexicographically so that it is easier to see what is actually
supported. This is simply a mechanical change.

Release note: None

colexecbase: add all remaining casts from strings

This commit adds the native casts from strings to all remaining
natively-supported types (dates, decimals, floats, ints, intervals,
timestamps, jsons).

I was inspired to do this because the combination of this
commit and the vectorized rendering on top of the wrapped row-by-row
processors would expose some bugs (e.g. #83094).

Addresses: #48135.

Release note: None

@cockroach-teamcity
Copy link
Member

This change is Reviewable

This commit does a few minor things:
- actually uses the error in a few places when constructing a ParseError
- refactors some of the interval-parsing functions to expose them to be
used in the follow-up commit
- extracts a helper method to construct an error when timestamp exceeds
bounds.

Release note: None
This commit sorts the information about natively supported casts
lexicographically so that it is easier to see what is actually
supported. This is simply a mechanical change.

Release note: None
This commit adds the native casts from strings to all remaining
natively-supported types (dates, decimals, floats, ints, intervals,
timestamps, jsons).

I was inspired to do this because the combination of this
commit and the vectorized rendering on top of the wrapped row-by-row
processors would expose some bugs (e.g. cockroachdb#83094).

Release note: None
@yuzefovich yuzefovich changed the title colexecbase: add more casts from strings colexecbase: add all remaining casts from strings Jul 8, 2022
@yuzefovich yuzefovich requested review from msirek, DrewKimball and a team July 8, 2022 16:58
@yuzefovich yuzefovich marked this pull request as ready for review July 8, 2022 16:58
@yuzefovich yuzefovich requested a review from a team as a code owner July 8, 2022 16:58
Copy link
Contributor

@msirek msirek left a comment

Choose a reason for hiding this comment

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

Reviewed 3 of 3 files at r1, 2 of 2 files at r2, 3 of 4 files at r3, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @DrewKimball, @msirek, and @yuzefovich)


pkg/sql/colexec/execgen/cmd/execgen/cast_gen_util.go line 474 at r3 (raw file):

		_now := %[3]s.GetRelativeParseTime()
		_dateStyle := %[3]s.GetDateStyle()
		_t, _, err := pgdate.ParseTimestamp%[5]s(_now, _dateStyle, string(%[2]s))

What does %[5]s represent here?

Copy link
Member Author

@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.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @DrewKimball and @msirek)


pkg/sql/colexec/execgen/cmd/execgen/cast_gen_util.go line 474 at r3 (raw file):

Previously, msirek (Mark Sirek) wrote…

What does %[5]s represent here?

It refers to the fifth argument for the "format" string (which is parseTimestampKind in this case). Depending on the type (i.e. timestamp vs timestamptz) we want to use different methods for parsing which differ only in a suffix.

Copy link
Contributor

@msirek msirek 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 4 files at r3.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @DrewKimball and @yuzefovich)


pkg/sql/colexec/execgen/cmd/execgen/cast_gen_util.go line 474 at r3 (raw file):

Previously, yuzefovich (Yahor Yuzefovich) wrote…

It refers to the fifth argument for the "format" string (which is parseTimestampKind in this case). Depending on the type (i.e. timestamp vs timestamptz) we want to use different methods for parsing which differ only in a suffix.

Thanks!

@yuzefovich
Copy link
Member Author

TFTR!

bors r+

@craig
Copy link
Contributor

craig bot commented Jul 11, 2022

Build failed:

@yuzefovich
Copy link
Member Author

Unrelated flake.

bors r+

@craig
Copy link
Contributor

craig bot commented Jul 11, 2022

Build failed:

@yuzefovich
Copy link
Member Author

Another unrelated flake.

bors r+

@craig
Copy link
Contributor

craig bot commented Jul 11, 2022

Build failed:

@yuzefovich
Copy link
Member Author

bors r+

@craig craig bot merged commit 10853d2 into cockroachdb:master Jul 11, 2022
@craig
Copy link
Contributor

craig bot commented Jul 11, 2022

Build succeeded:

@yuzefovich yuzefovich deleted the vec-casts branch July 11, 2022 21:04
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