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

    https://github.com/apache/spark/pull/13505#discussion_r65804344
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/package.scala
 ---
    @@ -86,11 +86,31 @@ package object expressions  {
       /**
        * Helper functions for working with `Seq[Attribute]`.
        */
    -  implicit class AttributeSeq(attrs: Seq[Attribute]) {
    +  implicit class AttributeSeq(val attrs: Seq[Attribute]) {
         /** Creates a StructType with a schema matching this `Seq[Attribute]`. 
*/
         def toStructType: StructType = {
           StructType(attrs.map(a => StructField(a.name, a.dataType, 
a.nullable)))
         }
    +
    +    private lazy val inputArr = attrs.toArray
    +
    +    private lazy val inputToOrdinal = {
    +      val map = new java.util.HashMap[ExprId, Int](inputArr.length * 2)
    +      var index = 0
    +      attrs.foreach { attr =>
    +        if (!map.containsKey(attr.exprId)) {
    +          map.put(attr.exprId, index)
    +        }
    +        index += 1
    --- End diff --
    
    Which style is better,  this style or a style to use ```zipWithIndex```?


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