Skip to content

Conversation

@kumarUjjawal
Copy link
Contributor

Which issue does this PR close?

Rationale for this change

iszero() and isnan() previously accepted “numeric” inputs by implicitly coercing them to Float64, adding unnecessary casts and work for integer/decimal inputs.

What changes are included in this PR?

  • Updated iszero() and isnan() signatures to accept TypeSignatureClass::Numeric without implicit float coercion.
  • Refactored iszero() implementation to evaluate zero checks directly for integers, unsigned integers, floats, and decimals.
  • Refactored isnan() implementation to compute is_nan only for float types and return false for all other numeric types and reduced non-float array handling to use unary kernels instead of manual iteration.
  • Added sqllogictest

Are these changes tested?

Yes

Are there any user-facing changes?

No

@github-actions github-actions bot added sqllogictest SQL Logic Tests (.slt) functions Changes to functions implementation labels Jan 31, 2026
@kumarUjjawal kumarUjjawal changed the title Refactor iszero() and isnan() to accept all numeric types Refactor iszero() and isnan() to accept all numeric types Jan 31, 2026
@Jefffrey
Copy link
Contributor

Jefffrey commented Jan 31, 2026

For decimal is_zero we need to consider the scale
E.g. negative scale can never be zero

Edit: actually maybe I'm wrong 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

functions Changes to functions implementation sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor iszero() and isnan() to accept all numeric types

2 participants