Github user davies commented on a diff in the pull request: https://github.com/apache/spark/pull/9565#discussion_r46185944 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/ScalaUDF.scala --- @@ -66,980 +85,305 @@ case class ScalaUDF( */ - // Accessors used in genCode - def userDefinedFunc(): AnyRef = function - def getChildren(): Seq[Expression] = children - - private[this] val f = children.size match { - case 0 => - val func = function.asInstanceOf[() => Any] - (input: InternalRow) => { - func() - } - - case 1 => - val func = function.asInstanceOf[(Any) => Any] - val child0 = children(0) - lazy val converter0 = CatalystTypeConverters.createToScalaConverter(child0.dataType) - (input: InternalRow) => { - func( - converter0(child0.eval(input))) - } - - case 2 => - val func = function.asInstanceOf[(Any, Any) => Any] - val child0 = children(0) - val child1 = children(1) - lazy val converter0 = CatalystTypeConverters.createToScalaConverter(child0.dataType) - lazy val converter1 = CatalystTypeConverters.createToScalaConverter(child1.dataType) - (input: InternalRow) => { - func( - converter0(child0.eval(input)), - converter1(child1.eval(input))) - } - - case 3 => - val func = function.asInstanceOf[(Any, Any, Any) => Any] - val child0 = children(0) - val child1 = children(1) - val child2 = children(2) - lazy val converter0 = CatalystTypeConverters.createToScalaConverter(child0.dataType) - lazy val converter1 = CatalystTypeConverters.createToScalaConverter(child1.dataType) - lazy val converter2 = CatalystTypeConverters.createToScalaConverter(child2.dataType) - (input: InternalRow) => { - func( - converter0(child0.eval(input)), - converter1(child1.eval(input)), - converter2(child2.eval(input))) - } - - case 4 => - val func = function.asInstanceOf[(Any, Any, Any, Any) => Any] - val child0 = children(0) - val child1 = children(1) - val child2 = children(2) - val child3 = children(3) - lazy val converter0 = CatalystTypeConverters.createToScalaConverter(child0.dataType) - lazy val converter1 = CatalystTypeConverters.createToScalaConverter(child1.dataType) - lazy val converter2 = CatalystTypeConverters.createToScalaConverter(child2.dataType) - lazy val converter3 = CatalystTypeConverters.createToScalaConverter(child3.dataType) - (input: InternalRow) => { - func( - converter0(child0.eval(input)), - converter1(child1.eval(input)), - converter2(child2.eval(input)), - converter3(child3.eval(input))) - } - - case 5 => - val func = function.asInstanceOf[(Any, Any, Any, Any, Any) => Any] - val child0 = children(0) - val child1 = children(1) - val child2 = children(2) - val child3 = children(3) - val child4 = children(4) - lazy val converter0 = CatalystTypeConverters.createToScalaConverter(child0.dataType) - lazy val converter1 = CatalystTypeConverters.createToScalaConverter(child1.dataType) - lazy val converter2 = CatalystTypeConverters.createToScalaConverter(child2.dataType) - lazy val converter3 = CatalystTypeConverters.createToScalaConverter(child3.dataType) - lazy val converter4 = CatalystTypeConverters.createToScalaConverter(child4.dataType) - (input: InternalRow) => { - func( - converter0(child0.eval(input)), - converter1(child1.eval(input)), - converter2(child2.eval(input)), - converter3(child3.eval(input)), - converter4(child4.eval(input))) - } - - case 6 => - val func = function.asInstanceOf[(Any, Any, Any, Any, Any, Any) => Any] - val child0 = children(0) - val child1 = children(1) - val child2 = children(2) - val child3 = children(3) - val child4 = children(4) - val child5 = children(5) - lazy val converter0 = CatalystTypeConverters.createToScalaConverter(child0.dataType) - lazy val converter1 = CatalystTypeConverters.createToScalaConverter(child1.dataType) - lazy val converter2 = CatalystTypeConverters.createToScalaConverter(child2.dataType) - lazy val converter3 = CatalystTypeConverters.createToScalaConverter(child3.dataType) - lazy val converter4 = CatalystTypeConverters.createToScalaConverter(child4.dataType) - lazy val converter5 = CatalystTypeConverters.createToScalaConverter(child5.dataType) - (input: InternalRow) => { - func( - converter0(child0.eval(input)), - converter1(child1.eval(input)), - converter2(child2.eval(input)), - converter3(child3.eval(input)), - converter4(child4.eval(input)), - converter5(child5.eval(input))) - } - - case 7 => - val func = function.asInstanceOf[(Any, Any, Any, Any, Any, Any, Any) => Any] - val child0 = children(0) - val child1 = children(1) - val child2 = children(2) - val child3 = children(3) - val child4 = children(4) - val child5 = children(5) - val child6 = children(6) - lazy val converter0 = CatalystTypeConverters.createToScalaConverter(child0.dataType) - lazy val converter1 = CatalystTypeConverters.createToScalaConverter(child1.dataType) - lazy val converter2 = CatalystTypeConverters.createToScalaConverter(child2.dataType) - lazy val converter3 = CatalystTypeConverters.createToScalaConverter(child3.dataType) - lazy val converter4 = CatalystTypeConverters.createToScalaConverter(child4.dataType) - lazy val converter5 = CatalystTypeConverters.createToScalaConverter(child5.dataType) - lazy val converter6 = CatalystTypeConverters.createToScalaConverter(child6.dataType) - (input: InternalRow) => { - func( - converter0(child0.eval(input)), - converter1(child1.eval(input)), - converter2(child2.eval(input)), - converter3(child3.eval(input)), - converter4(child4.eval(input)), - converter5(child5.eval(input)), - converter6(child6.eval(input))) - } - - case 8 => - val func = function.asInstanceOf[(Any, Any, Any, Any, Any, Any, Any, Any) => Any] - val child0 = children(0) - val child1 = children(1) - val child2 = children(2) - val child3 = children(3) - val child4 = children(4) - val child5 = children(5) - val child6 = children(6) - val child7 = children(7) - lazy val converter0 = CatalystTypeConverters.createToScalaConverter(child0.dataType) - lazy val converter1 = CatalystTypeConverters.createToScalaConverter(child1.dataType) - lazy val converter2 = CatalystTypeConverters.createToScalaConverter(child2.dataType) - lazy val converter3 = CatalystTypeConverters.createToScalaConverter(child3.dataType) - lazy val converter4 = CatalystTypeConverters.createToScalaConverter(child4.dataType) - lazy val converter5 = CatalystTypeConverters.createToScalaConverter(child5.dataType) - lazy val converter6 = CatalystTypeConverters.createToScalaConverter(child6.dataType) - lazy val converter7 = CatalystTypeConverters.createToScalaConverter(child7.dataType) - (input: InternalRow) => { - func( - converter0(child0.eval(input)), - converter1(child1.eval(input)), - converter2(child2.eval(input)), - converter3(child3.eval(input)), - converter4(child4.eval(input)), - converter5(child5.eval(input)), - converter6(child6.eval(input)), - converter7(child7.eval(input))) - } - - case 9 => - val func = function.asInstanceOf[(Any, Any, Any, Any, Any, Any, Any, Any, Any) => Any] - val child0 = children(0) - val child1 = children(1) - val child2 = children(2) - val child3 = children(3) - val child4 = children(4) - val child5 = children(5) - val child6 = children(6) - val child7 = children(7) - val child8 = children(8) - lazy val converter0 = CatalystTypeConverters.createToScalaConverter(child0.dataType) - lazy val converter1 = CatalystTypeConverters.createToScalaConverter(child1.dataType) - lazy val converter2 = CatalystTypeConverters.createToScalaConverter(child2.dataType) - lazy val converter3 = CatalystTypeConverters.createToScalaConverter(child3.dataType) - lazy val converter4 = CatalystTypeConverters.createToScalaConverter(child4.dataType) - lazy val converter5 = CatalystTypeConverters.createToScalaConverter(child5.dataType) - lazy val converter6 = CatalystTypeConverters.createToScalaConverter(child6.dataType) - lazy val converter7 = CatalystTypeConverters.createToScalaConverter(child7.dataType) - lazy val converter8 = CatalystTypeConverters.createToScalaConverter(child8.dataType) - (input: InternalRow) => { - func( - converter0(child0.eval(input)), - converter1(child1.eval(input)), - converter2(child2.eval(input)), - converter3(child3.eval(input)), - converter4(child4.eval(input)), - converter5(child5.eval(input)), - converter6(child6.eval(input)), - converter7(child7.eval(input)), - converter8(child8.eval(input))) - } - - case 10 => - val func = function.asInstanceOf[(Any, Any, Any, Any, Any, Any, Any, Any, Any, Any) => Any] - val child0 = children(0) - val child1 = children(1) - val child2 = children(2) - val child3 = children(3) - val child4 = children(4) - val child5 = children(5) - val child6 = children(6) - val child7 = children(7) - val child8 = children(8) - val child9 = children(9) - lazy val converter0 = CatalystTypeConverters.createToScalaConverter(child0.dataType) - lazy val converter1 = CatalystTypeConverters.createToScalaConverter(child1.dataType) - lazy val converter2 = CatalystTypeConverters.createToScalaConverter(child2.dataType) - lazy val converter3 = CatalystTypeConverters.createToScalaConverter(child3.dataType) - lazy val converter4 = CatalystTypeConverters.createToScalaConverter(child4.dataType) - lazy val converter5 = CatalystTypeConverters.createToScalaConverter(child5.dataType) - lazy val converter6 = CatalystTypeConverters.createToScalaConverter(child6.dataType) - lazy val converter7 = CatalystTypeConverters.createToScalaConverter(child7.dataType) - lazy val converter8 = CatalystTypeConverters.createToScalaConverter(child8.dataType) - lazy val converter9 = CatalystTypeConverters.createToScalaConverter(child9.dataType) - (input: InternalRow) => { - func( - converter0(child0.eval(input)), - converter1(child1.eval(input)), - converter2(child2.eval(input)), - converter3(child3.eval(input)), - converter4(child4.eval(input)), - converter5(child5.eval(input)), - converter6(child6.eval(input)), - converter7(child7.eval(input)), - converter8(child8.eval(input)), - converter9(child9.eval(input))) - } - - case 11 => - val func = function.asInstanceOf[(Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any) => Any] - val child0 = children(0) - val child1 = children(1) - val child2 = children(2) - val child3 = children(3) - val child4 = children(4) - val child5 = children(5) - val child6 = children(6) - val child7 = children(7) - val child8 = children(8) - val child9 = children(9) - val child10 = children(10) - lazy val converter0 = CatalystTypeConverters.createToScalaConverter(child0.dataType) - lazy val converter1 = CatalystTypeConverters.createToScalaConverter(child1.dataType) - lazy val converter2 = CatalystTypeConverters.createToScalaConverter(child2.dataType) - lazy val converter3 = CatalystTypeConverters.createToScalaConverter(child3.dataType) - lazy val converter4 = CatalystTypeConverters.createToScalaConverter(child4.dataType) - lazy val converter5 = CatalystTypeConverters.createToScalaConverter(child5.dataType) - lazy val converter6 = CatalystTypeConverters.createToScalaConverter(child6.dataType) - lazy val converter7 = CatalystTypeConverters.createToScalaConverter(child7.dataType) - lazy val converter8 = CatalystTypeConverters.createToScalaConverter(child8.dataType) - lazy val converter9 = CatalystTypeConverters.createToScalaConverter(child9.dataType) - lazy val converter10 = CatalystTypeConverters.createToScalaConverter(child10.dataType) - (input: InternalRow) => { - func( - converter0(child0.eval(input)), - converter1(child1.eval(input)), - converter2(child2.eval(input)), - converter3(child3.eval(input)), - converter4(child4.eval(input)), - converter5(child5.eval(input)), - converter6(child6.eval(input)), - converter7(child7.eval(input)), - converter8(child8.eval(input)), - converter9(child9.eval(input)), - converter10(child10.eval(input))) - } - - case 12 => - val func = function.asInstanceOf[(Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any) => Any] - val child0 = children(0) - val child1 = children(1) - val child2 = children(2) - val child3 = children(3) - val child4 = children(4) - val child5 = children(5) - val child6 = children(6) - val child7 = children(7) - val child8 = children(8) - val child9 = children(9) - val child10 = children(10) - val child11 = children(11) - lazy val converter0 = CatalystTypeConverters.createToScalaConverter(child0.dataType) - lazy val converter1 = CatalystTypeConverters.createToScalaConverter(child1.dataType) - lazy val converter2 = CatalystTypeConverters.createToScalaConverter(child2.dataType) - lazy val converter3 = CatalystTypeConverters.createToScalaConverter(child3.dataType) - lazy val converter4 = CatalystTypeConverters.createToScalaConverter(child4.dataType) - lazy val converter5 = CatalystTypeConverters.createToScalaConverter(child5.dataType) - lazy val converter6 = CatalystTypeConverters.createToScalaConverter(child6.dataType) - lazy val converter7 = CatalystTypeConverters.createToScalaConverter(child7.dataType) - lazy val converter8 = CatalystTypeConverters.createToScalaConverter(child8.dataType) - lazy val converter9 = CatalystTypeConverters.createToScalaConverter(child9.dataType) - lazy val converter10 = CatalystTypeConverters.createToScalaConverter(child10.dataType) - lazy val converter11 = CatalystTypeConverters.createToScalaConverter(child11.dataType) - (input: InternalRow) => { - func( - converter0(child0.eval(input)), - converter1(child1.eval(input)), - converter2(child2.eval(input)), - converter3(child3.eval(input)), - converter4(child4.eval(input)), - converter5(child5.eval(input)), - converter6(child6.eval(input)), - converter7(child7.eval(input)), - converter8(child8.eval(input)), - converter9(child9.eval(input)), - converter10(child10.eval(input)), - converter11(child11.eval(input))) - } - - case 13 => - val func = function.asInstanceOf[(Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any) => Any] - val child0 = children(0) - val child1 = children(1) - val child2 = children(2) - val child3 = children(3) - val child4 = children(4) - val child5 = children(5) - val child6 = children(6) - val child7 = children(7) - val child8 = children(8) - val child9 = children(9) - val child10 = children(10) - val child11 = children(11) - val child12 = children(12) - lazy val converter0 = CatalystTypeConverters.createToScalaConverter(child0.dataType) - lazy val converter1 = CatalystTypeConverters.createToScalaConverter(child1.dataType) - lazy val converter2 = CatalystTypeConverters.createToScalaConverter(child2.dataType) - lazy val converter3 = CatalystTypeConverters.createToScalaConverter(child3.dataType) - lazy val converter4 = CatalystTypeConverters.createToScalaConverter(child4.dataType) - lazy val converter5 = CatalystTypeConverters.createToScalaConverter(child5.dataType) - lazy val converter6 = CatalystTypeConverters.createToScalaConverter(child6.dataType) - lazy val converter7 = CatalystTypeConverters.createToScalaConverter(child7.dataType) - lazy val converter8 = CatalystTypeConverters.createToScalaConverter(child8.dataType) - lazy val converter9 = CatalystTypeConverters.createToScalaConverter(child9.dataType) - lazy val converter10 = CatalystTypeConverters.createToScalaConverter(child10.dataType) - lazy val converter11 = CatalystTypeConverters.createToScalaConverter(child11.dataType) - lazy val converter12 = CatalystTypeConverters.createToScalaConverter(child12.dataType) - (input: InternalRow) => { - func( - converter0(child0.eval(input)), - converter1(child1.eval(input)), - converter2(child2.eval(input)), - converter3(child3.eval(input)), - converter4(child4.eval(input)), - converter5(child5.eval(input)), - converter6(child6.eval(input)), - converter7(child7.eval(input)), - converter8(child8.eval(input)), - converter9(child9.eval(input)), - converter10(child10.eval(input)), - converter11(child11.eval(input)), - converter12(child12.eval(input))) - } - - case 14 => - val func = function.asInstanceOf[(Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any) => Any] - val child0 = children(0) - val child1 = children(1) - val child2 = children(2) - val child3 = children(3) - val child4 = children(4) - val child5 = children(5) - val child6 = children(6) - val child7 = children(7) - val child8 = children(8) - val child9 = children(9) - val child10 = children(10) - val child11 = children(11) - val child12 = children(12) - val child13 = children(13) - lazy val converter0 = CatalystTypeConverters.createToScalaConverter(child0.dataType) - lazy val converter1 = CatalystTypeConverters.createToScalaConverter(child1.dataType) - lazy val converter2 = CatalystTypeConverters.createToScalaConverter(child2.dataType) - lazy val converter3 = CatalystTypeConverters.createToScalaConverter(child3.dataType) - lazy val converter4 = CatalystTypeConverters.createToScalaConverter(child4.dataType) - lazy val converter5 = CatalystTypeConverters.createToScalaConverter(child5.dataType) - lazy val converter6 = CatalystTypeConverters.createToScalaConverter(child6.dataType) - lazy val converter7 = CatalystTypeConverters.createToScalaConverter(child7.dataType) - lazy val converter8 = CatalystTypeConverters.createToScalaConverter(child8.dataType) - lazy val converter9 = CatalystTypeConverters.createToScalaConverter(child9.dataType) - lazy val converter10 = CatalystTypeConverters.createToScalaConverter(child10.dataType) - lazy val converter11 = CatalystTypeConverters.createToScalaConverter(child11.dataType) - lazy val converter12 = CatalystTypeConverters.createToScalaConverter(child12.dataType) - lazy val converter13 = CatalystTypeConverters.createToScalaConverter(child13.dataType) - (input: InternalRow) => { - func( - converter0(child0.eval(input)), - converter1(child1.eval(input)), - converter2(child2.eval(input)), - converter3(child3.eval(input)), - converter4(child4.eval(input)), - converter5(child5.eval(input)), - converter6(child6.eval(input)), - converter7(child7.eval(input)), - converter8(child8.eval(input)), - converter9(child9.eval(input)), - converter10(child10.eval(input)), - converter11(child11.eval(input)), - converter12(child12.eval(input)), - converter13(child13.eval(input))) - } - - case 15 => - val func = function.asInstanceOf[(Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any) => Any] - val child0 = children(0) - val child1 = children(1) - val child2 = children(2) - val child3 = children(3) - val child4 = children(4) - val child5 = children(5) - val child6 = children(6) - val child7 = children(7) - val child8 = children(8) - val child9 = children(9) - val child10 = children(10) - val child11 = children(11) - val child12 = children(12) - val child13 = children(13) - val child14 = children(14) - lazy val converter0 = CatalystTypeConverters.createToScalaConverter(child0.dataType) - lazy val converter1 = CatalystTypeConverters.createToScalaConverter(child1.dataType) - lazy val converter2 = CatalystTypeConverters.createToScalaConverter(child2.dataType) - lazy val converter3 = CatalystTypeConverters.createToScalaConverter(child3.dataType) - lazy val converter4 = CatalystTypeConverters.createToScalaConverter(child4.dataType) - lazy val converter5 = CatalystTypeConverters.createToScalaConverter(child5.dataType) - lazy val converter6 = CatalystTypeConverters.createToScalaConverter(child6.dataType) - lazy val converter7 = CatalystTypeConverters.createToScalaConverter(child7.dataType) - lazy val converter8 = CatalystTypeConverters.createToScalaConverter(child8.dataType) - lazy val converter9 = CatalystTypeConverters.createToScalaConverter(child9.dataType) - lazy val converter10 = CatalystTypeConverters.createToScalaConverter(child10.dataType) - lazy val converter11 = CatalystTypeConverters.createToScalaConverter(child11.dataType) - lazy val converter12 = CatalystTypeConverters.createToScalaConverter(child12.dataType) - lazy val converter13 = CatalystTypeConverters.createToScalaConverter(child13.dataType) - lazy val converter14 = CatalystTypeConverters.createToScalaConverter(child14.dataType) - (input: InternalRow) => { - func( - converter0(child0.eval(input)), - converter1(child1.eval(input)), - converter2(child2.eval(input)), - converter3(child3.eval(input)), - converter4(child4.eval(input)), - converter5(child5.eval(input)), - converter6(child6.eval(input)), - converter7(child7.eval(input)), - converter8(child8.eval(input)), - converter9(child9.eval(input)), - converter10(child10.eval(input)), - converter11(child11.eval(input)), - converter12(child12.eval(input)), - converter13(child13.eval(input)), - converter14(child14.eval(input))) - } - - case 16 => - val func = function.asInstanceOf[(Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any) => Any] - val child0 = children(0) - val child1 = children(1) - val child2 = children(2) - val child3 = children(3) - val child4 = children(4) - val child5 = children(5) - val child6 = children(6) - val child7 = children(7) - val child8 = children(8) - val child9 = children(9) - val child10 = children(10) - val child11 = children(11) - val child12 = children(12) - val child13 = children(13) - val child14 = children(14) - val child15 = children(15) - lazy val converter0 = CatalystTypeConverters.createToScalaConverter(child0.dataType) - lazy val converter1 = CatalystTypeConverters.createToScalaConverter(child1.dataType) - lazy val converter2 = CatalystTypeConverters.createToScalaConverter(child2.dataType) - lazy val converter3 = CatalystTypeConverters.createToScalaConverter(child3.dataType) - lazy val converter4 = CatalystTypeConverters.createToScalaConverter(child4.dataType) - lazy val converter5 = CatalystTypeConverters.createToScalaConverter(child5.dataType) - lazy val converter6 = CatalystTypeConverters.createToScalaConverter(child6.dataType) - lazy val converter7 = CatalystTypeConverters.createToScalaConverter(child7.dataType) - lazy val converter8 = CatalystTypeConverters.createToScalaConverter(child8.dataType) - lazy val converter9 = CatalystTypeConverters.createToScalaConverter(child9.dataType) - lazy val converter10 = CatalystTypeConverters.createToScalaConverter(child10.dataType) - lazy val converter11 = CatalystTypeConverters.createToScalaConverter(child11.dataType) - lazy val converter12 = CatalystTypeConverters.createToScalaConverter(child12.dataType) - lazy val converter13 = CatalystTypeConverters.createToScalaConverter(child13.dataType) - lazy val converter14 = CatalystTypeConverters.createToScalaConverter(child14.dataType) - lazy val converter15 = CatalystTypeConverters.createToScalaConverter(child15.dataType) - (input: InternalRow) => { - func( - converter0(child0.eval(input)), - converter1(child1.eval(input)), - converter2(child2.eval(input)), - converter3(child3.eval(input)), - converter4(child4.eval(input)), - converter5(child5.eval(input)), - converter6(child6.eval(input)), - converter7(child7.eval(input)), - converter8(child8.eval(input)), - converter9(child9.eval(input)), - converter10(child10.eval(input)), - converter11(child11.eval(input)), - converter12(child12.eval(input)), - converter13(child13.eval(input)), - converter14(child14.eval(input)), - converter15(child15.eval(input))) - } - - case 17 => - val func = function.asInstanceOf[(Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any) => Any] - val child0 = children(0) - val child1 = children(1) - val child2 = children(2) - val child3 = children(3) - val child4 = children(4) - val child5 = children(5) - val child6 = children(6) - val child7 = children(7) - val child8 = children(8) - val child9 = children(9) - val child10 = children(10) - val child11 = children(11) - val child12 = children(12) - val child13 = children(13) - val child14 = children(14) - val child15 = children(15) - val child16 = children(16) - lazy val converter0 = CatalystTypeConverters.createToScalaConverter(child0.dataType) - lazy val converter1 = CatalystTypeConverters.createToScalaConverter(child1.dataType) - lazy val converter2 = CatalystTypeConverters.createToScalaConverter(child2.dataType) - lazy val converter3 = CatalystTypeConverters.createToScalaConverter(child3.dataType) - lazy val converter4 = CatalystTypeConverters.createToScalaConverter(child4.dataType) - lazy val converter5 = CatalystTypeConverters.createToScalaConverter(child5.dataType) - lazy val converter6 = CatalystTypeConverters.createToScalaConverter(child6.dataType) - lazy val converter7 = CatalystTypeConverters.createToScalaConverter(child7.dataType) - lazy val converter8 = CatalystTypeConverters.createToScalaConverter(child8.dataType) - lazy val converter9 = CatalystTypeConverters.createToScalaConverter(child9.dataType) - lazy val converter10 = CatalystTypeConverters.createToScalaConverter(child10.dataType) - lazy val converter11 = CatalystTypeConverters.createToScalaConverter(child11.dataType) - lazy val converter12 = CatalystTypeConverters.createToScalaConverter(child12.dataType) - lazy val converter13 = CatalystTypeConverters.createToScalaConverter(child13.dataType) - lazy val converter14 = CatalystTypeConverters.createToScalaConverter(child14.dataType) - lazy val converter15 = CatalystTypeConverters.createToScalaConverter(child15.dataType) - lazy val converter16 = CatalystTypeConverters.createToScalaConverter(child16.dataType) - (input: InternalRow) => { - func( - converter0(child0.eval(input)), - converter1(child1.eval(input)), - converter2(child2.eval(input)), - converter3(child3.eval(input)), - converter4(child4.eval(input)), - converter5(child5.eval(input)), - converter6(child6.eval(input)), - converter7(child7.eval(input)), - converter8(child8.eval(input)), - converter9(child9.eval(input)), - converter10(child10.eval(input)), - converter11(child11.eval(input)), - converter12(child12.eval(input)), - converter13(child13.eval(input)), - converter14(child14.eval(input)), - converter15(child15.eval(input)), - converter16(child16.eval(input))) - } - - case 18 => - val func = function.asInstanceOf[(Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any) => Any] - val child0 = children(0) - val child1 = children(1) - val child2 = children(2) - val child3 = children(3) - val child4 = children(4) - val child5 = children(5) - val child6 = children(6) - val child7 = children(7) - val child8 = children(8) - val child9 = children(9) - val child10 = children(10) - val child11 = children(11) - val child12 = children(12) - val child13 = children(13) - val child14 = children(14) - val child15 = children(15) - val child16 = children(16) - val child17 = children(17) - lazy val converter0 = CatalystTypeConverters.createToScalaConverter(child0.dataType) - lazy val converter1 = CatalystTypeConverters.createToScalaConverter(child1.dataType) - lazy val converter2 = CatalystTypeConverters.createToScalaConverter(child2.dataType) - lazy val converter3 = CatalystTypeConverters.createToScalaConverter(child3.dataType) - lazy val converter4 = CatalystTypeConverters.createToScalaConverter(child4.dataType) - lazy val converter5 = CatalystTypeConverters.createToScalaConverter(child5.dataType) - lazy val converter6 = CatalystTypeConverters.createToScalaConverter(child6.dataType) - lazy val converter7 = CatalystTypeConverters.createToScalaConverter(child7.dataType) - lazy val converter8 = CatalystTypeConverters.createToScalaConverter(child8.dataType) - lazy val converter9 = CatalystTypeConverters.createToScalaConverter(child9.dataType) - lazy val converter10 = CatalystTypeConverters.createToScalaConverter(child10.dataType) - lazy val converter11 = CatalystTypeConverters.createToScalaConverter(child11.dataType) - lazy val converter12 = CatalystTypeConverters.createToScalaConverter(child12.dataType) - lazy val converter13 = CatalystTypeConverters.createToScalaConverter(child13.dataType) - lazy val converter14 = CatalystTypeConverters.createToScalaConverter(child14.dataType) - lazy val converter15 = CatalystTypeConverters.createToScalaConverter(child15.dataType) - lazy val converter16 = CatalystTypeConverters.createToScalaConverter(child16.dataType) - lazy val converter17 = CatalystTypeConverters.createToScalaConverter(child17.dataType) - (input: InternalRow) => { - func( - converter0(child0.eval(input)), - converter1(child1.eval(input)), - converter2(child2.eval(input)), - converter3(child3.eval(input)), - converter4(child4.eval(input)), - converter5(child5.eval(input)), - converter6(child6.eval(input)), - converter7(child7.eval(input)), - converter8(child8.eval(input)), - converter9(child9.eval(input)), - converter10(child10.eval(input)), - converter11(child11.eval(input)), - converter12(child12.eval(input)), - converter13(child13.eval(input)), - converter14(child14.eval(input)), - converter15(child15.eval(input)), - converter16(child16.eval(input)), - converter17(child17.eval(input))) - } - - case 19 => - val func = function.asInstanceOf[(Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any) => Any] - val child0 = children(0) - val child1 = children(1) - val child2 = children(2) - val child3 = children(3) - val child4 = children(4) - val child5 = children(5) - val child6 = children(6) - val child7 = children(7) - val child8 = children(8) - val child9 = children(9) - val child10 = children(10) - val child11 = children(11) - val child12 = children(12) - val child13 = children(13) - val child14 = children(14) - val child15 = children(15) - val child16 = children(16) - val child17 = children(17) - val child18 = children(18) - lazy val converter0 = CatalystTypeConverters.createToScalaConverter(child0.dataType) - lazy val converter1 = CatalystTypeConverters.createToScalaConverter(child1.dataType) - lazy val converter2 = CatalystTypeConverters.createToScalaConverter(child2.dataType) - lazy val converter3 = CatalystTypeConverters.createToScalaConverter(child3.dataType) - lazy val converter4 = CatalystTypeConverters.createToScalaConverter(child4.dataType) - lazy val converter5 = CatalystTypeConverters.createToScalaConverter(child5.dataType) - lazy val converter6 = CatalystTypeConverters.createToScalaConverter(child6.dataType) - lazy val converter7 = CatalystTypeConverters.createToScalaConverter(child7.dataType) - lazy val converter8 = CatalystTypeConverters.createToScalaConverter(child8.dataType) - lazy val converter9 = CatalystTypeConverters.createToScalaConverter(child9.dataType) - lazy val converter10 = CatalystTypeConverters.createToScalaConverter(child10.dataType) - lazy val converter11 = CatalystTypeConverters.createToScalaConverter(child11.dataType) - lazy val converter12 = CatalystTypeConverters.createToScalaConverter(child12.dataType) - lazy val converter13 = CatalystTypeConverters.createToScalaConverter(child13.dataType) - lazy val converter14 = CatalystTypeConverters.createToScalaConverter(child14.dataType) - lazy val converter15 = CatalystTypeConverters.createToScalaConverter(child15.dataType) - lazy val converter16 = CatalystTypeConverters.createToScalaConverter(child16.dataType) - lazy val converter17 = CatalystTypeConverters.createToScalaConverter(child17.dataType) - lazy val converter18 = CatalystTypeConverters.createToScalaConverter(child18.dataType) - (input: InternalRow) => { - func( - converter0(child0.eval(input)), - converter1(child1.eval(input)), - converter2(child2.eval(input)), - converter3(child3.eval(input)), - converter4(child4.eval(input)), - converter5(child5.eval(input)), - converter6(child6.eval(input)), - converter7(child7.eval(input)), - converter8(child8.eval(input)), - converter9(child9.eval(input)), - converter10(child10.eval(input)), - converter11(child11.eval(input)), - converter12(child12.eval(input)), - converter13(child13.eval(input)), - converter14(child14.eval(input)), - converter15(child15.eval(input)), - converter16(child16.eval(input)), - converter17(child17.eval(input)), - converter18(child18.eval(input))) - } - - case 20 => - val func = function.asInstanceOf[(Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any) => Any] - val child0 = children(0) - val child1 = children(1) - val child2 = children(2) - val child3 = children(3) - val child4 = children(4) - val child5 = children(5) - val child6 = children(6) - val child7 = children(7) - val child8 = children(8) - val child9 = children(9) - val child10 = children(10) - val child11 = children(11) - val child12 = children(12) - val child13 = children(13) - val child14 = children(14) - val child15 = children(15) - val child16 = children(16) - val child17 = children(17) - val child18 = children(18) - val child19 = children(19) - lazy val converter0 = CatalystTypeConverters.createToScalaConverter(child0.dataType) - lazy val converter1 = CatalystTypeConverters.createToScalaConverter(child1.dataType) - lazy val converter2 = CatalystTypeConverters.createToScalaConverter(child2.dataType) - lazy val converter3 = CatalystTypeConverters.createToScalaConverter(child3.dataType) - lazy val converter4 = CatalystTypeConverters.createToScalaConverter(child4.dataType) - lazy val converter5 = CatalystTypeConverters.createToScalaConverter(child5.dataType) - lazy val converter6 = CatalystTypeConverters.createToScalaConverter(child6.dataType) - lazy val converter7 = CatalystTypeConverters.createToScalaConverter(child7.dataType) - lazy val converter8 = CatalystTypeConverters.createToScalaConverter(child8.dataType) - lazy val converter9 = CatalystTypeConverters.createToScalaConverter(child9.dataType) - lazy val converter10 = CatalystTypeConverters.createToScalaConverter(child10.dataType) - lazy val converter11 = CatalystTypeConverters.createToScalaConverter(child11.dataType) - lazy val converter12 = CatalystTypeConverters.createToScalaConverter(child12.dataType) - lazy val converter13 = CatalystTypeConverters.createToScalaConverter(child13.dataType) - lazy val converter14 = CatalystTypeConverters.createToScalaConverter(child14.dataType) - lazy val converter15 = CatalystTypeConverters.createToScalaConverter(child15.dataType) - lazy val converter16 = CatalystTypeConverters.createToScalaConverter(child16.dataType) - lazy val converter17 = CatalystTypeConverters.createToScalaConverter(child17.dataType) - lazy val converter18 = CatalystTypeConverters.createToScalaConverter(child18.dataType) - lazy val converter19 = CatalystTypeConverters.createToScalaConverter(child19.dataType) - (input: InternalRow) => { - func( - converter0(child0.eval(input)), - converter1(child1.eval(input)), - converter2(child2.eval(input)), - converter3(child3.eval(input)), - converter4(child4.eval(input)), - converter5(child5.eval(input)), - converter6(child6.eval(input)), - converter7(child7.eval(input)), - converter8(child8.eval(input)), - converter9(child9.eval(input)), - converter10(child10.eval(input)), - converter11(child11.eval(input)), - converter12(child12.eval(input)), - converter13(child13.eval(input)), - converter14(child14.eval(input)), - converter15(child15.eval(input)), - converter16(child16.eval(input)), - converter17(child17.eval(input)), - converter18(child18.eval(input)), - converter19(child19.eval(input))) - } - - case 21 => - val func = function.asInstanceOf[(Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any) => Any] - val child0 = children(0) - val child1 = children(1) - val child2 = children(2) - val child3 = children(3) - val child4 = children(4) - val child5 = children(5) - val child6 = children(6) - val child7 = children(7) - val child8 = children(8) - val child9 = children(9) - val child10 = children(10) - val child11 = children(11) - val child12 = children(12) - val child13 = children(13) - val child14 = children(14) - val child15 = children(15) - val child16 = children(16) - val child17 = children(17) - val child18 = children(18) - val child19 = children(19) - val child20 = children(20) - lazy val converter0 = CatalystTypeConverters.createToScalaConverter(child0.dataType) - lazy val converter1 = CatalystTypeConverters.createToScalaConverter(child1.dataType) - lazy val converter2 = CatalystTypeConverters.createToScalaConverter(child2.dataType) - lazy val converter3 = CatalystTypeConverters.createToScalaConverter(child3.dataType) - lazy val converter4 = CatalystTypeConverters.createToScalaConverter(child4.dataType) - lazy val converter5 = CatalystTypeConverters.createToScalaConverter(child5.dataType) - lazy val converter6 = CatalystTypeConverters.createToScalaConverter(child6.dataType) - lazy val converter7 = CatalystTypeConverters.createToScalaConverter(child7.dataType) - lazy val converter8 = CatalystTypeConverters.createToScalaConverter(child8.dataType) - lazy val converter9 = CatalystTypeConverters.createToScalaConverter(child9.dataType) - lazy val converter10 = CatalystTypeConverters.createToScalaConverter(child10.dataType) - lazy val converter11 = CatalystTypeConverters.createToScalaConverter(child11.dataType) - lazy val converter12 = CatalystTypeConverters.createToScalaConverter(child12.dataType) - lazy val converter13 = CatalystTypeConverters.createToScalaConverter(child13.dataType) - lazy val converter14 = CatalystTypeConverters.createToScalaConverter(child14.dataType) - lazy val converter15 = CatalystTypeConverters.createToScalaConverter(child15.dataType) - lazy val converter16 = CatalystTypeConverters.createToScalaConverter(child16.dataType) - lazy val converter17 = CatalystTypeConverters.createToScalaConverter(child17.dataType) - lazy val converter18 = CatalystTypeConverters.createToScalaConverter(child18.dataType) - lazy val converter19 = CatalystTypeConverters.createToScalaConverter(child19.dataType) - lazy val converter20 = CatalystTypeConverters.createToScalaConverter(child20.dataType) - (input: InternalRow) => { - func( - converter0(child0.eval(input)), - converter1(child1.eval(input)), - converter2(child2.eval(input)), - converter3(child3.eval(input)), - converter4(child4.eval(input)), - converter5(child5.eval(input)), - converter6(child6.eval(input)), - converter7(child7.eval(input)), - converter8(child8.eval(input)), - converter9(child9.eval(input)), - converter10(child10.eval(input)), - converter11(child11.eval(input)), - converter12(child12.eval(input)), - converter13(child13.eval(input)), - converter14(child14.eval(input)), - converter15(child15.eval(input)), - converter16(child16.eval(input)), - converter17(child17.eval(input)), - converter18(child18.eval(input)), - converter19(child19.eval(input)), - converter20(child20.eval(input))) - } - - case 22 => - val func = function.asInstanceOf[(Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any, Any) => Any] - val child0 = children(0) - val child1 = children(1) - val child2 = children(2) - val child3 = children(3) - val child4 = children(4) - val child5 = children(5) - val child6 = children(6) - val child7 = children(7) - val child8 = children(8) - val child9 = children(9) - val child10 = children(10) - val child11 = children(11) - val child12 = children(12) - val child13 = children(13) - val child14 = children(14) - val child15 = children(15) - val child16 = children(16) - val child17 = children(17) - val child18 = children(18) - val child19 = children(19) - val child20 = children(20) - val child21 = children(21) - lazy val converter0 = CatalystTypeConverters.createToScalaConverter(child0.dataType) - lazy val converter1 = CatalystTypeConverters.createToScalaConverter(child1.dataType) - lazy val converter2 = CatalystTypeConverters.createToScalaConverter(child2.dataType) - lazy val converter3 = CatalystTypeConverters.createToScalaConverter(child3.dataType) - lazy val converter4 = CatalystTypeConverters.createToScalaConverter(child4.dataType) - lazy val converter5 = CatalystTypeConverters.createToScalaConverter(child5.dataType) - lazy val converter6 = CatalystTypeConverters.createToScalaConverter(child6.dataType) - lazy val converter7 = CatalystTypeConverters.createToScalaConverter(child7.dataType) - lazy val converter8 = CatalystTypeConverters.createToScalaConverter(child8.dataType) - lazy val converter9 = CatalystTypeConverters.createToScalaConverter(child9.dataType) - lazy val converter10 = CatalystTypeConverters.createToScalaConverter(child10.dataType) - lazy val converter11 = CatalystTypeConverters.createToScalaConverter(child11.dataType) - lazy val converter12 = CatalystTypeConverters.createToScalaConverter(child12.dataType) - lazy val converter13 = CatalystTypeConverters.createToScalaConverter(child13.dataType) - lazy val converter14 = CatalystTypeConverters.createToScalaConverter(child14.dataType) - lazy val converter15 = CatalystTypeConverters.createToScalaConverter(child15.dataType) - lazy val converter16 = CatalystTypeConverters.createToScalaConverter(child16.dataType) - lazy val converter17 = CatalystTypeConverters.createToScalaConverter(child17.dataType) - lazy val converter18 = CatalystTypeConverters.createToScalaConverter(child18.dataType) - lazy val converter19 = CatalystTypeConverters.createToScalaConverter(child19.dataType) - lazy val converter20 = CatalystTypeConverters.createToScalaConverter(child20.dataType) - lazy val converter21 = CatalystTypeConverters.createToScalaConverter(child21.dataType) - (input: InternalRow) => { - func( - converter0(child0.eval(input)), - converter1(child1.eval(input)), - converter2(child2.eval(input)), - converter3(child3.eval(input)), - converter4(child4.eval(input)), - converter5(child5.eval(input)), - converter6(child6.eval(input)), - converter7(child7.eval(input)), - converter8(child8.eval(input)), - converter9(child9.eval(input)), - converter10(child10.eval(input)), - converter11(child11.eval(input)), - converter12(child12.eval(input)), - converter13(child13.eval(input)), - converter14(child14.eval(input)), - converter15(child15.eval(input)), - converter16(child16.eval(input)), - converter17(child17.eval(input)), - converter18(child18.eval(input)), - converter19(child19.eval(input)), - converter20(child20.eval(input)), - converter21(child21.eval(input))) - } + private[this] val f = { + lazy val inputEncoder: ExpressionEncoder[Row] = RowEncoder(inputSchema) + children.size match { + case 0 => + val func = function.asInstanceOf[() => Any] + (input: InternalRow) => { + func() + } + + case 1 => + val func = function.asInstanceOf[(Any) => Any] + (input: InternalRow) => { + val convertedRow: Row = inputEncoder.fromRow(input) + func(convertedRow.get(0)) --- End diff -- Could we call this with reflection? Since the interpreted version is not used usually, don't need to worry about the performance.
--- 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