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

Implement EXTRACT expression with week, month, day, hour #1974

Merged
merged 1 commit into from
Mar 10, 2022

Conversation

Ted-Jiang
Copy link
Member

@Ted-Jiang Ted-Jiang commented Mar 10, 2022

Which issue does this PR close?

Closes #1896.

Rationale for this change

Already add compute method in arrow-rs PR.
But found

Creating logical plan for 'SELECT EXTRACT(WEEK FROM to_timestamp('2020-09-08T12:00:00+00:00'))'
 SQL(ParserError("Expected date/time field, found: WEEK"))'

will fix EXTRACT(WEEK FROM to_timestamp('2020-09-08T12:00:00+00:00')) in sqlparser

What changes are included in this PR?

Are there any user-facing changes?

@github-actions github-actions bot added the datafusion Changes in the datafusion crate label Mar 10, 2022
@Ted-Jiang
Copy link
Member Author

@alamb @liukun4515 PTAL

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thanks @Ted-Jiang and @jimexist

);
test_expression!("date_part('WEEK', CAST('2003-01-01' AS DATE))", "1");

//TODO Creating logical plan for 'SELECT EXTRACT(WEEK FROM to_timestamp('2020-09-08T12:00:00+00:00'))'
Copy link
Contributor

Choose a reason for hiding this comment

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

Many keywords got added in sqlparser-rs/sqlparser-rs#427 from @mobuchowski (👋 ) but sadly it seems to be missing week 😭

Choose a reason for hiding this comment

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

Can't believe I missed it... 😞

Copy link
Contributor

Choose a reason for hiding this comment

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

I didn't meant to make you feel bad @mobuchowski -- mostly I was trying to give you props for adding stuff to sqlparser ;)

Copy link

Choose a reason for hiding this comment

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

Don't worry, that's not how I received it 🙂

Copy link
Contributor

Choose a reason for hiding this comment

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

@Ted-Jiang Maybe you can file a pr to fix this.

Copy link
Member Author

Choose a reason for hiding this comment

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

@liukun4515 @liukun4515 @mobuchowski i would like to add this , it's a good chance to start familiar sqlparser
😊

Copy link
Contributor

Choose a reason for hiding this comment

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

@alamb alamb merged commit a7598c5 into apache:master Mar 10, 2022
@liukun4515
Copy link
Contributor

Sorry for the later response.
@Ted-Jiang

@alamb
Copy link
Contributor

alamb commented Mar 12, 2022

Thanks @Ted-Jiang -- I hope to spend some non trivial amount of time this weekend reviewing and merging PRs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datafusion Changes in the datafusion crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement EXTRACT expression with week, month, day, hour
5 participants