Skip to content

Commit

Permalink
[VL] Add a new test case for Round's coverage (#6884)
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangjiangtian authored Aug 19, 2024
1 parent 9fcd488 commit 4f7ac37
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2078,4 +2078,12 @@ class TestOperator extends VeloxWholeStageTransformerSuite with AdaptiveSparkPla
checkGlutenOperatorMatch[SortExecTransformer]
}
}

// Enable the test after fixing https://github.com/apache/incubator-gluten/issues/6827
ignore("Test round expression") {
val df1 = runQueryAndCompare("SELECT round(cast(0.5549999999999999 as double), 2)") { _ => }
checkLengthAndPlan(df1, 1)
val df2 = runQueryAndCompare("SELECT round(cast(0.19324999999999998 as double), 2)") { _ => }
checkLengthAndPlan(df2, 1)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ class GlutenMathExpressionsSuite extends MathExpressionsSuite with GlutenTestsTr
checkEvaluation(Round(1.12345678901234567, 8), 1.12345679)
checkEvaluation(Round(-0.98765432109876543, 5), -0.98765)
checkEvaluation(Round(12345.67890123456789, 6), 12345.678901)
// Enable the test after fixing https://github.com/apache/incubator-gluten/issues/6827
// checkEvaluation(Round(0.5549999999999999, 2), 0.55)
checkEvaluation(BRound(2.5, 0), 2.0)
checkEvaluation(BRound(3.5, 0), 4.0)
checkEvaluation(BRound(-2.5, 0), -2.0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ class GlutenMathExpressionsSuite extends MathExpressionsSuite with GlutenTestsTr
checkEvaluation(Round(1.12345678901234567, 8), 1.12345679)
checkEvaluation(Round(-0.98765432109876543, 5), -0.98765)
checkEvaluation(Round(12345.67890123456789, 6), 12345.678901)
// Enable the test after fixing https://github.com/apache/incubator-gluten/issues/6827
// checkEvaluation(Round(0.5549999999999999, 2), 0.55)
checkEvaluation(Round(-35, -1), -40)
checkEvaluation(Round(BigDecimal("45.00"), -1), BigDecimal(50))
checkEvaluation(BRound(2.5, 0), 2.0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ class GlutenMathExpressionsSuite extends MathExpressionsSuite with GlutenTestsTr
checkEvaluation(BRound(-3.5, 0), -4.0)
checkEvaluation(BRound(-0.35, 1), -0.4)
checkEvaluation(BRound(-35, -1), -40)
// Enable the test after fixing https://github.com/apache/incubator-gluten/issues/6827
// checkEvaluation(Round(0.5549999999999999, 2), 0.55)
checkEvaluation(BRound(BigDecimal("45.00"), -1), BigDecimal(40))
checkEvaluation(checkDataTypeAndCast(RoundFloor(Literal(2.5), Literal(0))), Decimal(2))
checkEvaluation(checkDataTypeAndCast(RoundFloor(Literal(3.5), Literal(0))), Decimal(3))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ class GlutenMathExpressionsSuite extends MathExpressionsSuite with GlutenTestsTr
checkEvaluation(Round(1.12345678901234567, 8), 1.12345679)
checkEvaluation(Round(-0.98765432109876543, 5), -0.98765)
checkEvaluation(Round(12345.67890123456789, 6), 12345.678901)
// Enable the test after fixing https://github.com/apache/incubator-gluten/issues/6827
// checkEvaluation(Round(0.5549999999999999, 2), 0.55)
checkEvaluation(BRound(BigDecimal("45.00"), -1), BigDecimal(40))
checkEvaluation(checkDataTypeAndCast(RoundFloor(Literal(2.5), Literal(0))), Decimal(2))
checkEvaluation(checkDataTypeAndCast(RoundFloor(Literal(3.5), Literal(0))), Decimal(3))
Expand Down

0 comments on commit 4f7ac37

Please sign in to comment.