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

fix: make get_valid_types handle TypeSignature::Numeric correctly #14060

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

niebayes
Copy link
Contributor

@niebayes niebayes commented Jan 9, 2025

Which issue does this PR close?

Closes #14059.

Rationale for this change

What changes are included in this PR?

Make get_valid_types handle TypeSignature::Numeric(n) correctly, for various n.

Are these changes tested?

Yes, added a unit test.

Are there any user-facing changes?

No.

@github-actions github-actions bot added the logical-expr Logical plan and expressions label Jan 9, 2025
@niebayes niebayes changed the title fix get_valid_types with TypeSignature::Numeric fix: make get_valid_types handle TypeSignature::Numeric correctly Jan 9, 2025
Comment on lines +554 to +557
} else if !logical_data_type.is_numeric() {
return plan_err!(
"The signature expected NativeType::Numeric but received {logical_data_type}"
);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not entirely clear on the rationale for falling back to Float64 when the argument is of type Null.
However, I choose to keep this logic and make it a short-circuit before the numeric check.

Copy link
Contributor

Choose a reason for hiding this comment

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

f64 is chosen since it is the most compatible type of numeric

@github-actions github-actions bot added the physical-expr Physical Expressions label Jan 9, 2025
@github-actions github-actions bot added sqllogictest SQL Logic Tests (.slt) core Core DataFusion crate labels Jan 9, 2025
jayzhan211
jayzhan211 previously approved these changes Jan 10, 2025
Copy link
Contributor

@jayzhan211 jayzhan211 left a comment

Choose a reason for hiding this comment

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

👍🏻

@jayzhan211 jayzhan211 dismissed their stale review January 10, 2025 01:04

wait util tests passed

@niebayes
Copy link
Contributor Author

I need to bump Rust to 1.84 to pass CI

@niebayes niebayes force-pushed the fix/get_valid_types branch from 1d39025 to 3cf710c Compare January 10, 2025 08:35
@github-actions github-actions bot removed physical-expr Physical Expressions core Core DataFusion crate labels Jan 10, 2025
@niebayes niebayes requested a review from jayzhan211 January 10, 2025 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
logical-expr Logical plan and expressions sqllogictest SQL Logic Tests (.slt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: get_valid_types handles TypeSignature::Numeric incorrectly
2 participants