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

    https://github.com/apache/spark/pull/5289#discussion_r27495057
  
    --- Diff: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala ---
    @@ -479,33 +480,28 @@ private[hive] class HiveMetastoreCatalog(hive: 
HiveContext) extends Catalog with
                   
relation.tableDesc.getSerdeClassName.toLowerCase.contains("parquet") =>
               val parquetRelation = convertToParquetRelation(relation)
               val attributedRewrites = 
relation.output.zip(parquetRelation.output)
    -          (relation -> relation.output, parquetRelation, 
attributedRewrites)
    +          (relation, parquetRelation, attributedRewrites)
           }
     
    -      // Quick fix for SPARK-6450: Notice that we're using both the 
MetastoreRelation instances and
    -      // their output attributes as the key of the map. This is because 
MetastoreRelation.equals
    -      // doesn't take output attributes into account, thus multiple 
MetastoreRelation instances
    -      // pointing to the same table get collapsed into a single entry in 
the map. A proper fix for
    -      // this should be overriding equals & hashCode in MetastoreRelation.
           val relationMap = toBeReplaced.map(r => (r._1, r._2)).toMap
           val attributedRewrites = 
AttributeMap(toBeReplaced.map(_._3).fold(Nil)(_ ++: _))
     
           // Replaces all `MetastoreRelation`s with corresponding 
`ParquetRelation2`s, and fixes
           // attribute IDs referenced in other nodes.
           plan.transformUp {
    -        case r: MetastoreRelation if relationMap.contains(r -> r.output) =>
    -          val parquetRelation = relationMap(r -> r.output)
    +        case r: MetastoreRelation if relationMap.contains(r) =>
    +          val parquetRelation = relationMap(r)
               val alias = r.alias.getOrElse(r.tableName)
               Subquery(alias, parquetRelation)
     
             case InsertIntoTable(r: MetastoreRelation, partition, child, 
overwrite)
    -          if relationMap.contains(r -> r.output) =>
    -          val parquetRelation = relationMap(r -> r.output)
    +          if relationMap.contains(r) =>
    +          val parquetRelation = relationMap(r)
               InsertIntoTable(parquetRelation, partition, child, overwrite)
     
             case InsertIntoHiveTable(r: MetastoreRelation, partition, child, 
overwrite)
    -          if relationMap.contains(r -> r.output) =>
    -          val parquetRelation = relationMap(r -> r.output)
    +          if relationMap.contains(r) =>
    +          val parquetRelation = relationMap(r)
    --- End diff --
    
    All changes above this line are about reverting workaround introduced in 
#5183


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