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

    https://github.com/apache/spark/pull/9718#discussion_r44868778
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/CodeGenerator.scala
 ---
    @@ -267,6 +267,55 @@ class CodeGenContext {
         case dt: DataType if isPrimitiveType(dt) => s"($c1 > $c2 ? 1 : $c1 < 
$c2 ? -1 : 0)"
         case BinaryType => 
s"org.apache.spark.sql.catalyst.util.TypeUtils.compareBinary($c1, $c2)"
         case NullType => "0"
    +    case array: ArrayType =>
    +      val elementType = array.elementType
    +      val elementA = freshName("elementA")
    +      val isNullA = freshName("isNullA")
    +      val elementB = freshName("elementB")
    +      val isNullB = freshName("isNullB")
    +      val compareFunc = freshName("compareArray")
    +      val i = freshName("i")
    +      val minLength = freshName("minLength")
    +      val funcCode: String =
    +        s"""
    +          public int $compareFunc(ArrayData a, ArrayData b) {
    +            int lengthA = a.numElements();
    +            int lengthB = b.numElements();
    +            int $minLength = (lengthA > lengthB) ? lengthB : lengthA;
    +            boolean $isNullA;
    +            boolean $isNullB;
    +            ${javaType(elementType)} $elementA;
    +            ${javaType(elementType)} $elementB;
    --- End diff --
    
    These could be defined in the loop (let compiler to optimize them easily)


---
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