Support more DateTimeField variants#1191
Merged
Merged
Conversation
Pull Request Test Coverage Report for Build 8407785234Details
💛 - Coveralls |
- Adds `DATETIME` variant to `DatetimeField` - Adds support for snowflake abbreviations via `Custom` variant. https://docs.snowflake.com/en/sql-reference/functions-date-time#supported-date-and-time-parts - Adds support for BigQuery weekday `WEEK(MONDAY)` syntax https://cloud.google.com/bigquery/docs/reference/standard-sql/date_functions#extract
0df4a25 to
cd640b9
Compare
alamb
reviewed
Apr 7, 2024
| }) | ||
| f.write_str( | ||
| match self { | ||
| DateTimeField::Year => "YEAR".to_string(), |
Contributor
There was a problem hiding this comment.
This change to call to_string() will now cause a new string to be allocated for each type.
I think it would be better / more effiicent to use write! directly -- like
Suggested change
| DateTimeField::Year => "YEAR".to_string(), | |
| match self { | |
| DateTimeField::Year => f.write_str("YEAR"), | |
| DateTimeField::Month => f.write_str("MONTH"), | |
| ... |
Contributor
Author
There was a problem hiding this comment.
Ah yes that makes a lot more sense, thanks for the follow up fix too!
| #[cfg(not(feature = "std"))] | ||
| use alloc::string::String; | ||
|
|
||
| #[cfg(not(feature = "std"))] |
Contributor
There was a problem hiding this comment.
If you use the suggestion below I think you will not need these imports either
alamb
approved these changes
Apr 9, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DATETIMEvariant toDatetimeFieldCustomvariant. https://docs.snowflake.com/en/sql-reference/functions-date-time#supported-date-and-time-partsWEEK(MONDAY)syntax https://cloud.google.com/bigquery/docs/reference/standard-sql/date_functions#extract