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
c6ee2779
Commit
c6ee2779
authored
5 years ago
by
Ashutosh Mestry
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-3489: Import API: Deleted entity handling improvement.
parent
8f807351
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
1 deletion
+36
-1
AtlasEntityStoreV2.java
...e/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java
+1
-1
ImportServiceTest.java
...org/apache/atlas/repository/impexp/ImportServiceTest.java
+35
-0
dup_col_deleted.zip
repository/src/test/resources/dup_col_deleted.zip
+0
-0
No files found.
repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java
View file @
c6ee2779
...
...
@@ -1047,7 +1047,7 @@ public class AtlasEntityStoreV2 implements AtlasEntityStore {
private
AtlasObjectId
getAtlasObjectId
(
AtlasEntity
entity
)
{
AtlasObjectId
ret
=
entityRetriever
.
toAtlasObjectId
(
entity
);
if
(
ret
!=
null
&&
MapUtils
.
isNotEmpty
(
ret
.
getUniqueAttributes
()))
{
if
(
ret
!=
null
&&
!
RequestContext
.
get
().
isImportInProgress
()
&&
MapUtils
.
isNotEmpty
(
ret
.
getUniqueAttributes
()))
{
// if uniqueAttributes is not empty, reset guid to null.
ret
.
setGuid
(
null
);
}
...
...
This diff is collapsed.
Click to expand it.
repository/src/test/java/org/apache/atlas/repository/impexp/ImportServiceTest.java
View file @
c6ee2779
...
...
@@ -29,6 +29,7 @@ import org.apache.atlas.model.impexp.AtlasImportRequest;
import
org.apache.atlas.model.instance.AtlasEntity
;
import
org.apache.atlas.model.instance.AtlasEntityHeader
;
import
org.apache.atlas.model.instance.AtlasObjectId
;
import
org.apache.atlas.model.instance.AtlasRelationship
;
import
org.apache.atlas.model.instance.AtlasRelatedObjectId
;
import
org.apache.atlas.model.instance.EntityMutationResponse
;
import
org.apache.atlas.repository.Constants
;
...
...
@@ -130,6 +131,11 @@ public class ImportServiceTest extends ExportImportTestBase {
return
getZipSource
(
"sales-v1-full.zip"
);
}
@DataProvider
(
name
=
"dup_col_data"
)
public
static
Object
[][]
getDataForDuplicateColumn
(
ITestContext
context
)
throws
IOException
,
AtlasBaseException
{
return
getZipSource
(
"dup_col_deleted.zip"
);
}
@Test
(
dataProvider
=
"sales"
)
public
void
importDB1
(
InputStream
inputStream
)
throws
AtlasBaseException
,
IOException
{
loadBaseModel
();
...
...
@@ -495,6 +501,35 @@ public class ImportServiceTest extends ExportImportTestBase {
assertFalse
(
importService
.
checkHiveTableIncrementalSkipLineage
(
importRequest
,
exportRequest
));
}
@Test
(
dataProvider
=
"dup_col_data"
)
public
void
testImportDuplicateColumnsWithDifferentStatus
(
InputStream
inputStream
)
throws
IOException
,
AtlasBaseException
{
loadBaseModel
();
loadFsModel
();
loadHiveModel
();
runImportWithNoParameters
(
importService
,
inputStream
);
AtlasEntity
.
AtlasEntityWithExtInfo
atlasEntityWithExtInfo
=
entityStore
.
getById
(
"e18e15de-1810-4724-881a-5cb6b2160077"
);
assertNotNull
(
atlasEntityWithExtInfo
);
AtlasEntity
atlasEntity
=
atlasEntityWithExtInfo
.
getEntity
();
assertNotNull
(
atlasEntity
);
List
<
AtlasRelatedObjectId
>
columns
=
(
List
<
AtlasRelatedObjectId
>)
atlasEntity
.
getRelationshipAttribute
(
"columns"
);
assertEquals
(
columns
.
size
(),
4
);
for
(
AtlasRelatedObjectId
id
:
columns
){
if
(
id
.
getGuid
().
equals
(
"a3de3e3b-4bcd-4e57-a988-1101a2360200"
)){
assertEquals
(
id
.
getEntityStatus
(),
AtlasEntity
.
Status
.
DELETED
);
assertEquals
(
id
.
getRelationshipStatus
(),
AtlasRelationship
.
Status
.
DELETED
);
}
if
(
id
.
getGuid
().
equals
(
"f7fa3768-f3de-48a8-92a5-38ec4070152c"
))
{
assertEquals
(
id
.
getEntityStatus
(),
AtlasEntity
.
Status
.
ACTIVE
);
assertEquals
(
id
.
getRelationshipStatus
(),
AtlasRelationship
.
Status
.
ACTIVE
);
}
}
}
private
AtlasImportRequest
getImportRequest
(
String
replicatedFrom
){
AtlasImportRequest
importRequest
=
getDefaultImportRequest
();
...
...
This diff is collapsed.
Click to expand it.
repository/src/test/resources/dup_col_deleted.zip
0 → 100644
View file @
c6ee2779
File added
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