Skip to content

colexecbase: add all remaining casts from strings#83958

Merged
craig[bot] merged 3 commits intocockroachdb:masterfrom
yuzefovich:vec-casts
Jul 11, 2022
Merged

colexecbase: add all remaining casts from strings#83958
craig[bot] merged 3 commits intocockroachdb:masterfrom
yuzefovich:vec-casts

Conversation

@yuzefovich
Copy link
Copy Markdown
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
Copy Markdown
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 a team, DrewKimball and msirek 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 July 8, 2022 16:58
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member Author

TFTR!

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jul 11, 2022

Build failed:

@yuzefovich
Copy link
Copy Markdown
Member Author

Unrelated flake.

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jul 11, 2022

Build failed:

@yuzefovich
Copy link
Copy Markdown
Member Author

Another unrelated flake.

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jul 11, 2022

Build failed:

@yuzefovich
Copy link
Copy Markdown
Member Author

bors r+

@craig craig bot merged commit 10853d2 into cockroachdb:master Jul 11, 2022
@craig
Copy link
Copy Markdown
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