-
Notifications
You must be signed in to change notification settings - Fork 769
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
fix(redshift)!: Normalize time units in their full singular form #3652
Conversation
I thought again and have concluded to the following regarding this PR:
Regarding the general refactor:
Any thoughts? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
We can probably swap exp.TimeUnit::UNABBREVIATED_UNIT_NAME with Dialect::DATE_PART_MAPPING, which should normalize most (if not all) dialects and remove the need for map_date_part() everywhere.
Sounds good. If there are no inconsistencies between dialects then that would make things simpler. The tricky part begins when you have to override certain date parts because there are discrepancies.
If any dialect has different mappings, we can go the manual map_date_part(unit, dialect) route. This is a necessary evil because exp.TimeUnit won't have access to the dialect specific mapping, but we can rethink this later on.
Right, so we'll be able to have an escape hatch. Sounds good to me 👍
4008d06
to
b6cb790
Compare
Fixes #3651
Normalize Redshift's units from plural/abbreviation to their full singular form during parse time. This is already happening at Snowflake, so the existing infrastructure is moved out to
dialect.py
as most of these mappings are similar between dialects.