Skip to content

Commit

Permalink
fix code style
Browse files Browse the repository at this point in the history
  • Loading branch information
guowei2 committed Dec 23, 2014
1 parent 3214e0a commit c6a6e3e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,6 @@ trait HiveTypeCoercion {
DecimalType(min(p1 - s1, p2 - s2) + max(s1, s2), max(s1, s2))
)

// Cast is not needed for binary comparison
case LessThan(e1 @ DecimalType.Expression(p1, s1),
e2 @ DecimalType.Expression(p2, s2)) if p1 != p2 || s1 != s2 =>
LessThan(Cast(e1, DecimalType.Unlimited), Cast(e2, DecimalType.Unlimited))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,12 @@ class DecimalPrecisionSuite extends FunSuite with BeforeAndAfter {
}

private def checkComparison(expression: Expression, expectedType: DataType): Unit = {
val plan = Project(Seq(Alias(expression, "c")()), relation)
val comparison = analyzer(plan).expressions(0).children(0).asInstanceOf[BinaryComparison]
assert(comparison.left.dataType === expectedType)
assert(comparison.right.dataType === expectedType)
val plan = Project(Alias(expression, "c")() :: Nil, relation)
val comparison = analyzer(plan).collect {
case Project(Alias(e: BinaryComparison, _) :: Nil, _) => e
}.head
assert(comparison.left.dataType === expectedType)
assert(comparison.right.dataType === expectedType)
}

test("basic operations") {
Expand Down

0 comments on commit c6a6e3e

Please sign in to comment.