ashutosh-bapat 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_r274511466
########## 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: Add a testcase where we convert an already bootstrapped table before first incremental after bootstrap. Also, test replication after ALTER TABLE statements have failed i.e. take dump after ALTER TABLE failure and load it to the target. Verify that nothing has changed on the target. ---------------------------------------------------------------- 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