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
Apr 14, 2016
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
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 {
for
(
WriteEntity
writeEntity
:
event
.
getOutputs
())
{
if
(
writeEntity
.
getType
()
==
Entity
.
Type
.
TABLE
)
{
Table
newTable
=
writeEntity
.
getTable
();
if
(
newTable
.
getDbName
().
equals
(
oldTable
.
getDbName
())
&&
!
newTable
.
getTableName
()
.
equals
(
oldTable
.
getTableName
()))
{
//Create/update old table entity - create new entity and replace id
//Hive sends with both old and new table names in the outputs which is weird. So skipping that with the below check
if
(!
newTable
.
getDbName
().
equals
(
oldTable
.
getDbName
())
||
!
newTable
.
getTableName
().
equals
(
oldTable
.
getTableName
()))
{
//Create/update old table entity - create new entity with oldQFNme and tableName
Referenceable
tableEntity
=
createOrUpdateEntities
(
dgiBridge
,
event
.
getUser
(),
writeEntity
);
String
oldQualifiedName
=
dgiBridge
.
getTableQualifiedName
(
dgiBridge
.
getClusterName
(),
oldTable
.
getDbName
(),
oldTable
.
getTableName
());
...
...
@@ -419,6 +418,7 @@ public class HiveHook extends AtlasHook implements ExecuteWithHookContext {
String
newQualifiedName
=
dgiBridge
.
getTableQualifiedName
(
dgiBridge
.
getClusterName
(),
newTable
.
getDbName
(),
newTable
.
getTableName
());
//Replace entity with new name
Referenceable
newEntity
=
new
Referenceable
(
HiveDataTypes
.
HIVE_TABLE
.
getName
());
newEntity
.
set
(
HiveDataModelGenerator
.
NAME
,
newQualifiedName
);
newEntity
.
set
(
HiveDataModelGenerator
.
TABLE_NAME
,
newTable
.
getTableName
().
toLowerCase
());
...
...
addons/hive-bridge/src/test/java/org/apache/atlas/hive/hook/HiveHookIT.java
View file @
daf812aa
...
...
@@ -557,11 +557,15 @@ public class HiveHookIT {
@Test
public
void
testAlterTableRename
()
throws
Exception
{
String
tableName
=
createTable
();
String
newName
=
tableName
();
String
query
=
"alter table "
+
tableName
+
" rename to "
+
newName
;
final
String
newDBName
=
createDatabase
();
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
);
assertTableIsRegistered
(
DEFAULT_DB
,
new
Name
);
assertTableIsRegistered
(
newDBName
,
newTable
Name
);
assertTableIsNotRegistered
(
DEFAULT_DB
,
tableName
);
}
...
...
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
ATLAS-379 Create sqoop and falcon metadata addons (venkatnrangan,bvellanki,sowmyaramesh via shwethags)
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-582 Move Atlas UI to use backboneJS (kevalbhatt18 via shwethags)
ATLAS-540 API to retrieve entity version events (shwethags)
...
...
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