Github user kiszk commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17172#discussion_r105103962
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/objects.scala ---
    @@ -219,7 +219,33 @@ case class MapElementsExec(
       override def doConsume(ctx: CodegenContext, input: Seq[ExprCode], row: 
ExprCode): String = {
         val (funcClass, methodName) = func match {
           case m: MapFunction[_, _] => classOf[MapFunction[_, _]] -> "call"
    -      case _ => classOf[Any => Any] -> "apply"
    +      case _ => (child.output(0).dataType, outputObjAttr.dataType) match {
    +        // if a pair of an argument and return types is one of specific 
types
    +        // whose specialized method (apply$mc..$sp) is generated by scalac,
    +        // Catalyst generated a direct method call to the specialized 
method.
    +        // The followings are references for this specialization:
    +        //   
https://github.com/scala/scala/blob/2.11.x/src/compiler/scala/tools/nsc/transform/
    +        //     SpecializeTypes.scala
    +        //   
http://www.cakesolutions.net/teamblogs/scala-dissection-functions
    +        //   http://axel22.github.io/2013/11/03/specialization-quirks.html
    +        case (IntegerType, IntegerType) => classOf[Int => Int] -> 
"apply$mcII$sp"
    +        case (IntegerType, LongType) => classOf[Int => Long] -> 
"apply$mcJI$sp"
    --- End diff --
    
    Yes, I found a composable way.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to