Skip to content

fix: preserve types in NVL and IFNULL - #26047

Closed
mikamikasuki wants to merge 1 commit into
apache:mainfrom
mikamikasuki:fix/25947-nvl-type-preservation
Closed

mikamikasuki wants to merge 1 commit into
apache:mainfrom
mikamikasuki:fix/25947-nvl-type-preservation

Conversation

@mikamikasuki

Copy link
Copy Markdown

Which issue does this PR close?

Rationale for this change

NVL and IFNULL could coerce DECIMAL values to Float64, losing precision, and DATE/TIMESTAMP values to Utf8. This differs from COALESCE and prevents type-specific operations such as timestamp arithmetic.

What changes are included in this PR?

  • Use COALESCE's common-type resolution for NVL and IFNULL.
  • Preserve the existing Boolean result for all-NULL calls and Boolean-to-numeric fallback behavior.
  • Add SQL logic tests for decimal types and precision, date/timestamp types, and timestamp arithmetic.

What is the testing strategy for this PR?

  • NVL SQL logic tests, including the existing IFNULL numeric-fallback case.
  • Full extended workspace tests passed.
  • cargo fmt --all -- --check
  • cargo clippy --all-targets --all-features -- -D warnings

Are there any user-facing changes?

NVL and IFNULL preserve decimal, date, and timestamp types instead of converting them to Float64 or Utf8.

@github-actions github-actions Bot added sqllogictest SQL Logic Tests (.slt) functions Changes to functions implementation labels Oct 5, 2026
@mikamikasuki

Copy link
Copy Markdown
Author

Closing this as a duplicate of #25964, which addresses the same NVL/IFNULL type coercion issue and includes coverage for decimal precision, temporal types, and existing coercion behavior.

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.

nvl / ifnull convert decimals to Float64 and timestamps and dates to strings

1 participant