@@ -488,8 +488,6 @@ trait HiveTypeCoercion {
488488 val trueValue = Literal (new java.math.BigDecimal (1 ))
489489 val falseValue = Literal (new java.math.BigDecimal (0 ))
490490
491- private def isNull (expr : Expression ) = EqualNullSafe (expr, Literal .create(null , expr.dataType))
492-
493491 private def buildCaseKeyWhen (booleanExpr : Expression , numericExpr : Expression ) = {
494492 CaseKeyWhen (Cast (numericExpr, DecimalType .Unlimited ),
495493 Seq (
@@ -500,17 +498,15 @@ trait HiveTypeCoercion {
500498
501499 private def transform (booleanExpr : Expression , numericExpr : Expression ) = {
502500 CaseWhen (Seq (
503- isNull(booleanExpr), Literal .create(null , BooleanType ),
504- isNull(numericExpr), Literal .create(null , BooleanType ),
501+ Or (IsNull (booleanExpr), IsNull (numericExpr)), Literal .create(null , BooleanType ),
505502 buildCaseKeyWhen(booleanExpr, numericExpr)
506503 ))
507504 }
508505
509506 private def transformNullSafe (booleanExpr : Expression , numericExpr : Expression ) = {
510507 CaseWhen (Seq (
511- And (isNull(booleanExpr), isNull(numericExpr)), Literal (true ),
512- isNull(booleanExpr), Literal (false ),
513- isNull(numericExpr), Literal (false ),
508+ And (IsNull (booleanExpr), IsNull (numericExpr)), Literal (true ),
509+ Or (IsNull (booleanExpr), IsNull (numericExpr)), Literal (false ),
514510 buildCaseKeyWhen(booleanExpr, numericExpr)
515511 ))
516512 }
0 commit comments