cloud-fan commented on a change in pull request #35459:
URL: https://github.com/apache/spark/pull/35459#discussion_r803292430



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/namedExpressions.scala
##########
@@ -451,3 +451,21 @@ object MetadataAttribute {
     } else None
   }
 }
+
+/**
+ * The internal representation of the FileSourceMetadataAttribute,
+ * it sets `__metadata_col` to `true` in AttributeReference metadata with the 
attr name `_metadata`
+ * - unapply() will check if an attribute reference is the file source 
metadata attribute reference
+ */
+object FileSourceMetadataAttribute {
+
+  val ATTRIBUTE_NAME = "_metadata"
+
+  def unapply(attr: AttributeReference): Option[AttributeReference] = {
+    if (attr.metadata.contains(METADATA_COL_ATTR_KEY)

Review comment:
       nit:
   ```
   attr match {
     case MetadataAttribute(a) if a.name.equalsIgnoreCase(ATTRIBUTE_NAME) => 
Some(attr)
     case _ => None
   }
   ```




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