@@ -41,26 +41,6 @@ trait PartitionManagementSuite extends DDLCommandTestUtils {
4141 }
4242 }
4343
44- test(" create partition with location" ) {
45- withNamespaceAndTable(" ns" , " tbl" ) { t =>
46- sql(s " CREATE TABLE $t (id string, year string, month string) PARTITIONED BY (year, month) " )
47- val loc = " file:///tmp/kyuubi/hive_catalog_part_loc"
48- sql(s " ALTER TABLE $t ADD PARTITION (year='2023', month='01') LOCATION ' $loc' " )
49- checkAnswer(
50- sql(s " SHOW PARTITIONS $t" ),
51- Row (" year=2023/month=01" ) :: Nil )
52- val catalog = spark.sessionState.catalogManager
53- .catalog(catalogName).asInstanceOf [TableCatalog ]
54- val partManagement = catalog.loadTable(Identifier .of(Array (" ns" ), " tbl" ))
55- .asInstanceOf [SupportsPartitionManagement ]
56- val partIdent = InternalRow .fromSeq(
57- Seq (UTF8String .fromString(" 2023" ), UTF8String .fromString(" 01" )))
58- val metadata = partManagement.loadPartitionMetadata(partIdent)
59- assert(metadata.containsKey(" location" ))
60- assert(metadata.get(" location" ).contains(" hive_catalog_part_loc" ))
61- }
62- }
63-
6444 test(" drop partition" ) {
6545 withNamespaceAndTable(" ns" , " tbl" ) { t =>
6646 sql(s " CREATE TABLE $t (id string, year string, month string) PARTITIONED BY (year, month) " )
@@ -111,6 +91,26 @@ trait PartitionManagementSuite extends DDLCommandTestUtils {
11191class PartitionManagementV2Suite extends PartitionManagementSuite {
11292 override protected def catalogVersion : String = " Hive V2"
11393 override protected def commandVersion : String = V2_COMMAND_VERSION
94+
95+ test(" create partition with location" ) {
96+ withNamespaceAndTable(" ns" , " tbl" ) { t =>
97+ sql(s " CREATE TABLE $t (id string, year string, month string) PARTITIONED BY (year, month) " )
98+ val loc = " file:///tmp/kyuubi/hive_catalog_part_loc"
99+ sql(s " ALTER TABLE $t ADD PARTITION (year='2023', month='01') LOCATION ' $loc' " )
100+ checkAnswer(
101+ sql(s " SHOW PARTITIONS $t" ),
102+ Row (" year=2023/month=01" ) :: Nil )
103+ val catalog = spark.sessionState.catalogManager
104+ .catalog(catalogName).asInstanceOf [TableCatalog ]
105+ val partManagement = catalog.loadTable(Identifier .of(Array (" ns" ), " tbl" ))
106+ .asInstanceOf [SupportsPartitionManagement ]
107+ val partIdent = InternalRow .fromSeq(
108+ Seq (UTF8String .fromString(" 2023" ), UTF8String .fromString(" 01" )))
109+ val metadata = partManagement.loadPartitionMetadata(partIdent)
110+ assert(metadata.containsKey(" location" ))
111+ assert(metadata.get(" location" ).contains(" hive_catalog_part_loc" ))
112+ }
113+ }
114114}
115115
116116class PartitionManagementV1Suite extends PartitionManagementSuite {
0 commit comments