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

    https://github.com/apache/spark/pull/12866#discussion_r62071190
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/fileSourceInterfaces.scala
 ---
    @@ -223,6 +224,45 @@ trait FileFormat {
         // Until then we guard in [[FileSourceStrategy]] to only call this 
method on supported formats.
         throw new UnsupportedOperationException(s"buildReader is not supported 
for $this")
       }
    +
    +  /**
    +   * Exactly the same as [[buildReader]] except that the reader function 
returned by this method
    +   * appends partition values to [[InternalRow]]s produced by the reader 
function [[buildReader]]
    +   * returns.
    +   */
    +  private[sql] def buildReaderWithPartitionValues(
    +      sparkSession: SparkSession,
    +      dataSchema: StructType,
    +      partitionSchema: StructType,
    +      requiredSchema: StructType,
    +      filters: Seq[Filter],
    +      options: Map[String, String],
    +      hadoopConf: Configuration): PartitionedFile => Iterator[InternalRow] 
= {
    +    val dataReader = buildReader(
    +      sparkSession, dataSchema, partitionSchema, requiredSchema, filters, 
options, hadoopConf)
    +
    +    new (PartitionedFile => Iterator[InternalRow]) with Serializable {
    --- End diff --
    
    That's a reasonable use case. But we can also use an anonymous `Function1` 
class there.


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