Skip to content

Commit

Permalink
Remove the unnecessary null checking
Browse files Browse the repository at this point in the history
  • Loading branch information
chenghao-intel committed Apr 30, 2014
1 parent 80f9f18 commit 50444cc
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,15 @@ case class GetItem(child: Expression, ordinal: Expression) extends Expression {
if (child.dataType.isInstanceOf[ArrayType]) {
val baseValue = value.asInstanceOf[Seq[_]]
val o = key.asInstanceOf[Int]
if (baseValue == null) {
null
} else if (o >= baseValue.size || o < 0) {
if (o >= baseValue.size || o < 0) {
null
} else {
baseValue(o)
}
} else {
val baseValue = value.asInstanceOf[Map[Any, _]]
val key = ordinal.eval(input)
if (baseValue == null) {
null
} else {
baseValue.get(key).orNull
}
baseValue.get(key).orNull
}
}
}
Expand Down

0 comments on commit 50444cc

Please sign in to comment.