Skip to content

Conversation

@LorrensP-2158466
Copy link
Contributor

Which issue does this PR close?

Closes #11075.

Rationale for this change

What changes are included in this PR?

  • check overflow for integer parameters
  • check that exponent is non negative for integer parameters (this was allowed but resulted in nothing)

Are these changes tested?

Added SLT test

Are there any user-facing changes?

no

@github-actions github-actions bot added the sqllogictest SQL Logic Tests (.slt) label Jun 25, 2024
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.

Looks good to me -- thank you @LorrensP-2158466

(Some(base), Some(exp)) => Ok(Some(base.pow_checked(
exp.try_into().map_err(|_| {
exec_datafusion_err!(
"Can't use negative exponents: {exp} in integer computation, please use Float."
Copy link
Contributor

Choose a reason for hiding this comment

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

💯 for the error message

Copy link
Member

@jonahgao jonahgao left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @LorrensP-2158466

@jonahgao jonahgao merged commit 7adc940 into apache:main Jun 26, 2024
@LorrensP-2158466 LorrensP-2158466 deleted the fix-overflow-in-pow branch June 26, 2024 16:16
findepi pushed a commit to findepi/datafusion that referenced this pull request Jul 16, 2024
* checked overflow on integer parameter

* added slt test

* fix: forgot to remove failling test case
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Overflow bug in POW scalar function (found by SQLancer)

3 participants