Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
codeatri committed Aug 15, 2018
1 parent 58b60b2 commit 2f4943f
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -520,9 +520,7 @@ case class TransformKeys(

@transient lazy val MapType(keyType, valueType, valueContainsNull) = argument.dataType

override def dataType: DataType = {
MapType(function.dataType, valueType, valueContainsNull)
}
override def dataType: DataType = MapType(function.dataType, valueType, valueContainsNull)

override def bind(f: (Expression, Seq[(DataType, Boolean)]) => LambdaFunction): TransformKeys = {
copy(function = f(function, (keyType, false) :: (valueType, valueContainsNull) :: Nil))
Expand All @@ -534,13 +532,12 @@ case class TransformKeys(

override def nullSafeEval(inputRow: InternalRow, argumentValue: Any): Any = {
val map = argumentValue.asInstanceOf[MapData]
val f = functionForEval
val resultKeys = new GenericArrayData(new Array[Any](map.numElements))
var i = 0
while (i < map.numElements) {
keyVar.value.set(map.keyArray().get(i, keyVar.dataType))
valueVar.value.set(map.valueArray().get(i, valueVar.dataType))
val result = f.eval(inputRow)
val result = functionForEval.eval(inputRow)
if (result == null) {
throw new RuntimeException("Cannot use null as map key!")
}
Expand Down

0 comments on commit 2f4943f

Please sign in to comment.