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
07b8b4d3
Commit
07b8b4d3
authored
May 12, 2016
by
Suma Shivaprasad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-758 hdfs location of hive table is pointing to old location even after rename.(sumasai)
parent
54dc670a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
23 deletions
+30
-23
HiveMetaStoreBridge.java
...ava/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java
+2
-2
HiveHook.java
...ge/src/main/java/org/apache/atlas/hive/hook/HiveHook.java
+0
-3
HiveDataModelGenerator.java
...a/org/apache/atlas/hive/model/HiveDataModelGenerator.java
+3
-2
HiveHookIT.java
.../src/test/java/org/apache/atlas/hive/hook/HiveHookIT.java
+24
-16
release-log.txt
release-log.txt
+1
-0
No files found.
addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java
View file @
07b8b4d3
...
...
@@ -164,7 +164,7 @@ public class HiveMetaStoreBridge {
dbRef
.
set
(
HiveDataModelGenerator
.
NAME
,
dbName
);
dbRef
.
set
(
AtlasConstants
.
CLUSTER_NAME_ATTRIBUTE
,
clusterName
);
dbRef
.
set
(
DESCRIPTION_ATTR
,
hiveDB
.
getDescription
());
dbRef
.
set
(
"locationUri"
,
hiveDB
.
getLocationUri
());
dbRef
.
set
(
HiveDataModelGenerator
.
LOCATION
,
hiveDB
.
getLocationUri
());
dbRef
.
set
(
HiveDataModelGenerator
.
PARAMETERS
,
hiveDB
.
getParameters
());
dbRef
.
set
(
HiveDataModelGenerator
.
OWNER
,
hiveDB
.
getOwnerName
());
if
(
hiveDB
.
getOwnerType
()
!=
null
)
{
...
...
@@ -466,7 +466,7 @@ public class HiveMetaStoreBridge {
sdReferenceable
.
set
(
"sortCols"
,
sortColsStruct
);
}
sdReferenceable
.
set
(
"location"
,
storageDesc
.
getLocation
());
sdReferenceable
.
set
(
HiveDataModelGenerator
.
LOCATION
,
storageDesc
.
getLocation
());
sdReferenceable
.
set
(
"inputFormat"
,
storageDesc
.
getInputFormat
());
sdReferenceable
.
set
(
"outputFormat"
,
storageDesc
.
getOutputFormat
());
sdReferenceable
.
set
(
"compressed"
,
storageDesc
.
isCompressed
());
...
...
addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/HiveHook.java
View file @
07b8b4d3
...
...
@@ -440,14 +440,11 @@ public class HiveHook extends AtlasHook implements ExecuteWithHookContext {
private
Referenceable
replaceTableQFName
(
HiveMetaStoreBridge
dgiBridge
,
HiveEventContext
event
,
Table
oldTable
,
Table
newTable
,
final
Referenceable
tableEntity
,
final
String
oldTableQFName
,
final
String
newTableQFName
)
throws
HiveException
{
tableEntity
.
set
(
HiveDataModelGenerator
.
NAME
,
oldTableQFName
);
tableEntity
.
set
(
HiveDataModelGenerator
.
TABLE_NAME
,
oldTable
.
getTableName
().
toLowerCase
());
final
Referenceable
newDbInstance
=
(
Referenceable
)
tableEntity
.
get
(
HiveDataModelGenerator
.
DB
);
tableEntity
.
set
(
HiveDataModelGenerator
.
DB
,
dgiBridge
.
createDBInstance
(
dgiBridge
.
hiveClient
.
getDatabase
(
oldTable
.
getDbName
())));
//Replace table entity with new name
final
Referenceable
newEntity
=
new
Referenceable
(
HiveDataTypes
.
HIVE_TABLE
.
getName
());
newEntity
.
set
(
HiveDataModelGenerator
.
NAME
,
newTableQFName
);
newEntity
.
set
(
HiveDataModelGenerator
.
TABLE_NAME
,
newTable
.
getTableName
().
toLowerCase
());
newEntity
.
set
(
HiveDataModelGenerator
.
DB
,
newDbInstance
);
messages
.
add
(
new
HookNotification
.
EntityPartialUpdateRequest
(
event
.
getUser
(),
HiveDataTypes
.
HIVE_TABLE
.
getName
(),
HiveDataModelGenerator
.
NAME
,
...
...
addons/hive-bridge/src/main/java/org/apache/atlas/hive/model/HiveDataModelGenerator.java
View file @
07b8b4d3
...
...
@@ -78,6 +78,7 @@ public class HiveDataModelGenerator {
public
static
final
String
STORAGE_DESC_INPUT_FMT
=
"inputFormat"
;
public
static
final
String
STORAGE_DESC_OUTPUT_FMT
=
"outputFormat"
;
public
static
final
String
OWNER
=
"owner"
;
public
static
final
String
LOCATION
=
"location"
;
public
static
final
String
TABLE_TYPE_ATTR
=
"tableType"
;
...
...
@@ -171,7 +172,7 @@ public class HiveDataModelGenerator {
//Optional to keep it backward-compatible
new
AttributeDefinition
(
TABLE
,
HiveDataTypes
.
HIVE_TABLE
.
getName
(),
Multiplicity
.
OPTIONAL
,
false
,
STORAGE_DESC
),
new
AttributeDefinition
(
"location"
,
DataTypes
.
STRING_TYPE
.
getName
(),
Multiplicity
.
OPTIONAL
,
false
,
new
AttributeDefinition
(
LOCATION
,
DataTypes
.
STRING_TYPE
.
getName
(),
Multiplicity
.
OPTIONAL
,
false
,
null
),
new
AttributeDefinition
(
"inputFormat"
,
DataTypes
.
STRING_TYPE
.
getName
(),
Multiplicity
.
OPTIONAL
,
false
,
null
),
...
...
@@ -209,7 +210,7 @@ public class HiveDataModelGenerator {
null
),
new
AttributeDefinition
(
"description"
,
DataTypes
.
STRING_TYPE
.
getName
(),
Multiplicity
.
OPTIONAL
,
false
,
null
),
new
AttributeDefinition
(
"locationUri"
,
DataTypes
.
STRING_TYPE
.
getName
(),
Multiplicity
.
OPTIONAL
,
false
,
new
AttributeDefinition
(
LOCATION
,
DataTypes
.
STRING_TYPE
.
getName
(),
Multiplicity
.
OPTIONAL
,
false
,
null
),
new
AttributeDefinition
(
HiveDataModelGenerator
.
PARAMETERS
,
STRING_MAP_TYPE
.
getName
(),
Multiplicity
.
OPTIONAL
,
false
,
null
),
new
AttributeDefinition
(
OWNER
,
DataTypes
.
STRING_TYPE
.
getName
(),
Multiplicity
.
OPTIONAL
,
false
,
...
...
addons/hive-bridge/src/test/java/org/apache/atlas/hive/hook/HiveHookIT.java
View file @
07b8b4d3
...
...
@@ -623,7 +623,7 @@ public class HiveHookIT {
//Add trait to part col keys
String
partColTraitDetails
=
createTrait
(
partColumnGuid
);
String
newTableName
=
tableName
();
final
String
newTableName
=
tableName
();
String
query
=
String
.
format
(
"alter table %s rename to %s"
,
DEFAULT_DB
+
"."
+
tableName
,
newDBName
+
"."
+
newTableName
);
runCommand
(
query
);
...
...
@@ -640,7 +640,15 @@ public class HiveHookIT {
assertTrait
(
partColumnGuid
,
partColTraitDetails
);
assertTableIsNotRegistered
(
DEFAULT_DB
,
tableName
);
assertTableIsRegistered
(
newDBName
,
newTableName
);
assertTableIsRegistered
(
newDBName
,
newTableName
,
new
AssertPredicate
()
{
@Override
public
void
assertOnEntity
(
final
Referenceable
entity
)
throws
Exception
{
Referenceable
sd
=
((
Referenceable
)
entity
.
get
(
HiveDataModelGenerator
.
STORAGE_DESC
));
String
location
=
(
String
)
sd
.
get
(
HiveDataModelGenerator
.
LOCATION
);
Assert
.
assertTrue
(
location
.
contains
(
newTableName
));
}
});
}
private
List
<
Referenceable
>
getColumns
(
String
dbName
,
String
tableName
)
throws
Exception
{
...
...
@@ -673,8 +681,8 @@ public class HiveHookIT {
runCommand
(
query
);
assertColumnIsRegistered
(
HiveMetaStoreBridge
.
getColumnQualifiedName
(
HiveMetaStoreBridge
.
getTableQualifiedName
(
CLUSTER_NAME
,
DEFAULT_DB
,
tableName
),
column
));
.
getColumnQualifiedName
(
HiveMetaStoreBridge
.
getTableQualifiedName
(
CLUSTER_NAME
,
DEFAULT_DB
,
tableName
),
column
));
//Verify the number of columns present in the table
final
List
<
Referenceable
>
columns
=
getColumns
(
DEFAULT_DB
,
tableName
);
...
...
@@ -904,7 +912,7 @@ public class HiveHookIT {
@Override
public
void
assertOnEntity
(
Referenceable
tableRef
)
throws
Exception
{
Referenceable
sdRef
=
(
Referenceable
)
tableRef
.
get
(
HiveDataModelGenerator
.
STORAGE_DESC
);
Assert
.
assertEquals
(
new
Path
((
String
)
sdRef
.
get
(
"location"
)).
toString
(),
new
Path
(
testPath
).
toString
());
Assert
.
assertEquals
(
new
Path
((
String
)
sdRef
.
get
(
HiveDataModelGenerator
.
LOCATION
)).
toString
(),
new
Path
(
testPath
).
toString
());
}
});
...
...
@@ -1009,7 +1017,7 @@ public class HiveHookIT {
ImmutableList
<
String
>
sortcolNames
)
throws
Exception
{
Referenceable
sdRef
=
(
Referenceable
)
tableRef
.
get
(
HiveDataModelGenerator
.
STORAGE_DESC
);
Assert
.
assertEquals
(((
scala
.
math
.
BigInt
)
sdRef
.
get
(
HiveDataModelGenerator
.
STORAGE_NUM_BUCKETS
)).
intValue
(),
numBuckets
);
numBuckets
);
Assert
.
assertEquals
(
sdRef
.
get
(
"bucketCols"
),
bucketColNames
);
List
<
Struct
>
hiveOrderStructList
=
(
List
<
Struct
>)
sdRef
.
get
(
"sortCols"
);
...
...
@@ -1050,11 +1058,11 @@ public class HiveHookIT {
final
String
query
=
String
.
format
(
"drop table %s "
,
tableName
);
runCommand
(
query
);
assertColumnIsNotRegistered
(
HiveMetaStoreBridge
.
getColumnQualifiedName
(
HiveMetaStoreBridge
.
getTableQualifiedName
(
CLUSTER_NAME
,
DEFAULT_DB
,
tableName
),
"id"
));
.
getColumnQualifiedName
(
HiveMetaStoreBridge
.
getTableQualifiedName
(
CLUSTER_NAME
,
DEFAULT_DB
,
tableName
),
"id"
));
assertColumnIsNotRegistered
(
HiveMetaStoreBridge
.
getColumnQualifiedName
(
HiveMetaStoreBridge
.
getTableQualifiedName
(
CLUSTER_NAME
,
DEFAULT_DB
,
tableName
),
HiveDataModelGenerator
.
NAME
));
.
getColumnQualifiedName
(
HiveMetaStoreBridge
.
getTableQualifiedName
(
CLUSTER_NAME
,
DEFAULT_DB
,
tableName
),
HiveDataModelGenerator
.
NAME
));
assertTableIsNotRegistered
(
DEFAULT_DB
,
tableName
);
}
...
...
@@ -1077,8 +1085,8 @@ public class HiveHookIT {
assertColumnIsNotRegistered
(
HiveMetaStoreBridge
.
getColumnQualifiedName
(
HiveMetaStoreBridge
.
getTableQualifiedName
(
CLUSTER_NAME
,
dbName
,
tableNames
[
0
]),
"id"
));
assertColumnIsNotRegistered
(
HiveMetaStoreBridge
.
getColumnQualifiedName
(
HiveMetaStoreBridge
.
getTableQualifiedName
(
CLUSTER_NAME
,
dbName
,
tableNames
[
0
]),
HiveDataModelGenerator
.
NAME
));
.
getColumnQualifiedName
(
HiveMetaStoreBridge
.
getTableQualifiedName
(
CLUSTER_NAME
,
dbName
,
tableNames
[
0
]),
HiveDataModelGenerator
.
NAME
));
for
(
int
i
=
0
;
i
<
numTables
;
i
++)
{
assertTableIsNotRegistered
(
dbName
,
tableNames
[
i
]);
...
...
@@ -1152,8 +1160,8 @@ public class HiveHookIT {
.
getColumnQualifiedName
(
HiveMetaStoreBridge
.
getTableQualifiedName
(
CLUSTER_NAME
,
DEFAULT_DB
,
viewName
),
"id"
));
assertColumnIsNotRegistered
(
HiveMetaStoreBridge
.
getColumnQualifiedName
(
HiveMetaStoreBridge
.
getTableQualifiedName
(
CLUSTER_NAME
,
DEFAULT_DB
,
viewName
),
HiveDataModelGenerator
.
NAME
));
.
getColumnQualifiedName
(
HiveMetaStoreBridge
.
getTableQualifiedName
(
CLUSTER_NAME
,
DEFAULT_DB
,
viewName
),
HiveDataModelGenerator
.
NAME
));
assertTableIsNotRegistered
(
DEFAULT_DB
,
viewName
);
}
...
...
@@ -1348,7 +1356,7 @@ public class HiveHookIT {
LOG
.
debug
(
"Searching for table {}.{}"
,
dbName
,
tableName
);
String
tableQualifiedName
=
HiveMetaStoreBridge
.
getTableQualifiedName
(
CLUSTER_NAME
,
dbName
,
tableName
,
isTemporary
);
return
assertEntityIsRegistered
(
HiveDataTypes
.
HIVE_TABLE
.
getName
(),
AtlasClient
.
NAME
,
tableQualifiedName
,
assertPredicate
);
assertPredicate
);
}
private
String
assertTableIsRegistered
(
String
dbName
,
String
tableName
,
AssertPredicate
assertPredicate
)
throws
Exception
{
...
...
@@ -1373,7 +1381,7 @@ public class HiveHookIT {
public
void
evaluate
()
throws
Exception
{
Referenceable
entity
=
atlasClient
.
getEntity
(
typeName
,
property
,
value
);
assertNotNull
(
entity
);
if
(
assertPredicate
!=
null
)
{
if
(
assertPredicate
!=
null
)
{
assertPredicate
.
assertOnEntity
(
entity
);
}
}
...
...
release-log.txt
View file @
07b8b4d3
...
...
@@ -20,6 +20,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-758 hdfs location of hive table is pointing to old location even after rename ( sumasai )
ATLAS-667 Entity delete should check for required reverse references ( dkantor via sumasai )
ATLAS-738 Add query ability on system properties like guid, state, createdtime etc (shwethags)
ATLAS-692 Create abstraction layer for graph databases (jnhagelb via yhemanth)
...
...
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