szehon-ho commented on code in PR #50538:
URL: https://github.com/apache/spark/pull/50538#discussion_r2034698278
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceStrategy.scala:
##########
@@ -256,20 +257,41 @@ class FindDataSourceTable(sparkSession: SparkSession)
extends Rule[LogicalPlan]
QualifiedTableName(table.identifier.catalog.get, table.database,
table.identifier.table)
val catalog = sparkSession.sessionState.catalog
val dsOptions = DataSourceUtils.generateDatasourceOptions(extraOptions,
table)
- catalog.getCachedPlan(qualifiedTableName, () => {
- val dataSource =
- DataSource(
- sparkSession,
- // In older version(prior to 2.1) of Spark, the table schema can be
empty and should be
- // inferred at runtime. We should still support it.
- userSpecifiedSchema = if (table.schema.isEmpty) None else
Some(table.schema),
- partitionColumns = table.partitionColumnNames,
- bucketSpec = table.bucketSpec,
- className = table.provider.get,
- options = dsOptions,
- catalogTable = Some(table))
+ // If the plan is cached, additionally check if options have changed.
+ var updatedOptions: Boolean = false
Review Comment:
NIt: updatedOptions can be val and assigned where its used:
val updatedOptions = cachedPlan match ...
But I think if we refactor based on Gengliang's idea, it may be a moot point
:)
--
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]