sankarh commented on a change in pull request #591: HIVE-21500: Disable conversion of managed table to external and vice versa at source. URL: https://github.com/apache/hive/pull/591#discussion_r274568682
########## File path: itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationWithTableMigration.java ########## @@ -427,4 +427,32 @@ public void testIncrementalLoadMigrationToAcidWithMoveOptimization() throws Thro replica.load(replicatedDbName, tuple.dumpLocation, withConfigs); verifyLoadExecution(replicatedDbName, tuple.lastReplicationId); } + + @Test + public void dynamicallyConvertManagedToExternalTable() throws Throwable { + // With Strict managed disabled but Db enabled for replication, it is not possible to convert + // external table to managed table. + primary.run("use " + primaryDbName) + .run("create table t1 (id int) clustered by(id) into 3 buckets stored as orc ") + .run("insert into t1 values(1)") + .run("create table t2 partitioned by (country string) ROW FORMAT SERDE " + + "'org.apache.hadoop.hive.serde2.avro.AvroSerDe' stored as avro " + + "tblproperties ('avro.schema.url'='" + avroSchemaFile.toUri().toString() + "')") + .run("insert into t2 partition (country='india') values ('another', 13)") + .runFailure("alter table t1 set tblproperties('EXTERNAL'='true')") + .runFailure("alter table t2 set tblproperties('EXTERNAL'='true')"); + } + + @Test + public void dynamicallyConvertExternalToManagedTable() throws Throwable { + // With Strict managed disabled but Db enabled for replication, it is not possible to convert + // external table to managed table. + primary.run("use " + primaryDbName) + .run("create external table t1 (id int) stored as orc") + .run("insert into table t1 values (1)") + .run("create external table t2 (place string) partitioned by (country string)") + .run("insert into table t2 partition(country='india') values ('bangalore')") + .runFailure("alter table t1 set tblproperties('EXTERNAL'='false')") + .runFailure("alter table t2 set tblproperties('EXTERNAL'='false')"); + } Review comment: No difference if we convert before or after bootstrap as we disable it if Db is enabled for replication. Also, alter failure case is not newly introduced flow just added one more check. It must be tested by some other tests. If at all we need to test it, then it should be a wider activity as we don't test for any failure cases. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For additional commands, e-mail: gitbox-h...@hive.apache.org