Skip to content

Commit 2f14b50

Browse files
Fix code style issues
1 parent 68b9fad commit 2f14b50

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/complexTypes.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ case class GetItem(child: Expression, ordinal: Expression) extends Expression {
4242

4343
override def eval(input: Row): Any = {
4444
val value = child.eval(input)
45-
if(value == null) {
45+
if (value == null) {
4646
null
4747
} else {
4848
val key = ordinal.eval(input)
49-
if(key == null) {
49+
if (key == null) {
5050
null
5151
} else {
5252
if (child.dataType.isInstanceOf[ArrayType]) {

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ object NullPropagation extends Rule[LogicalPlan] {
9595
def apply(plan: LogicalPlan): LogicalPlan = plan transform {
9696
case q: LogicalPlan => q transformExpressionsUp {
9797
case e @ Count(Literal(null, _)) => Literal(0, e.dataType)
98-
case e @ Sum(Literal(c, _)) if(c == 0) => Literal(0, e.dataType)
99-
case e @ Average(Literal(c, _)) if(c == 0) => Literal(0.0, e.dataType)
98+
case e @ Sum(Literal(c, _)) if c == 0 => Literal(0, e.dataType)
99+
case e @ Average(Literal(c, _)) if c == 0 => Literal(0.0, e.dataType)
100100
case e @ IsNull(c) if c.nullable == false => Literal(false, BooleanType)
101101
case e @ IsNotNull(c) if c.nullable == false => Literal(true, BooleanType)
102102
case e @ GetItem(Literal(null, _), _) => Literal(null, e.dataType)
@@ -107,17 +107,17 @@ object NullPropagation extends Rule[LogicalPlan] {
107107
case Literal(null, _) => false
108108
case _ => true
109109
})
110-
if(newChildren.length == 0) {
110+
if (newChildren.length == 0) {
111111
Literal(null, e.dataType)
112-
} else if(newChildren.length == 1) {
112+
} else if (newChildren.length == 1) {
113113
newChildren(0)
114114
} else {
115115
Coalesce(newChildren)
116116
}
117117
}
118-
case e @ If(Literal(v, _), trueValue, falseValue) => if(v == true) trueValue else falseValue
119-
case e @ In(Literal(v, _), list) if(list.exists(c => c match {
120-
case Literal(candidate, _) if(candidate == v) => true
118+
case e @ If(Literal(v, _), trueValue, falseValue) => if (v == true) trueValue else falseValue
119+
case e @ In(Literal(v, _), list) if (list.exists(c => c match {
120+
case Literal(candidate, _) if candidate == v => true
121121
case _ => false
122122
})) => Literal(true, BooleanType)
123123
case e: UnaryMinus => e.child match {
@@ -151,6 +151,7 @@ object NullPropagation extends Rule[LogicalPlan] {
151151
}
152152
}
153153
}
154+
154155
/**
155156
* Replaces [[catalyst.expressions.Expression Expressions]] that can be statically evaluated with
156157
* equivalent [[catalyst.expressions.Literal Literal]] values.

0 commit comments

Comments
 (0)