gengliangwang commented on code in PR #50538: URL: https://github.com/apache/spark/pull/50538#discussion_r2034452867
########## 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 + + val cachedPlan = catalog.getCachedTable(qualifiedTableName) Review Comment: I think we can make the code change cleaner by pattern matching the result at the end of original code -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org