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

    https://github.com/apache/spark/pull/11646#discussion_r55795906
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/sources/interfaces.scala ---
    @@ -454,19 +454,51 @@ trait FileFormat {
           requiredColumns: Array[String],
           filters: Array[Filter],
           bucketSet: Option[BitSet],
    -      inputFiles: Array[FileStatus],
    +      inputFiles: Seq[FileStatus],
           broadcastedConf: Broadcast[SerializableConfiguration],
           options: Map[String, String]): RDD[InternalRow]
    +
    +  /**
    +   * Returns a function that can be used to read a single file in as an 
Iterator of InternalRow.
    +   *
    +   * @param partitionSchema The schema of the partition column row that 
will be present in each
    +   *                        PartitionedFile.  These columns should be 
prepended to the rows that
    +   *                        are produced by the iterator.
    +   * @param dataSchema The schema of the data that should be output for 
each row.  This may be a
    +   *                   subset of the columns that are present in the file 
if  column pruning has
    +   *                   occurred.
    +   * @param filters A set of filters than can optionally be used to reduce 
the number of rows output
    +   * @param options A set of string -> string configuration options.
    +   * @return
    +   */
    +  def buildReader(
    +      sqlContext: SQLContext,
    +      partitionSchema: StructType,
    +      dataSchema: StructType,
    +      filters: Seq[Filter],
    +      options: Map[String, String]): PartitionedFile => 
Iterator[InternalRow] = {
    +    // TODO: Remove this default implementation when the other formats 
have been ported
    +    // Until then we guard in [[FileSourceStrategy]] to only call this 
method on supported formats.
    +    throw new UnsupportedOperationException(s"buildReader is not supported 
for $this")
    +  }
     }
     
     /**
    + * A collection of data files from a partitioned relation, along with the 
partition values in the
    + * form of an [[InternalRow]].
    + */
    +case class Partition(values: InternalRow, files: Seq[FileStatus])
    +
    +/**
      * An interface for objects capable of enumerating the files that comprise 
a relation as well
      * as the partitioning characteristics of those files.
      */
     trait FileCatalog {
       def paths: Seq[Path]
     
    -  def partitionSpec(schema: Option[StructType]): PartitionSpec
    +  def partitionSpec(): PartitionSpec
    +
    +  def listFiles(filters: Seq[Expression]): Seq[Partition]
    --- End diff --
    
    The name looks confusing, it's called `listFiles` but return a 
`Seq[Partition]`. Maybe we should call it `listPartitions`?


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