Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18671#discussion_r128005142
  
    --- Diff: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveExternalCatalog.scala ---
    @@ -1088,9 +1088,19 @@ private[spark] class HiveExternalCatalog(conf: 
SparkConf, hadoopConf: Configurat
           table: String,
           partialSpec: Option[TablePartitionSpec] = None): 
Seq[CatalogTablePartition] = withClient {
         val partColNameMap = buildLowerCasePartColNameMap(getTable(db, table))
    -    client.getPartitions(db, table, 
partialSpec.map(lowerCasePartitionSpec)).map { part =>
    +    val res = client.getPartitions(db, table, 
partialSpec.map(lowerCasePartitionSpec)).map { part =>
           part.copy(spec = restorePartitionSpec(part.spec, partColNameMap))
         }
    +
    +    partialSpec match {
    +      // This might be a bug of Hive: When the partition value inside the 
partial partition spec
    +      // contains dot, and we ask Hive to list partitions w.r.t. the 
partial partition spec, Hive
    +      // treats dot as matching any single character and may return more 
partitions than we
    +      // expected. Here we do an extra filter to drop unexpected 
partitions.
    +      case Some(spec) if spec.exists(_._2.contains(".")) =>
    --- End diff --
    
    I tried other special chars but seems dot is the only one having the 
problem.
    
    And seems Hive does want to do exact matching: 
https://github.com/apache/hive/blob/release-1.2.1/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java#L1529-L1535


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