johanl-db commented on code in PR #40885:
URL: https://github.com/apache/spark/pull/40885#discussion_r1173803115


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/FileFormat.scala:
##########
@@ -203,6 +203,21 @@ trait FileFormat {
    * method. Technically, a file format could choose suppress them, but that 
is not recommended.
    */
   def metadataSchemaFields: Seq[StructField] = FileFormat.BASE_METADATA_FIELDS
+
+  /**
+   * The extractors to use when deriving file-constant metadata columns for 
this file format.
+   *
+   * A scanner must derive each file-constant metadata field's value from each 
[[PartitionedFile]]
+   * it processes. By default, the value is obtained by a direct lookup of the 
column's name on
+   * [[PartitionedFile.otherConstantMetadataColumnValues]] (see
+   * [[FileFormat.getFileConstantMetadataColumnValue]]). However, 
implementations can override this
+   * method in order to provide more sophisticated lazy extractors (e.g. in 
case the column value is
+   * complicated or expensive to compute).

Review Comment:
   The way I read it is that using `otherConstantMetadataColumnValues` is the 
default and an extractor should only be used for more advanced use cases. I 
think we rather want to encourage using extractors whenever possible and only 
fallback to manually providing the values when necessary.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to