Commit 814f066d by Shwetha GS

ATLAS-929 Add test for trait preservation on column rename for non-default…

ATLAS-929 Add test for trait preservation on column rename for non-default database (svimal2106 via shwethags)
parent 1c3b2bef
...@@ -333,9 +333,12 @@ public class HiveHook extends AtlasHook implements ExecuteWithHookContext { ...@@ -333,9 +333,12 @@ public class HiveHook extends AtlasHook implements ExecuteWithHookContext {
private void renameColumn(HiveMetaStoreBridge dgiBridge, HiveEventContext event) throws Exception{ private void renameColumn(HiveMetaStoreBridge dgiBridge, HiveEventContext event) throws Exception{
assert event.getInputs() != null && event.getInputs().size() == 1; assert event.getInputs() != null && event.getInputs().size() == 1;
assert event.getOutputs() != null && event.getOutputs().size() > 0; assert event.getOutputs() != null && event.getOutputs().size() > 0;
Table oldTable = event.getInputs().iterator().next().getTable(); Table oldTable = event.getInputs().iterator().next().getTable();
List<FieldSchema> oldColList = oldTable.getAllCols(); List<FieldSchema> oldColList = oldTable.getAllCols();
List<FieldSchema> newColList = dgiBridge.hiveClient.getTable(event.getOutputs().iterator().next().getTable().getTableName()).getAllCols(); Table outputTbl = event.getOutputs().iterator().next().getTable();
outputTbl = dgiBridge.hiveClient.getTable(outputTbl.getDbName(), outputTbl.getTableName());
List<FieldSchema> newColList = outputTbl.getAllCols();
assert oldColList.size() == newColList.size(); assert oldColList.size() == newColList.size();
Pair<String, String> changedColNamePair = findChangedColNames(oldColList, newColList); Pair<String, String> changedColNamePair = findChangedColNames(oldColList, newColList);
......
...@@ -1023,13 +1023,16 @@ public class HiveHookIT { ...@@ -1023,13 +1023,16 @@ public class HiveHookIT {
@Test @Test
public void testTraitsPreservedOnColumnRename() throws Exception { public void testTraitsPreservedOnColumnRename() throws Exception {
String tableName = createTable(); String dbName = createDatabase();
String tbqn = HiveMetaStoreBridge.getTableQualifiedName(CLUSTER_NAME, DEFAULT_DB, tableName); String tableName = tableName();
String createQuery = String.format("create table %s.%s (id int, name string)", dbName, tableName);
runCommand(createQuery);
String tbqn = HiveMetaStoreBridge.getTableQualifiedName(CLUSTER_NAME, dbName, tableName);
String guid = assertColumnIsRegistered(HiveMetaStoreBridge.getColumnQualifiedName(tbqn, "id")); String guid = assertColumnIsRegistered(HiveMetaStoreBridge.getColumnQualifiedName(tbqn, "id"));
String trait = createTrait(guid); String trait = createTrait(guid);
String oldColName = "id"; String oldColName = "id";
String newColName = "id_new"; String newColName = "id_new";
String query = String.format("alter table %s change %s %s string", tableName, oldColName, newColName); String query = String.format("alter table %s.%s change %s %s string", dbName, tableName, oldColName, newColName);
runCommand(query); runCommand(query);
String guid2 = assertColumnIsRegistered(HiveMetaStoreBridge.getColumnQualifiedName(tbqn, "id_new")); String guid2 = assertColumnIsRegistered(HiveMetaStoreBridge.getColumnQualifiedName(tbqn, "id_new"));
......
...@@ -38,6 +38,7 @@ ATLAS-409 Atlas will not import avro tables with schema read from a file (dosset ...@@ -38,6 +38,7 @@ ATLAS-409 Atlas will not import avro tables with schema read from a file (dosset
ATLAS-379 Create sqoop and falcon metadata addons (venkatnrangan,bvellanki,sowmyaramesh via shwethags) ATLAS-379 Create sqoop and falcon metadata addons (venkatnrangan,bvellanki,sowmyaramesh via shwethags)
ALL CHANGES: ALL CHANGES:
ATLAS-929 Add test for trait preservation on column rename for non-default database (svimal2106 via shwethags)
ATLAS-922 remove test atlas-application.properties embedded in atlas-typesystem.jar (madhan.neethiraj via yhemanth) ATLAS-922 remove test atlas-application.properties embedded in atlas-typesystem.jar (madhan.neethiraj via yhemanth)
ATLAS-725 UI : Filter out or highlight deleted entities in search result outputs(dsl, text) , schema view, and lineage graph (kevalbhatt18 via sumasai) ATLAS-725 UI : Filter out or highlight deleted entities in search result outputs(dsl, text) , schema view, and lineage graph (kevalbhatt18 via sumasai)
ATLAS-897 Atlas UI: Feature to associate multiple assets with a term. (kevalbhatt18 via sumasai) ATLAS-897 Atlas UI: Feature to associate multiple assets with a term. (kevalbhatt18 via sumasai)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment