Skip to content

[AURON #1579] Fix and enhance nvl2 unit test#1635

Merged
richox merged 1 commit intoapache:masterfrom
yew1eb:fix_ut_for_nvl2
Nov 22, 2025
Merged

[AURON #1579] Fix and enhance nvl2 unit test#1635
richox merged 1 commit intoapache:masterfrom
yew1eb:fix_ut_for_nvl2

Conversation

@yew1eb
Copy link
Contributor

@yew1eb yew1eb commented Nov 19, 2025

Which issue does this PR close?

Closes #1579 .

Rationale for this change

nvl2(expr1, expr2, expr3) semantics:

  • if expr1 is not null → return expr2
  • if expr1 is null → return expr3

The original nvl2 test was incorrect and asserted the wrong expected result:

      sql(
        "create table t1 using parquet as select 'base'" +
          " as base, 3 as exponent")
      val functions =
        """
          |select
          |  nvl2(null, base, exponent), nvl2(4, base, exponent)
          |from t1
                      """.stripMargin

      val df = sql(functions)
      checkAnswer(df, Seq(Row("base", 3)))   // ← WRONG!

Original test incorrectly expected Row("base", 3) but actual result is Row(3, "base").

What changes are included in this PR?

  • Removed the original incorrect nvl2 test.
  • Replaced with correct and strengthened test case.

Are there any user-facing changes?

No.

How was this patch tested?

Unit tests passed.

@github-actions github-actions bot added the spark label Nov 19, 2025
Copy link
Member

@merrily01 merrily01 left a comment

Choose a reason for hiding this comment

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

LGTM

@ShreyeshArangath
Copy link
Contributor

Thanks, @yew1eb. This will help us close #1595

@richox richox merged commit c0e336a into apache:master Nov 22, 2025
98 checks passed
yew1eb added a commit to yew1eb/auron that referenced this pull request Nov 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement native function of nv2(83)

4 participants