Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove the unnecessary null checking
  • Loading branch information
chenghao-intel committed Apr 30, 2014
commit 50444cc04edafff9e75e41bf06500d7936b178b8
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