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
810aceb5
Commit
810aceb5
authored
7 years ago
by
Peter Gergő Barna
Committed by
Madhan Neethiraj
7 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2611: fix for NPE in Hive hook
Signed-off-by:
Madhan Neethiraj
<
madhan@apache.org
>
parent
3f7c5811
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
1 deletion
+30
-1
CreateHiveProcess.java
.../org/apache/atlas/hive/hook/events/CreateHiveProcess.java
+30
-1
No files found.
addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/events/CreateHiveProcess.java
View file @
810aceb5
...
@@ -36,7 +36,10 @@ import org.apache.hadoop.hive.ql.plan.HiveOperation;
...
@@ -36,7 +36,10 @@ import org.apache.hadoop.hive.ql.plan.HiveOperation;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.Method
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.List
;
...
@@ -141,7 +144,7 @@ public class CreateHiveProcess extends BaseHiveEvent {
...
@@ -141,7 +144,7 @@ public class CreateHiveProcess extends BaseHiveEvent {
List
<
AtlasEntity
>
inputColumns
=
new
ArrayList
<>();
List
<
AtlasEntity
>
inputColumns
=
new
ArrayList
<>();
for
(
BaseColumnInfo
baseColumn
:
entry
.
getValue
().
getBaseCols
(
))
{
for
(
BaseColumnInfo
baseColumn
:
getBaseCols
(
entry
.
getValue
()
))
{
String
inputColName
=
getQualifiedName
(
baseColumn
);
String
inputColName
=
getQualifiedName
(
baseColumn
);
AtlasEntity
inputColumn
=
context
.
getEntity
(
inputColName
);
AtlasEntity
inputColumn
=
context
.
getEntity
(
inputColName
);
...
@@ -172,6 +175,32 @@ public class CreateHiveProcess extends BaseHiveEvent {
...
@@ -172,6 +175,32 @@ public class CreateHiveProcess extends BaseHiveEvent {
}
}
}
}
private
Collection
<
BaseColumnInfo
>
getBaseCols
(
Dependency
lInfoDep
)
{
Collection
<
BaseColumnInfo
>
ret
=
Collections
.
emptyList
();
if
(
lInfoDep
!=
null
)
{
try
{
Method
getBaseColsMethod
=
lInfoDep
.
getClass
().
getMethod
(
"getBaseCols"
);
Object
retGetBaseCols
=
getBaseColsMethod
.
invoke
(
lInfoDep
);
if
(
retGetBaseCols
!=
null
)
{
if
(
retGetBaseCols
instanceof
Collection
)
{
ret
=
(
Collection
)
retGetBaseCols
;
}
else
{
LOG
.
warn
(
"{}: unexpected return type from LineageInfo.Dependency.getBaseCols(), expected type {}"
,
retGetBaseCols
.
getClass
().
getName
(),
"Collection"
);
}
}
}
catch
(
NoSuchMethodException
|
InvocationTargetException
|
IllegalAccessException
ex
)
{
LOG
.
warn
(
"getBaseCols()"
,
ex
);
}
}
return
ret
;
}
private
boolean
skipProcess
()
{
private
boolean
skipProcess
()
{
Set
<
ReadEntity
>
inputs
=
getHiveContext
().
getInputs
();
Set
<
ReadEntity
>
inputs
=
getHiveContext
().
getInputs
();
Set
<
WriteEntity
>
outputs
=
getHiveContext
().
getOutputs
();
Set
<
WriteEntity
>
outputs
=
getHiveContext
().
getOutputs
();
...
...
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