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

    https://github.com/apache/spark/pull/16797#discussion_r99458106
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetReadSupport.scala
 ---
    @@ -268,13 +292,23 @@ private[parquet] object ParquetReadSupport {
        * @return A list of clipped [[GroupType]] fields, which can be empty.
        */
       private def clipParquetGroupFields(
    -      parquetRecord: GroupType, structType: StructType): Seq[Type] = {
    -    val parquetFieldMap = parquetRecord.getFields.asScala.map(f => 
f.getName -> f).toMap
    +      parquetRecord: GroupType,
    +      structType: StructType,
    +      caseInsensitive: Boolean): Seq[Type] = {
    +    val parquetFieldMap = {
    +      val pairs = parquetRecord.getFields.asScala.map(f => f.getName -> f)
    +      implicit val ordering = if (caseInsensitive) {
    +        Ordering.by[String, String](_.toLowerCase)
    +      } else {
    +        Ordering.String
    +      }
    +      TreeMap(pairs: _*)
    --- End diff --
    
    In the current implementation, we exploit the sorted map keyspace to define 
an ordering where, if configured, lookups are case-insensitive due to sorting 
by the downcased key.
    
    We only use the values in the map at one point though, so I'll just roll it 
back to using a standard Map and add an if/else for downcasing the key when 
creating/accessing the map.


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