This is an automated email from the ASF dual-hosted git repository. mahesh pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/hive.git
The following commit(s) were added to refs/heads/master by this push: new db97be2 HIVE-22890 : Repl load fails if table name contains _function. (Aasha Medhi, reviewed by Mahesh Kumar Behera) db97be2 is described below commit db97be2b7c029516e1e42cadf682f97a797dd5ad Author: Aasha Medhi <aasha.medhi2...@gmail.com> AuthorDate: Mon Feb 17 10:21:09 2020 +0530 HIVE-22890 : Repl load fails if table name contains _function. (Aasha Medhi, reviewed by Mahesh Kumar Behera) Signed-off-by: Mahesh Kumar Behera <mah...@apache.org> --- .../TestReplicationScenariosExternalTables.java | 46 ++++++++++++++++++++++ .../events/filesystem/DatabaseEventsIterator.java | 2 +- 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosExternalTables.java b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosExternalTables.java index 1815824..7a90dcc 100644 --- a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosExternalTables.java +++ b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosExternalTables.java @@ -855,6 +855,52 @@ public class TestReplicationScenariosExternalTables extends BaseReplicationAcros .verifyReplTargetProperty(replicatedDbName); } + @Test + public void replicationWithTableNameContainsKeywords() throws Throwable { + List<String> loadWithClause = externalTableBasePathWithClause(); + + WarehouseInstance.Tuple tuple = primary + .run("use " + primaryDbName) + .run("create external table t1_functions (id int)") + .run("insert into table t1_functions values (1)") + .run("insert into table t1_functions values (2)") + .run("create external table t2_constraints (place string) partitioned by (country string)") + .run("insert into table t2_constraints partition(country='india') values ('bangalore')") + .run("insert into table t2_constraints partition(country='us') values ('austin')") + .run("insert into table t2_constraints partition(country='france') values ('paris')") + .dump(primaryDbName, null); + + replica.load(replicatedDbName, tuple.dumpLocation, loadWithClause) + .run("repl status " + replicatedDbName) + .verifyResult(tuple.lastReplicationId) + .run("use " + replicatedDbName) + .run("show tables like 't1_functions'") + .verifyResults(new String[] {"t1_functions"}) + .run("show tables like 't2_constraints'") + .verifyResults(new String[] {"t2_constraints"}) + .run("select id from t1_functions") + .verifyResults(new String[] {"1", "2"}) + .verifyReplTargetProperty(replicatedDbName); + + tuple = primary.run("use " + primaryDbName) + .run("create external table t3_bootstrap (id int)") + .run("insert into table t3_bootstrap values (10)") + .run("insert into table t3_bootstrap values (20)") + .run("create table t4_tables (id int)") + .run("insert into table t4_tables values (10)") + .run("insert into table t4_tables values (20)") + .dump(primaryDbName, tuple.lastReplicationId); + + replica.load(replicatedDbName, tuple.dumpLocation, loadWithClause) + .run("use " + replicatedDbName) + .run("show tables like 't3_bootstrap'") + .verifyResults(new String[] {"t3_bootstrap"}) + .run("show tables like 't4_tables'") + .verifyResults(new String[] {"t4_tables"}) + .verifyReplTargetProperty(replicatedDbName); + } + + private List<String> externalTableBasePathWithClause() throws IOException, SemanticException { return ReplicationTestUtils.externalTableBasePathWithClause(REPLICA_EXTERNAL_BASE, replica); } diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/repl/bootstrap/events/filesystem/DatabaseEventsIterator.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/repl/bootstrap/events/filesystem/DatabaseEventsIterator.java index 4c84797..72baee6 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/exec/repl/bootstrap/events/filesystem/DatabaseEventsIterator.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/repl/bootstrap/events/filesystem/DatabaseEventsIterator.java @@ -170,7 +170,7 @@ class DatabaseEventsIterator implements Iterator<BootstrapEvent> { } String currentPath = next.toString(); - if (currentPath.contains(FUNCTIONS_ROOT_DIR_NAME)) { + if (currentPath.contains(Path.SEPARATOR + FUNCTIONS_ROOT_DIR_NAME + Path.SEPARATOR)) { LOG.debug("functions directory: {}", next.toString()); return postProcessing(new FSFunctionEvent(next)); }