@@ -78,6 +78,14 @@ class PlanResolutionSuite extends AnalysisTest {
7878 V1Table (t)
7979 }
8080
81+ private val view : V1Table = {
82+ val t = mock(classOf [CatalogTable ])
83+ when(t.schema).thenReturn(new StructType ().add(" i" , " int" ).add(" s" , " string" ))
84+ when(t.tableType).thenReturn(CatalogTableType .VIEW )
85+ when(t.provider).thenReturn(Some (v1Format))
86+ V1Table (t)
87+ }
88+
8189 private val testCat : TableCatalog = {
8290 val newCatalog = mock(classOf [TableCatalog ])
8391 when(newCatalog.loadTable(any())).thenAnswer((invocation : InvocationOnMock ) => {
@@ -101,6 +109,7 @@ class PlanResolutionSuite extends AnalysisTest {
101109 case " v2Table" => table
102110 case " v2Table1" => table
103111 case " v2TableWithAcceptAnySchemaCapability" => tableWithAcceptAnySchemaCapability
112+ case " view" => view
104113 case name => throw new NoSuchTableException (name)
105114 }
106115 })
@@ -677,6 +686,8 @@ class PlanResolutionSuite extends AnalysisTest {
677686 val viewIdent1 = TableIdentifier (" view" , Option (" db" ))
678687 val viewName2 = " view"
679688 val viewIdent2 = TableIdentifier (" view" , Option (" default" ))
689+ val tempViewName = " v"
690+ val tempViewIdent = TableIdentifier (" v" )
680691
681692 parseResolveCompare(s " DROP VIEW $viewName1" ,
682693 DropTableCommand (viewIdent1, ifExists = false , isView = true , purge = false ))
@@ -686,6 +697,10 @@ class PlanResolutionSuite extends AnalysisTest {
686697 DropTableCommand (viewIdent2, ifExists = false , isView = true , purge = false ))
687698 parseResolveCompare(s " DROP VIEW IF EXISTS $viewName2" ,
688699 DropTableCommand (viewIdent2, ifExists = true , isView = true , purge = false ))
700+ parseResolveCompare(s " DROP VIEW $tempViewName" ,
701+ DropTableCommand (tempViewIdent, ifExists = false , isView = true , purge = false ))
702+ parseResolveCompare(s " DROP VIEW IF EXISTS $tempViewName" ,
703+ DropTableCommand (tempViewIdent, ifExists = true , isView = true , purge = false ))
689704 }
690705
691706 test(" drop view in v2 catalog" ) {
0 commit comments