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

    https://github.com/apache/spark/pull/8840#discussion_r44612323
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/PartitioningUtils.scala
 ---
    @@ -124,34 +132,40 @@ private[sql] object PartitioningUtils {
        *       Literal.create("hello", StringType),
        *       Literal.create(3.14, FloatType)))
        * }}}
    +   * and the base path:
    +   * {{{
    +   *   /path/to/partition
    +   * }}}
        */
       private[sql] def parsePartition(
           path: Path,
           defaultPartitionName: String,
    -      typeInference: Boolean): Option[PartitionValues] = {
    +      typeInference: Boolean): (Option[PartitionValues], Option[Path]) = {
         val columns = ArrayBuffer.empty[(String, Literal)]
         // Old Hadoop versions don't have `Path.isRoot`
         var finished = path.getParent == null
         var chopped = path
    +    var basePath = path
     
         while (!finished) {
           // Sometimes (e.g., when speculative task is enabled), temporary 
directories may be left
           // uncleaned.  Here we simply ignore them.
           if (chopped.getName.toLowerCase == "_temporary") {
    -        return None
    +        return (None, None)
           }
     
           val maybeColumn = parsePartitionColumn(chopped.getName, 
defaultPartitionName, typeInference)
           maybeColumn.foreach(columns += _)
    +      basePath = chopped
           chopped = chopped.getParent
    -      finished = maybeColumn.isEmpty || chopped.getParent == null
    +      finished = (maybeColumn.isEmpty && !columns.isEmpty) || 
chopped.getParent == null
    --- End diff --
    
    oh i see. It is for something like `table/a=1/_temporary/something`, right?


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