johanl-db commented on code in PR #40545:
URL: https://github.com/apache/spark/pull/40545#discussion_r1154397094
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/FileSourceStrategy.scala:
##########
@@ -220,9 +220,20 @@ object FileSourceStrategy extends Strategy with
PredicateHelper with Logging {
attributeReference match {
case attr @ FileSourceMetadataAttribute(
Review Comment:
We only cleanup the individual metadata fields but the _metadata attribute
itself does have the right information to match on
`FileSourceMetadataAttribute` :
```
def createFileMetadataCol(fileFormat: FileFormat): AttributeReference = {
// Strip out the fields' metadata to avoid exposing it to the user.
[[FileSourceStrategy]]
// avoids confusion by mapping back to [[metadataSchemaFields]].
val fields = metadataSchemaFields(fileFormat)
.map(FileSourceMetadataAttribute.cleanupFileSourceMetadataInformation)
FileSourceMetadataAttribute(FileFormat.METADATA_NAME, StructType(fields))
}
```
The following is true:
```
val metadata_attr = createFileMetadataCol(fileFormat: FileFormat)
metadata_attr.metadata.getBoolean(METADATA_COL_ATTR_KEY) == true
metadata_attr.metadata.getBoolean(FILE_SOURCE_METADATA_COL_ATTR_KEY) == true
metadata_attr.dataType.forall(_.metadata == Metadata.empty)
--
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]