cloud-fan commented on code in PR #39870:
URL: https://github.com/apache/spark/pull/39870#discussion_r1098633160


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/StreamingRelation.scala:
##########
@@ -59,26 +60,34 @@ case class StreamingRelation(dataSource: DataSource, 
sourceName: String, output:
   override def newInstance(): LogicalPlan = this.copy(output = 
output.map(_.newInstance()))
 
   override lazy val metadataOutput: Seq[AttributeReference] = {
-    dataSource.providingClass match {
-      // If the dataSource provided class is a same or subclass of FileFormat 
class
-      case f if classOf[FileFormat].isAssignableFrom(f) =>
-        val resolve = conf.resolver
-        val outputNames = outputSet.map(_.name)
-        def isOutputColumn(col: AttributeReference): Boolean = {
-          outputNames.exists(name => resolve(col.name, name))
-        }
-        // filter out the metadata struct column if it has the name 
conflicting with output columns.
-        // if the file has a column "_metadata",
-        // then the data column should be returned not the metadata struct 
column
-        Seq(FileFormat.createFileMetadataCol(
-          
dataSource.providingInstance().asInstanceOf[FileFormat])).filterNot(isOutputColumn)
-      case _ => Nil
+    val metadataColFromOutput = output.filter(_.isMetadataCol)

Review Comment:
   ditto, and add comments as well



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