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
0c1d599d
Commit
0c1d599d
authored
8 years ago
by
Madhan Neethiraj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-1598: fix for NPE in Hive hook while processing create-table
parent
08944c54
master
No related merge requests found
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
12 deletions
+20
-12
HiveHook.java
...ge/src/main/java/org/apache/atlas/hive/hook/HiveHook.java
+2
-2
AtlasEntityStoreV1.java
...e/atlas/repository/store/graph/v1/AtlasEntityStoreV1.java
+18
-10
No files found.
addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/HiveHook.java
View file @
0c1d599d
...
@@ -248,7 +248,7 @@ public class HiveHook extends AtlasHook implements ExecuteWithHookContext {
...
@@ -248,7 +248,7 @@ public class HiveHook extends AtlasHook implements ExecuteWithHookContext {
case
CREATETABLE:
case
CREATETABLE:
LinkedHashMap
<
Type
,
Referenceable
>
tablesCreated
=
handleEventOutputs
(
dgiBridge
,
event
,
Type
.
TABLE
);
LinkedHashMap
<
Type
,
Referenceable
>
tablesCreated
=
handleEventOutputs
(
dgiBridge
,
event
,
Type
.
TABLE
);
if
(
tablesCreated
.
size
()
>
0
)
{
if
(
tablesCreated
!=
null
&&
tablesCreated
.
size
()
>
0
)
{
handleExternalTables
(
dgiBridge
,
event
,
tablesCreated
);
handleExternalTables
(
dgiBridge
,
event
,
tablesCreated
);
}
}
break
;
break
;
...
@@ -730,7 +730,7 @@ public class HiveHook extends AtlasHook implements ExecuteWithHookContext {
...
@@ -730,7 +730,7 @@ public class HiveHook extends AtlasHook implements ExecuteWithHookContext {
final
String
location
=
lower
(
hiveTable
.
getDataLocation
().
toString
());
final
String
location
=
lower
(
hiveTable
.
getDataLocation
().
toString
());
final
ReadEntity
dfsEntity
=
new
ReadEntity
();
final
ReadEntity
dfsEntity
=
new
ReadEntity
();
dfsEntity
.
setTyp
(
Type
.
DFS_DIR
);
dfsEntity
.
setTyp
(
Type
.
DFS_DIR
);
dfsEntity
.
set
Name
(
location
);
dfsEntity
.
set
D
(
new
Path
(
location
)
);
SortedMap
<
ReadEntity
,
Referenceable
>
hiveInputsMap
=
new
TreeMap
<
ReadEntity
,
Referenceable
>(
entityComparator
)
{{
SortedMap
<
ReadEntity
,
Referenceable
>
hiveInputsMap
=
new
TreeMap
<
ReadEntity
,
Referenceable
>(
entityComparator
)
{{
put
(
dfsEntity
,
dgiBridge
.
fillHDFSDataSet
(
location
));
put
(
dfsEntity
,
dgiBridge
.
fillHDFSDataSet
(
location
));
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1.java
View file @
0c1d599d
...
@@ -21,7 +21,6 @@ package org.apache.atlas.repository.store.graph.v1;
...
@@ -21,7 +21,6 @@ package org.apache.atlas.repository.store.graph.v1;
import
com.google.inject.Inject
;
import
com.google.inject.Inject
;
import
com.google.inject.Singleton
;
import
com.google.inject.Singleton
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.GraphTransaction
;
import
org.apache.atlas.GraphTransaction
;
import
org.apache.atlas.RequestContextV1
;
import
org.apache.atlas.RequestContextV1
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.exception.AtlasBaseException
;
...
@@ -38,12 +37,10 @@ import org.apache.atlas.repository.store.graph.AtlasEntityStore;
...
@@ -38,12 +37,10 @@ import org.apache.atlas.repository.store.graph.AtlasEntityStore;
import
org.apache.atlas.repository.store.graph.EntityGraphDiscovery
;
import
org.apache.atlas.repository.store.graph.EntityGraphDiscovery
;
import
org.apache.atlas.repository.store.graph.EntityGraphDiscoveryContext
;
import
org.apache.atlas.repository.store.graph.EntityGraphDiscoveryContext
;
import
org.apache.atlas.type.AtlasEntityType
;
import
org.apache.atlas.type.AtlasEntityType
;
import
org.apache.atlas.type.AtlasStructType
;
import
org.apache.atlas.type.AtlasStructType.AtlasAttribute
;
import
org.apache.atlas.type.AtlasStructType.AtlasAttribute
;
import
org.apache.atlas.type.AtlasType
;
import
org.apache.atlas.type.AtlasType
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.atlas.type.AtlasTypeUtil
;
import
org.apache.atlas.type.AtlasTypeUtil
;
import
org.apache.atlas.typesystem.persistence.Id
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
@@ -326,17 +323,18 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
...
@@ -326,17 +323,18 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
// Retrieve vertices for requested guids.
// Retrieve vertices for requested guids.
AtlasVertex
vertex
=
AtlasGraphUtilsV1
.
findByGuid
(
guid
);
AtlasVertex
vertex
=
AtlasGraphUtilsV1
.
findByGuid
(
guid
);
Collection
<
AtlasVertex
>
deletionCandidates
=
new
ArrayList
<>();
if
(
vertex
!=
null
)
{
deletionCandidates
.
add
(
vertex
);
}
else
{
if
(
LOG
.
isDebugEnabled
())
{
if
(
LOG
.
isDebugEnabled
())
{
if
(
vertex
==
null
)
{
// Entity does not exist - treat as non-error, since the caller
// Entity does not exist - treat as non-error, since the caller
// wanted to delete the entity and it's already gone.
// wanted to delete the entity and it's already gone.
LOG
.
debug
(
"Deletion request ignored for non-existent entity with guid "
+
guid
);
LOG
.
debug
(
"Deletion request ignored for non-existent entity with guid "
+
guid
);
}
}
}
}
Collection
<
AtlasVertex
>
deletionCandidates
=
new
ArrayList
<>();
deletionCandidates
.
add
(
vertex
);
EntityMutationResponse
ret
=
deleteVertices
(
deletionCandidates
);
EntityMutationResponse
ret
=
deleteVertices
(
deletionCandidates
);
// Notify the change listeners
// Notify the change listeners
...
@@ -357,15 +355,16 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
...
@@ -357,15 +355,16 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
for
(
String
guid
:
guids
)
{
for
(
String
guid
:
guids
)
{
// Retrieve vertices for requested guids.
// Retrieve vertices for requested guids.
AtlasVertex
vertex
=
AtlasGraphUtilsV1
.
findByGuid
(
guid
);
AtlasVertex
vertex
=
AtlasGraphUtilsV1
.
findByGuid
(
guid
);
if
(
vertex
!=
null
)
{
deletionCandidates
.
add
(
vertex
);
}
else
{
if
(
LOG
.
isDebugEnabled
())
{
if
(
LOG
.
isDebugEnabled
())
{
if
(
vertex
==
null
)
{
// Entity does not exist - treat as non-error, since the caller
// Entity does not exist - treat as non-error, since the caller
// wanted to delete the entity and it's already gone.
// wanted to delete the entity and it's already gone.
LOG
.
debug
(
"Deletion request ignored for non-existent entity with guid "
+
guid
);
LOG
.
debug
(
"Deletion request ignored for non-existent entity with guid "
+
guid
);
}
}
}
}
deletionCandidates
.
add
(
vertex
);
}
}
if
(
deletionCandidates
.
isEmpty
())
{
if
(
deletionCandidates
.
isEmpty
())
{
...
@@ -391,7 +390,16 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
...
@@ -391,7 +390,16 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
final
AtlasVertex
vertex
=
AtlasGraphUtilsV1
.
findByUniqueAttributes
(
entityType
,
uniqAttributes
);
final
AtlasVertex
vertex
=
AtlasGraphUtilsV1
.
findByUniqueAttributes
(
entityType
,
uniqAttributes
);
Collection
<
AtlasVertex
>
deletionCandidates
=
new
ArrayList
<>();
Collection
<
AtlasVertex
>
deletionCandidates
=
new
ArrayList
<>();
if
(
vertex
!=
null
)
{
deletionCandidates
.
add
(
vertex
);
deletionCandidates
.
add
(
vertex
);
}
else
{
if
(
LOG
.
isDebugEnabled
())
{
// Entity does not exist - treat as non-error, since the caller
// wanted to delete the entity and it's already gone.
LOG
.
debug
(
"Deletion request ignored for non-existent entity with uniqueAttributes "
+
uniqAttributes
);
}
}
EntityMutationResponse
ret
=
deleteVertices
(
deletionCandidates
);
EntityMutationResponse
ret
=
deleteVertices
(
deletionCandidates
);
...
...
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