attilapiros commented on a change in pull request #24241:
[SPARK-27323][CORE][SQL][STREAMING] Use Single-Abstract-Method support in Scala
2.12 to simplify code
URL: https://github.com/apache/spark/pull/24241#discussion_r271013238
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceStrategy.scala
##########
@@ -222,23 +221,20 @@ class FindDataSourceTable(sparkSession: SparkSession)
extends Rule[LogicalPlan]
private def readDataSourceTable(table: CatalogTable): LogicalPlan = {
val qualifiedTableName = QualifiedTableName(table.database,
table.identifier.table)
val catalog = sparkSession.sessionState.catalog
- catalog.getCachedPlan(qualifiedTableName, new Callable[LogicalPlan]() {
- override def call(): LogicalPlan = {
- val pathOption = table.storage.locationUri.map("path" ->
CatalogUtils.URIToString(_))
- 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 = table.storage.properties ++ pathOption,
- catalogTable = Some(table))
-
- LogicalRelation(dataSource.resolveRelation(checkFilesExist = false),
table)
- }
+ catalog.getCachedPlan(qualifiedTableName, () => {
+ val pathOption = table.storage.locationUri.map("path" ->
CatalogUtils.URIToString(_))
+ val dataSource =
+ DataSource(
+ sparkSession,
+ // In older version(prior to 2.1) of Spark, the table schema can be
empty and should be
Review comment:
No comment is missing but should we still support this?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]