szehon-ho commented on code in PR #57644:
URL: https://github.com/apache/spark/pull/57644#discussion_r3798212958


##########
sql/pipelines/src/main/scala/org/apache/spark/sql/pipelines/graph/DatasetManager.scala:
##########
@@ -317,9 +318,23 @@ object DatasetManager extends Logging {
     val (catalog, identifier) =
       PipelinesCatalogUtils.resolveTableCatalog(context.spark, 
table.identifier)
 
-    val outputSchema = table.specifiedSchema.getOrElse(
-      inferredSchemas(table.identifier).asNullable
-    )
+    val outputSchema = table.specifiedSchema match {

Review Comment:
   `VirtualTableInput.load` returns the declared schema as-is and never 
consults the materialized table:
   
   ```scala
   val deducedSchema = specifiedSchema match {
     // If the user specified a schema, use it directly.
     case Some(ss) => ss
   ```
   
   So once `outputSchema` differs from `ss`, a same-graph downstream dataset is 
planned against the declared columns but reads the real table at execution 
(`reanalyzeFlow` leaves the upstream table out of the subgraph, so it resolves 
as an external catalog read).
   
   See the first point in my review comment for the step-by-step and the fix 
I'd suggest.
   



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