Skip to content

Commit

Permalink
[SPARK-23938][SQL] Addressing review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mn-mikke committed Aug 7, 2018
1 parent a9020a4 commit 89a3da4
Showing 1 changed file with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ import scala.collection.mutable
import org.apache.spark.sql.catalyst.InternalRow
import org.apache.spark.sql.catalyst.analysis.{TypeCheckResult, UnresolvedAttribute}
import org.apache.spark.sql.catalyst.expressions.codegen._
import org.apache.spark.sql.catalyst.expressions.codegen.Block._
import org.apache.spark.sql.catalyst.util.{ArrayBasedMapData, ArrayData, GenericArrayData, MapData}
import org.apache.spark.sql.catalyst.util._
import org.apache.spark.sql.types._
import org.apache.spark.unsafe.array.ByteArrayMethods

Expand Down Expand Up @@ -467,9 +466,11 @@ case class MapZipWith(left: Expression, right: Expression, function: Expression)

@transient lazy val functionForEval: Expression = functionsForEval.head

@transient lazy val MapType(keyType, leftValueType, _) = getMapType(left)
@transient lazy val (keyType, leftValueType, _) =
HigherOrderFunction.mapKeyValueArgumentType(left.dataType)

@transient lazy val MapType(_, rightValueType, _) = getMapType(right)
@transient lazy val (_, rightValueType, _) =
HigherOrderFunction.mapKeyValueArgumentType(right.dataType)

@transient lazy val ordering = TypeUtils.getInterpretedOrdering(keyType)

Expand All @@ -491,11 +492,6 @@ case class MapZipWith(left: Expression, right: Expression, function: Expression)
}
}

private def getMapType(expr: Expression) = expr.dataType match {
case m: MapType => m
case _ => MapType.defaultConcreteType
}

override def bind(f: (Expression, Seq[(DataType, Boolean)]) => LambdaFunction): MapZipWith = {
val arguments = Seq((keyType, false), (leftValueType, true), (rightValueType, true))
copy(function = f(function, arguments))
Expand Down

0 comments on commit 89a3da4

Please sign in to comment.