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

    https://github.com/apache/spark/pull/7060#discussion_r33440738
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/stat/StatFunctions.scala 
---
    @@ -119,14 +119,14 @@ private[sql] object StatFunctions extends Logging {
           rows.foreach { (row: Row) =>
             // row.get(0) is column 1
             // row.get(1) is column 2
    -        // row.get(3) is the frequency
    +        // row.get(2) is the frequency
             countsRow.setLong(distinctCol2.get(row.get(1)).get + 1, 
row.getLong(2))
           }
           // the value of col1 is the first value, the rest are the counts
           countsRow.setString(0, col1Item.toString)
           countsRow
         }.toSeq
    -    val headerNames = distinctCol2.map(r => StructField(r._1.toString, 
LongType)).toSeq
    +    val headerNames = distinctCol2.toSeq.sortBy(_._2).map(r => 
StructField(r._1.toString, LongType))
    --- End diff --
    
    maybe add inline comment explaining what _2 is?


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to