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
ae23e783
Commit
ae23e783
authored
Mar 22, 2018
by
Madhan Neethiraj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2491: Hive hook using V2 notifications (#2)
parent
60c05eb7
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
57 additions
and
19 deletions
+57
-19
AlterDatabase.java
...java/org/apache/atlas/hive/hook/events/AlterDatabase.java
+8
-3
AlterTable.java
...in/java/org/apache/atlas/hive/hook/events/AlterTable.java
+7
-3
BaseHiveEvent.java
...java/org/apache/atlas/hive/hook/events/BaseHiveEvent.java
+1
-0
CreateDatabase.java
...ava/org/apache/atlas/hive/hook/events/CreateDatabase.java
+7
-3
CreateHiveProcess.java
.../org/apache/atlas/hive/hook/events/CreateHiveProcess.java
+5
-1
CreateTable.java
...n/java/org/apache/atlas/hive/hook/events/CreateTable.java
+7
-3
DropDatabase.java
.../java/org/apache/atlas/hive/hook/events/DropDatabase.java
+11
-3
DropTable.java
...ain/java/org/apache/atlas/hive/hook/events/DropTable.java
+11
-3
No files found.
addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/events/AlterDatabase.java
View file @
ae23e783
...
...
@@ -21,6 +21,8 @@ package org.apache.atlas.hive.hook.events;
import
org.apache.atlas.hive.hook.AtlasHiveHookContext
;
import
org.apache.atlas.model.instance.AtlasEntity.AtlasEntitiesWithExtInfo
;
import
org.apache.atlas.model.notification.HookNotification
;
import
org.apache.atlas.model.notification.HookNotification.EntityUpdateRequestV2
;
import
org.apache.commons.collections.CollectionUtils
;
import
java.util.Collections
;
import
java.util.List
;
...
...
@@ -32,9 +34,12 @@ public class AlterDatabase extends CreateDatabase {
@Override
public
List
<
HookNotification
>
getNotificationMessages
()
throws
Exception
{
AtlasEntitiesWithExtInfo
entities
=
getEntities
();
HookNotification
notification
=
new
HookNotification
.
EntityUpdateRequestV2
(
getUserName
(),
entities
);
List
<
HookNotification
>
ret
=
Collections
.
singletonList
(
notification
);
List
<
HookNotification
>
ret
=
null
;
AtlasEntitiesWithExtInfo
entities
=
getEntities
();
if
(
entities
!=
null
&&
CollectionUtils
.
isNotEmpty
(
entities
.
getEntities
()))
{
ret
=
Collections
.
singletonList
(
new
EntityUpdateRequestV2
(
getUserName
(),
entities
));
}
return
ret
;
}
...
...
addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/events/AlterTable.java
View file @
ae23e783
...
...
@@ -22,6 +22,7 @@ import org.apache.atlas.hive.hook.AtlasHiveHookContext;
import
org.apache.atlas.model.instance.AtlasEntity.AtlasEntitiesWithExtInfo
;
import
org.apache.atlas.model.notification.HookNotification
;
import
org.apache.atlas.model.notification.HookNotification.EntityUpdateRequestV2
;
import
org.apache.commons.collections.CollectionUtils
;
import
java.util.Collections
;
import
java.util.List
;
...
...
@@ -33,9 +34,12 @@ public class AlterTable extends CreateTable {
@Override
public
List
<
HookNotification
>
getNotificationMessages
()
throws
Exception
{
AtlasEntitiesWithExtInfo
entities
=
getEntities
();
HookNotification
notification
=
new
EntityUpdateRequestV2
(
getUserName
(),
entities
);
List
<
HookNotification
>
ret
=
Collections
.
singletonList
(
notification
);
List
<
HookNotification
>
ret
=
null
;
AtlasEntitiesWithExtInfo
entities
=
getEntities
();
if
(
entities
!=
null
&&
CollectionUtils
.
isNotEmpty
(
entities
.
getEntities
()))
{
ret
=
Collections
.
singletonList
(
new
EntityUpdateRequestV2
(
getUserName
(),
entities
));
}
return
ret
;
}
...
...
addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/events/BaseHiveEvent.java
View file @
ae23e783
...
...
@@ -805,6 +805,7 @@ public abstract class BaseHiveEvent {
case
ALTERTABLE_RENAMECOL:
case
ALTERVIEW_PROPERTIES:
case
ALTERVIEW_RENAME:
case
ALTERVIEW_AS:
return
true
;
}
...
...
addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/events/CreateDatabase.java
View file @
ae23e783
...
...
@@ -23,6 +23,7 @@ import org.apache.atlas.model.instance.AtlasEntity;
import
org.apache.atlas.model.instance.AtlasEntity.AtlasEntitiesWithExtInfo
;
import
org.apache.atlas.model.notification.HookNotification
;
import
org.apache.atlas.model.notification.HookNotification.EntityCreateRequestV2
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.hadoop.hive.metastore.api.Database
;
import
org.apache.hadoop.hive.ql.hooks.Entity
;
import
org.slf4j.Logger
;
...
...
@@ -40,9 +41,12 @@ public class CreateDatabase extends BaseHiveEvent {
@Override
public
List
<
HookNotification
>
getNotificationMessages
()
throws
Exception
{
AtlasEntitiesWithExtInfo
entities
=
getEntities
();
HookNotification
notification
=
new
EntityCreateRequestV2
(
getUserName
(),
entities
);
List
<
HookNotification
>
ret
=
Collections
.
singletonList
(
notification
);
List
<
HookNotification
>
ret
=
null
;
AtlasEntitiesWithExtInfo
entities
=
getEntities
();
if
(
entities
!=
null
&&
CollectionUtils
.
isNotEmpty
(
entities
.
getEntities
()))
{
ret
=
Collections
.
singletonList
(
new
EntityCreateRequestV2
(
getUserName
(),
entities
));
}
return
ret
;
}
...
...
addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/events/CreateHiveProcess.java
View file @
ae23e783
...
...
@@ -53,8 +53,12 @@ public class CreateHiveProcess extends BaseHiveEvent {
@Override
public
List
<
HookNotification
>
getNotificationMessages
()
throws
Exception
{
List
<
HookNotification
>
ret
=
null
;
AtlasEntitiesWithExtInfo
entities
=
getEntities
();
List
<
HookNotification
>
ret
=
entities
!=
null
?
Collections
.
singletonList
(
new
EntityCreateRequestV2
(
getUserName
(),
entities
))
:
null
;
if
(
entities
!=
null
&&
CollectionUtils
.
isNotEmpty
(
entities
.
getEntities
()))
{
ret
=
Collections
.
singletonList
(
new
EntityCreateRequestV2
(
getUserName
(),
entities
));
}
return
ret
;
}
...
...
addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/events/CreateTable.java
View file @
ae23e783
...
...
@@ -23,6 +23,7 @@ import org.apache.atlas.model.instance.AtlasEntity;
import
org.apache.atlas.model.instance.AtlasEntity.AtlasEntitiesWithExtInfo
;
import
org.apache.atlas.model.notification.HookNotification
;
import
org.apache.atlas.model.notification.HookNotification.EntityCreateRequestV2
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.hadoop.hive.metastore.TableType
;
import
org.apache.hadoop.hive.metastore.api.Database
;
import
org.apache.hadoop.hive.ql.hooks.Entity
;
...
...
@@ -42,9 +43,12 @@ public class CreateTable extends BaseHiveEvent {
@Override
public
List
<
HookNotification
>
getNotificationMessages
()
throws
Exception
{
AtlasEntitiesWithExtInfo
entities
=
getEntities
();
HookNotification
notification
=
new
EntityCreateRequestV2
(
getUserName
(),
entities
);
List
<
HookNotification
>
ret
=
Collections
.
singletonList
(
notification
);
List
<
HookNotification
>
ret
=
null
;
AtlasEntitiesWithExtInfo
entities
=
getEntities
();
if
(
entities
!=
null
&&
CollectionUtils
.
isNotEmpty
(
entities
.
getEntities
()))
{
ret
=
Collections
.
singletonList
(
new
EntityCreateRequestV2
(
getUserName
(),
entities
));
}
return
ret
;
}
...
...
addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/events/DropDatabase.java
View file @
ae23e783
...
...
@@ -22,6 +22,7 @@ import org.apache.atlas.hive.hook.AtlasHiveHookContext;
import
org.apache.atlas.model.instance.AtlasObjectId
;
import
org.apache.atlas.model.notification.HookNotification
;
import
org.apache.atlas.model.notification.HookNotification.EntityDeleteRequestV2
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.hadoop.hive.ql.hooks.Entity
;
import
java.util.ArrayList
;
...
...
@@ -35,9 +36,16 @@ public class DropDatabase extends BaseHiveEvent {
@Override
public
List
<
HookNotification
>
getNotificationMessages
()
throws
Exception
{
List
<
AtlasObjectId
>
entities
=
getEntities
();
HookNotification
notification
=
new
EntityDeleteRequestV2
(
getUserName
(),
entities
);
List
<
HookNotification
>
ret
=
Collections
.
singletonList
(
notification
);
List
<
HookNotification
>
ret
=
null
;
List
<
AtlasObjectId
>
entities
=
getEntities
();
if
(
CollectionUtils
.
isNotEmpty
(
entities
))
{
ret
=
new
ArrayList
<>(
entities
.
size
());
for
(
AtlasObjectId
entity
:
entities
)
{
ret
.
add
(
new
EntityDeleteRequestV2
(
getUserName
(),
Collections
.
singletonList
(
entity
)));
}
}
return
ret
;
}
...
...
addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/events/DropTable.java
View file @
ae23e783
...
...
@@ -22,6 +22,7 @@ import org.apache.atlas.hive.hook.AtlasHiveHookContext;
import
org.apache.atlas.model.instance.AtlasObjectId
;
import
org.apache.atlas.model.notification.HookNotification
;
import
org.apache.atlas.model.notification.HookNotification.EntityDeleteRequestV2
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.hadoop.hive.ql.hooks.Entity
;
import
java.util.ArrayList
;
...
...
@@ -35,9 +36,16 @@ public class DropTable extends BaseHiveEvent {
@Override
public
List
<
HookNotification
>
getNotificationMessages
()
throws
Exception
{
List
<
AtlasObjectId
>
entities
=
getEntities
();
HookNotification
notification
=
new
EntityDeleteRequestV2
(
getUserName
(),
entities
);
List
<
HookNotification
>
ret
=
Collections
.
singletonList
(
notification
);
List
<
HookNotification
>
ret
=
null
;
List
<
AtlasObjectId
>
entities
=
getEntities
();
if
(
CollectionUtils
.
isNotEmpty
(
entities
))
{
ret
=
new
ArrayList
<>(
entities
.
size
());
for
(
AtlasObjectId
entity
:
entities
)
{
ret
.
add
(
new
EntityDeleteRequestV2
(
getUserName
(),
Collections
.
singletonList
(
entity
)));
}
}
return
ret
;
}
...
...
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