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

Return correct scalar types for date_trunc #6638

Merged
merged 2 commits into from
Jun 12, 2023
Merged

Conversation

viirya
Copy link
Member

@viirya viirya commented Jun 11, 2023

Which issue does this PR close?

None

Rationale for this change

This is inspired when I review #6632 and read the date_trunc implementation. Based on its signature, date_trunc always returns nanosecond timestamp, but for scalar case, it actually returns second/millisecond/microsecond scalar values. This patch fixes the mismatched scalar types.

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

@github-actions github-actions bot added the physical-expr Physical Expressions label Jun 11, 2023
@@ -329,7 +329,7 @@ pub fn date_trunc(args: &[ColumnarValue]) -> Result<ColumnarValue> {
}
_ => {
return Err(DataFusionError::Execution(
"array of `date_trunc` must be non-null scalar Utf8".to_string(),
Copy link
Member Author

Choose a reason for hiding this comment

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

This error message also doesn't read correctly.

@alamb alamb mentioned this pull request Jun 11, 2023
@github-actions github-actions bot added the core Core DataFusion crate label Jun 11, 2023
@alamb
Copy link
Contributor

alamb commented Jun 12, 2023

Follow on discussion in #6653

@alamb alamb merged commit 9846da6 into apache:main Jun 12, 2023
@viirya
Copy link
Member Author

viirya commented Jun 12, 2023

Thanks. @alamb @jackwener

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core DataFusion crate physical-expr Physical Expressions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants