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
6f241db4
Commit
6f241db4
authored
Jun 17, 2016
by
Suma Shivaprasad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-877 CreateTime of an entity(for example hive table) changes for every update (sumasai)
parent
9d1040b7
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
6 deletions
+12
-6
HiveMetaStoreBridge.java
...ava/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java
+4
-4
HiveHookIT.java
.../src/test/java/org/apache/atlas/hive/hook/HiveHookIT.java
+7
-2
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 @
6f241db4
...
@@ -44,7 +44,6 @@ import org.apache.hadoop.hive.metastore.api.FieldSchema;
...
@@ -44,7 +44,6 @@ import org.apache.hadoop.hive.metastore.api.FieldSchema;
import
org.apache.hadoop.hive.metastore.api.Order
;
import
org.apache.hadoop.hive.metastore.api.Order
;
import
org.apache.hadoop.hive.metastore.api.SerDeInfo
;
import
org.apache.hadoop.hive.metastore.api.SerDeInfo
;
import
org.apache.hadoop.hive.metastore.api.StorageDescriptor
;
import
org.apache.hadoop.hive.metastore.api.StorageDescriptor
;
import
org.apache.hadoop.hive.metastore.api.hive_metastoreConstants
;
import
org.apache.hadoop.hive.ql.metadata.Hive
;
import
org.apache.hadoop.hive.ql.metadata.Hive
;
import
org.apache.hadoop.hive.ql.metadata.HiveException
;
import
org.apache.hadoop.hive.ql.metadata.HiveException
;
import
org.apache.hadoop.hive.ql.metadata.Table
;
import
org.apache.hadoop.hive.ql.metadata.Table
;
...
@@ -73,7 +72,7 @@ public class HiveMetaStoreBridge {
...
@@ -73,7 +72,7 @@ public class HiveMetaStoreBridge {
public
static
final
String
TEMP_TABLE_PREFIX
=
"_temp-"
;
public
static
final
String
TEMP_TABLE_PREFIX
=
"_temp-"
;
private
final
String
clusterName
;
private
final
String
clusterName
;
public
static
final
int
MILLIS_CONVERT_FACTOR
=
1000
;
public
static
final
long
MILLIS_CONVERT_FACTOR
=
1000
;
public
static
final
String
ATLAS_ENDPOINT
=
"atlas.rest.address"
;
public
static
final
String
ATLAS_ENDPOINT
=
"atlas.rest.address"
;
...
@@ -403,9 +402,10 @@ public class HiveMetaStoreBridge {
...
@@ -403,9 +402,10 @@ public class HiveMetaStoreBridge {
tableReference
.
set
(
HiveDataModelGenerator
.
OWNER
,
hiveTable
.
getOwner
());
tableReference
.
set
(
HiveDataModelGenerator
.
OWNER
,
hiveTable
.
getOwner
());
Date
createDate
=
new
Date
();
Date
createDate
=
new
Date
();
if
(
hiveTable
.
get
Metadata
().
getProperty
(
hive_metastoreConstants
.
DDL_TIME
)
!=
null
){
if
(
hiveTable
.
get
TTable
(
)
!=
null
){
try
{
try
{
createDate
=
new
Date
(
Long
.
parseLong
(
hiveTable
.
getMetadata
().
getProperty
(
hive_metastoreConstants
.
DDL_TIME
))
*
MILLIS_CONVERT_FACTOR
);
createDate
=
new
Date
(
hiveTable
.
getTTable
().
getCreateTime
()
*
MILLIS_CONVERT_FACTOR
);
LOG
.
debug
(
"Setting create time to {} "
,
createDate
);
tableReference
.
set
(
HiveDataModelGenerator
.
CREATE_TIME
,
createDate
);
tableReference
.
set
(
HiveDataModelGenerator
.
CREATE_TIME
,
createDate
);
}
catch
(
NumberFormatException
ne
)
{
}
catch
(
NumberFormatException
ne
)
{
LOG
.
error
(
"Error while updating createTime for the table {} "
,
hiveTable
.
getCompleteName
(),
ne
);
LOG
.
error
(
"Error while updating createTime for the table {} "
,
hiveTable
.
getCompleteName
(),
ne
);
...
...
addons/hive-bridge/src/test/java/org/apache/atlas/hive/hook/HiveHookIT.java
View file @
6f241db4
...
@@ -711,7 +711,11 @@ public class HiveHookIT {
...
@@ -711,7 +711,11 @@ public class HiveHookIT {
String
tableName
=
createTable
(
true
);
String
tableName
=
createTable
(
true
);
final
String
newDBName
=
createDatabase
();
final
String
newDBName
=
createDatabase
();
assertTableIsRegistered
(
DEFAULT_DB
,
tableName
);
String
tableId
=
assertTableIsRegistered
(
DEFAULT_DB
,
tableName
);
Referenceable
tableEntity
=
atlasClient
.
getEntity
(
tableId
);
final
String
createTime
=
(
String
)
tableEntity
.
get
(
HiveDataModelGenerator
.
CREATE_TIME
);
Assert
.
assertNotNull
(
createTime
);
String
columnGuid
=
assertColumnIsRegistered
(
HiveMetaStoreBridge
.
getColumnQualifiedName
(
HiveMetaStoreBridge
.
getTableQualifiedName
(
CLUSTER_NAME
,
DEFAULT_DB
,
tableName
),
NAME
));
String
columnGuid
=
assertColumnIsRegistered
(
HiveMetaStoreBridge
.
getColumnQualifiedName
(
HiveMetaStoreBridge
.
getTableQualifiedName
(
CLUSTER_NAME
,
DEFAULT_DB
,
tableName
),
NAME
));
String
sdGuid
=
assertSDIsRegistered
(
HiveMetaStoreBridge
.
getStorageDescQFName
(
HiveMetaStoreBridge
.
getTableQualifiedName
(
CLUSTER_NAME
,
DEFAULT_DB
,
tableName
)),
null
);
String
sdGuid
=
assertSDIsRegistered
(
HiveMetaStoreBridge
.
getStorageDescQFName
(
HiveMetaStoreBridge
.
getTableQualifiedName
(
CLUSTER_NAME
,
DEFAULT_DB
,
tableName
)),
null
);
assertDatabaseIsRegistered
(
newDBName
);
assertDatabaseIsRegistered
(
newDBName
);
...
@@ -728,7 +732,7 @@ public class HiveHookIT {
...
@@ -728,7 +732,7 @@ public class HiveHookIT {
final
String
newTableName
=
tableName
();
final
String
newTableName
=
tableName
();
String
query
=
String
.
format
(
"alter table %s rename to %s"
,
DEFAULT_DB
+
"."
+
tableName
,
newDBName
+
"."
+
newTableName
);
String
query
=
String
.
format
(
"alter table %s rename to %s"
,
DEFAULT_DB
+
"."
+
tableName
,
newDBName
+
"."
+
newTableName
);
runCommand
(
query
);
runCommand
WithDelay
(
query
,
1000
);
String
newColGuid
=
assertColumnIsRegistered
(
HiveMetaStoreBridge
.
getColumnQualifiedName
(
HiveMetaStoreBridge
.
getTableQualifiedName
(
CLUSTER_NAME
,
newDBName
,
newTableName
),
NAME
));
String
newColGuid
=
assertColumnIsRegistered
(
HiveMetaStoreBridge
.
getColumnQualifiedName
(
HiveMetaStoreBridge
.
getTableQualifiedName
(
CLUSTER_NAME
,
newDBName
,
newTableName
),
NAME
));
Assert
.
assertEquals
(
newColGuid
,
columnGuid
);
Assert
.
assertEquals
(
newColGuid
,
columnGuid
);
...
@@ -750,6 +754,7 @@ public class HiveHookIT {
...
@@ -750,6 +754,7 @@ public class HiveHookIT {
Referenceable
sd
=
((
Referenceable
)
entity
.
get
(
HiveDataModelGenerator
.
STORAGE_DESC
));
Referenceable
sd
=
((
Referenceable
)
entity
.
get
(
HiveDataModelGenerator
.
STORAGE_DESC
));
String
location
=
(
String
)
sd
.
get
(
HiveDataModelGenerator
.
LOCATION
);
String
location
=
(
String
)
sd
.
get
(
HiveDataModelGenerator
.
LOCATION
);
assertTrue
(
location
.
contains
(
newTableName
));
assertTrue
(
location
.
contains
(
newTableName
));
Assert
.
assertEquals
(
entity
.
get
(
HiveDataModelGenerator
.
CREATE_TIME
),
createTime
);
}
}
});
});
}
}
...
...
release-log.txt
View file @
6f241db4
...
@@ -24,6 +24,7 @@ ATLAS-409 Atlas will not import avro tables with schema read from a file (dosset
...
@@ -24,6 +24,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-877 CreateTime of an entity(for example hive table) changes for every update (sumasai)
ATLAS-642 import-hive should create the lineage for external tables (svimal2106 via sumasai)
ATLAS-642 import-hive should create the lineage for external tables (svimal2106 via sumasai)
ATLAS-901 Log messages that cannot be sent to Kafka to a specific log configuration (yhemanth)
ATLAS-901 Log messages that cannot be sent to Kafka to a specific log configuration (yhemanth)
ATLAS-911 Get entity by unique attribute doesn't enforce type (shwethags)
ATLAS-911 Get entity by unique attribute doesn't enforce type (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