Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
daf812aa
Commit
daf812aa
authored
9 years ago
by
Suma Shivaprasad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-594 alter table rename doesnt work across databases ( sumasai via shwethags)
parent
f7146ede
master
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
7 deletions
+12
-7
HiveHook.java
...ge/src/main/java/org/apache/atlas/hive/hook/HiveHook.java
+4
-4
HiveHookIT.java
.../src/test/java/org/apache/atlas/hive/hook/HiveHookIT.java
+7
-3
release-log.txt
release-log.txt
+1
-0
No files found.
addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/HiveHook.java
View file @
daf812aa
...
@@ -406,10 +406,9 @@ public class HiveHook extends AtlasHook implements ExecuteWithHookContext {
...
@@ -406,10 +406,9 @@ public class HiveHook extends AtlasHook implements ExecuteWithHookContext {
for
(
WriteEntity
writeEntity
:
event
.
getOutputs
())
{
for
(
WriteEntity
writeEntity
:
event
.
getOutputs
())
{
if
(
writeEntity
.
getType
()
==
Entity
.
Type
.
TABLE
)
{
if
(
writeEntity
.
getType
()
==
Entity
.
Type
.
TABLE
)
{
Table
newTable
=
writeEntity
.
getTable
();
Table
newTable
=
writeEntity
.
getTable
();
if
(
newTable
.
getDbName
().
equals
(
oldTable
.
getDbName
())
&&
!
newTable
.
getTableName
()
//Hive sends with both old and new table names in the outputs which is weird. So skipping that with the below check
.
equals
(
oldTable
.
getTableName
()))
{
if
(!
newTable
.
getDbName
().
equals
(
oldTable
.
getDbName
())
||
!
newTable
.
getTableName
().
equals
(
oldTable
.
getTableName
()))
{
//Create/update old table entity - create new entity with oldQFNme and tableName
//Create/update old table entity - create new entity and replace id
Referenceable
tableEntity
=
createOrUpdateEntities
(
dgiBridge
,
event
.
getUser
(),
writeEntity
);
Referenceable
tableEntity
=
createOrUpdateEntities
(
dgiBridge
,
event
.
getUser
(),
writeEntity
);
String
oldQualifiedName
=
dgiBridge
.
getTableQualifiedName
(
dgiBridge
.
getClusterName
(),
String
oldQualifiedName
=
dgiBridge
.
getTableQualifiedName
(
dgiBridge
.
getClusterName
(),
oldTable
.
getDbName
(),
oldTable
.
getTableName
());
oldTable
.
getDbName
(),
oldTable
.
getTableName
());
...
@@ -419,6 +418,7 @@ public class HiveHook extends AtlasHook implements ExecuteWithHookContext {
...
@@ -419,6 +418,7 @@ public class HiveHook extends AtlasHook implements ExecuteWithHookContext {
String
newQualifiedName
=
dgiBridge
.
getTableQualifiedName
(
dgiBridge
.
getClusterName
(),
String
newQualifiedName
=
dgiBridge
.
getTableQualifiedName
(
dgiBridge
.
getClusterName
(),
newTable
.
getDbName
(),
newTable
.
getTableName
());
newTable
.
getDbName
(),
newTable
.
getTableName
());
//Replace entity with new name
Referenceable
newEntity
=
new
Referenceable
(
HiveDataTypes
.
HIVE_TABLE
.
getName
());
Referenceable
newEntity
=
new
Referenceable
(
HiveDataTypes
.
HIVE_TABLE
.
getName
());
newEntity
.
set
(
HiveDataModelGenerator
.
NAME
,
newQualifiedName
);
newEntity
.
set
(
HiveDataModelGenerator
.
NAME
,
newQualifiedName
);
newEntity
.
set
(
HiveDataModelGenerator
.
TABLE_NAME
,
newTable
.
getTableName
().
toLowerCase
());
newEntity
.
set
(
HiveDataModelGenerator
.
TABLE_NAME
,
newTable
.
getTableName
().
toLowerCase
());
...
...
This diff is collapsed.
Click to expand it.
addons/hive-bridge/src/test/java/org/apache/atlas/hive/hook/HiveHookIT.java
View file @
daf812aa
...
@@ -557,11 +557,15 @@ public class HiveHookIT {
...
@@ -557,11 +557,15 @@ public class HiveHookIT {
@Test
@Test
public
void
testAlterTableRename
()
throws
Exception
{
public
void
testAlterTableRename
()
throws
Exception
{
String
tableName
=
createTable
();
String
tableName
=
createTable
();
String
newName
=
tableName
();
final
String
newDBName
=
createDatabase
();
String
query
=
"alter table "
+
tableName
+
" rename to "
+
newName
;
assertTableIsRegistered
(
DEFAULT_DB
,
tableName
);
assertDatabaseIsRegistered
(
newDBName
);
String
newTableName
=
tableName
();
String
query
=
String
.
format
(
"alter table %s rename to %s"
,
DEFAULT_DB
+
"."
+
tableName
,
newDBName
+
"."
+
newTableName
);
runCommand
(
query
);
runCommand
(
query
);
assertTableIsRegistered
(
DEFAULT_DB
,
new
Name
);
assertTableIsRegistered
(
newDBName
,
newTable
Name
);
assertTableIsNotRegistered
(
DEFAULT_DB
,
tableName
);
assertTableIsNotRegistered
(
DEFAULT_DB
,
tableName
);
}
}
...
...
This diff is collapsed.
Click to expand it.
release-log.txt
View file @
daf812aa
...
@@ -15,6 +15,7 @@ ATLAS-409 Atlas will not import avro tables with schema read from a file (dosset
...
@@ -15,6 +15,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-594 alter table rename doesnt work across databases (sumasai via shwethags)
ATLAS-586 While updating the multiple attributes, Atlas returns the response with escape characters (dkantor via shwethags)
ATLAS-586 While updating the multiple attributes, Atlas returns the response with escape characters (dkantor via shwethags)
ATLAS-582 Move Atlas UI to use backboneJS (kevalbhatt18 via shwethags)
ATLAS-582 Move Atlas UI to use backboneJS (kevalbhatt18 via shwethags)
ATLAS-540 API to retrieve entity version events (shwethags)
ATLAS-540 API to retrieve entity version events (shwethags)
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment