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
fcca791b
Commit
fcca791b
authored
6 years ago
by
Sarath Subramanian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-3188: Regression: Simple insert queries are being captured in ATLAS_HOOK topic
parent
8b58a326
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
9 deletions
+45
-9
AtlasHiveHookContext.java
...java/org/apache/atlas/hive/hook/AtlasHiveHookContext.java
+32
-4
BaseHiveEvent.java
...java/org/apache/atlas/hive/hook/events/BaseHiveEvent.java
+2
-3
CreateHiveProcess.java
.../org/apache/atlas/hive/hook/events/CreateHiveProcess.java
+11
-2
No files found.
addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/AtlasHiveHookContext.java
View file @
fcca791b
...
@@ -26,10 +26,7 @@ import org.apache.commons.lang.RandomStringUtils;
...
@@ -26,10 +26,7 @@ import org.apache.commons.lang.RandomStringUtils;
import
org.apache.hadoop.hive.metastore.IHMSHandler
;
import
org.apache.hadoop.hive.metastore.IHMSHandler
;
import
org.apache.hadoop.hive.metastore.api.Database
;
import
org.apache.hadoop.hive.metastore.api.Database
;
import
org.apache.hadoop.hive.metastore.events.*
;
import
org.apache.hadoop.hive.metastore.events.*
;
import
org.apache.hadoop.hive.ql.hooks.HookContext
;
import
org.apache.hadoop.hive.ql.hooks.*
;
import
org.apache.hadoop.hive.ql.hooks.LineageInfo
;
import
org.apache.hadoop.hive.ql.hooks.ReadEntity
;
import
org.apache.hadoop.hive.ql.hooks.WriteEntity
;
import
org.apache.hadoop.hive.ql.metadata.Hive
;
import
org.apache.hadoop.hive.ql.metadata.Hive
;
import
org.apache.hadoop.hive.ql.metadata.Table
;
import
org.apache.hadoop.hive.ql.metadata.Table
;
import
org.apache.hadoop.hive.ql.plan.HiveOperation
;
import
org.apache.hadoop.hive.ql.plan.HiveOperation
;
...
@@ -58,6 +55,9 @@ public class AtlasHiveHookContext {
...
@@ -58,6 +55,9 @@ public class AtlasHiveHookContext {
private
final
ListenerEvent
metastoreEvent
;
private
final
ListenerEvent
metastoreEvent
;
private
final
IHMSHandler
metastoreHandler
;
private
final
IHMSHandler
metastoreHandler
;
private
boolean
isSkippedInputEntity
;
private
boolean
isSkippedOutputEntity
;
public
AtlasHiveHookContext
(
HiveHook
hook
,
HiveOperation
hiveOperation
,
HookContext
hiveContext
,
public
AtlasHiveHookContext
(
HiveHook
hook
,
HiveOperation
hiveOperation
,
HookContext
hiveContext
,
HiveHookObjectNamesCache
knownObjects
)
throws
Exception
{
HiveHookObjectNamesCache
knownObjects
)
throws
Exception
{
this
(
hook
,
hiveOperation
,
hiveContext
,
knownObjects
,
null
,
null
);
this
(
hook
,
hiveOperation
,
hiveContext
,
knownObjects
,
null
,
null
);
...
@@ -102,6 +102,34 @@ public class AtlasHiveHookContext {
...
@@ -102,6 +102,34 @@ public class AtlasHiveHookContext {
return
hiveContext
!=
null
?
hiveContext
.
getOutputs
()
:
Collections
.
emptySet
();
return
hiveContext
!=
null
?
hiveContext
.
getOutputs
()
:
Collections
.
emptySet
();
}
}
public
boolean
isSkippedInputEntity
()
{
return
isSkippedInputEntity
;
}
public
boolean
isSkippedOutputEntity
()
{
return
isSkippedOutputEntity
;
}
public
void
registerSkippedEntity
(
Entity
entity
)
{
if
(
entity
instanceof
ReadEntity
)
{
registerSkippedInputEntity
();
}
else
if
(
entity
instanceof
WriteEntity
)
{
registerSkippedOutputEntity
();
}
}
public
void
registerSkippedInputEntity
()
{
if
(!
isSkippedInputEntity
)
{
isSkippedInputEntity
=
true
;
}
}
public
void
registerSkippedOutputEntity
()
{
if
(!
isSkippedOutputEntity
)
{
isSkippedOutputEntity
=
true
;
}
}
public
LineageInfo
getLineageInfo
()
{
public
LineageInfo
getLineageInfo
()
{
return
hiveContext
!=
null
?
hiveContext
.
getLinfo
()
:
null
;
return
hiveContext
!=
null
?
hiveContext
.
getLinfo
()
:
null
;
}
}
...
...
This diff is collapsed.
Click to expand it.
addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/events/BaseHiveEvent.java
View file @
fcca791b
...
@@ -18,7 +18,6 @@
...
@@ -18,7 +18,6 @@
package
org
.
apache
.
atlas
.
hive
.
hook
.
events
;
package
org
.
apache
.
atlas
.
hive
.
hook
.
events
;
import
com.google.common.collect.ImmutableMap
;
import
org.apache.atlas.hive.hook.AtlasHiveHookContext
;
import
org.apache.atlas.hive.hook.AtlasHiveHookContext
;
import
org.apache.atlas.hive.hook.HiveHook.PreprocessAction
;
import
org.apache.atlas.hive.hook.HiveHook.PreprocessAction
;
import
org.apache.atlas.model.instance.AtlasEntity
;
import
org.apache.atlas.model.instance.AtlasEntity
;
...
@@ -28,7 +27,6 @@ import org.apache.atlas.model.instance.AtlasEntity.AtlasEntityExtInfo;
...
@@ -28,7 +27,6 @@ import org.apache.atlas.model.instance.AtlasEntity.AtlasEntityExtInfo;
import
org.apache.atlas.model.instance.AtlasObjectId
;
import
org.apache.atlas.model.instance.AtlasObjectId
;
import
org.apache.atlas.model.instance.AtlasStruct
;
import
org.apache.atlas.model.instance.AtlasStruct
;
import
org.apache.atlas.model.notification.HookNotification
;
import
org.apache.atlas.model.notification.HookNotification
;
import
org.apache.atlas.repository.Constants
;
import
org.apache.atlas.type.AtlasTypeUtil
;
import
org.apache.atlas.type.AtlasTypeUtil
;
import
org.apache.atlas.utils.HdfsNameServiceResolver
;
import
org.apache.atlas.utils.HdfsNameServiceResolver
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
...
@@ -52,7 +50,6 @@ import org.slf4j.Logger;
...
@@ -52,7 +50,6 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.net.InetAddress
;
import
java.net.URI
;
import
java.net.URI
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Collection
;
...
@@ -268,6 +265,8 @@ public abstract class BaseHiveEvent {
...
@@ -268,6 +265,8 @@ public abstract class BaseHiveEvent {
Table
table
=
getHive
().
getTable
(
dbName
,
tableName
);
Table
table
=
getHive
().
getTable
(
dbName
,
tableName
);
ret
=
toTableEntity
(
table
,
entityExtInfo
);
ret
=
toTableEntity
(
table
,
entityExtInfo
);
}
else
{
context
.
registerSkippedEntity
(
entity
);
}
}
}
}
break
;
break
;
...
...
This diff is collapsed.
Click to expand it.
addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/events/CreateHiveProcess.java
View file @
fcca791b
...
@@ -25,7 +25,6 @@ import org.apache.atlas.model.notification.HookNotification;
...
@@ -25,7 +25,6 @@ import org.apache.atlas.model.notification.HookNotification;
import
org.apache.atlas.model.notification.HookNotification.EntityCreateRequestV2
;
import
org.apache.atlas.model.notification.HookNotification.EntityCreateRequestV2
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.hadoop.hive.ql.hooks.Entity
;
import
org.apache.hadoop.hive.ql.hooks.Entity
;
import
org.apache.hadoop.hive.ql.hooks.HookContext
;
import
org.apache.hadoop.hive.ql.hooks.LineageInfo
;
import
org.apache.hadoop.hive.ql.hooks.LineageInfo
;
import
org.apache.hadoop.hive.ql.hooks.LineageInfo.BaseColumnInfo
;
import
org.apache.hadoop.hive.ql.hooks.LineageInfo.BaseColumnInfo
;
import
org.apache.hadoop.hive.ql.hooks.LineageInfo.Dependency
;
import
org.apache.hadoop.hive.ql.hooks.LineageInfo.Dependency
;
...
@@ -112,7 +111,17 @@ public class CreateHiveProcess extends BaseHiveEvent {
...
@@ -112,7 +111,17 @@ public class CreateHiveProcess extends BaseHiveEvent {
}
}
}
}
if
(!
inputs
.
isEmpty
()
||
!
outputs
.
isEmpty
())
{
boolean
skipProcess
=
inputs
.
isEmpty
()
&&
outputs
.
isEmpty
();
if
(!
skipProcess
)
{
if
(
inputs
.
isEmpty
()
&&
context
.
isSkippedInputEntity
())
{
skipProcess
=
true
;
}
else
if
(
outputs
.
isEmpty
()
&&
context
.
isSkippedOutputEntity
())
{
skipProcess
=
true
;
}
}
if
(!
skipProcess
)
{
AtlasEntity
process
=
getHiveProcessEntity
(
inputs
,
outputs
);
AtlasEntity
process
=
getHiveProcessEntity
(
inputs
,
outputs
);
ret
.
addEntity
(
process
);
ret
.
addEntity
(
process
);
...
...
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