@@ -24,17 +24,17 @@ import scala.collection.mutable
2424import org .apache .spark .sql .{AnalysisException , SaveMode }
2525import org .apache .spark .sql .catalog .v2 .{CatalogPlugin , Identifier , LookupCatalog , TableCatalog }
2626import org .apache .spark .sql .catalog .v2 .expressions .Transform
27- import org .apache .spark .sql .catalyst .TableIdentifier
27+ import org .apache .spark .sql .catalyst .{ AliasIdentifier , TableIdentifier }
2828import org .apache .spark .sql .catalyst .analysis .{CastSupport , UnresolvedAttribute }
29- import org .apache .spark .sql .catalyst .catalog .{ BucketSpec , CatalogTable , CatalogTableType , CatalogUtils , UnresolvedCatalogRelation }
30- import org .apache .spark .sql .catalyst .plans .logical .{ CreateTableAsSelect , CreateV2Table , DropTable , LogicalPlan , ReplaceTable , ReplaceTableAsSelect }
31- import org .apache .spark .sql .catalyst .plans .logical .sql .{ AlterTableAddColumnsStatement , AlterTableSetLocationStatement , AlterTableSetPropertiesStatement , AlterTableUnsetPropertiesStatement , AlterViewSetPropertiesStatement , AlterViewUnsetPropertiesStatement , CreateTableAsSelectStatement , CreateTableStatement , DescribeColumnStatement , DescribeTableStatement , DropTableStatement , DropViewStatement , QualifiedColType , ReplaceTableAsSelectStatement , ReplaceTableStatement }
29+ import org .apache .spark .sql .catalyst .catalog ._
30+ import org .apache .spark .sql .catalyst .plans .logical ._
31+ import org .apache .spark .sql .catalyst .plans .logical .sql ._
3232import org .apache .spark .sql .catalyst .rules .Rule
33- import org .apache .spark .sql .execution .command .{ AlterTableAddColumnsCommand , AlterTableSetLocationCommand , AlterTableSetPropertiesCommand , AlterTableUnsetPropertiesCommand , DescribeColumnCommand , DescribeTableCommand , DropTableCommand }
33+ import org .apache .spark .sql .execution .command ._
3434import org .apache .spark .sql .execution .datasources .v2 .{CatalogTableAsV2 , DataSourceV2Relation }
3535import org .apache .spark .sql .internal .SQLConf
3636import org .apache .spark .sql .sources .v2 .TableProvider
37- import org .apache .spark .sql .types .{ HIVE_TYPE_STRING , HiveStringType , MetadataBuilder , StructField , StructType }
37+ import org .apache .spark .sql .types ._
3838import org .apache .spark .sql .util .SchemaUtils
3939
4040case class DataSourceResolution (
@@ -173,8 +173,10 @@ case class DataSourceResolution(
173173 // only top-level adds are supported using AlterTableAddColumnsCommand
174174 AlterTableAddColumnsCommand (table, newColumns.map(convertToStructField))
175175
176- case DataSourceV2Relation (CatalogTableAsV2 (catalogTable), _, _) =>
177- UnresolvedCatalogRelation (catalogTable)
176+ case DataSourceV2Relation (CatalogTableAsV2 (ct), _, _) =>
177+ SubqueryAlias (
178+ AliasIdentifier (ct.identifier.table, ct.identifier.database),
179+ UnresolvedCatalogRelation (ct))
178180
179181 }
180182
0 commit comments