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
e86fc944
Commit
e86fc944
authored
Apr 04, 2018
by
Peter Gergo Barna
Committed by
Madhan Neethiraj
Apr 05, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2530 trim query string before using it as name attribute for Hive process and column lineage
Signed-off-by:
Madhan Neethiraj
<
madhan@apache.org
>
parent
da8581e9
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
1 deletion
+26
-1
BaseHiveEvent.java
...java/org/apache/atlas/hive/hook/events/BaseHiveEvent.java
+1
-1
HiveMetastoreBridgeIT.java
...a/org/apache/atlas/hive/bridge/HiveMetastoreBridgeIT.java
+25
-0
No files found.
addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/events/BaseHiveEvent.java
View file @
e86fc944
...
@@ -512,7 +512,7 @@ public abstract class BaseHiveEvent {
...
@@ -512,7 +512,7 @@ public abstract class BaseHiveEvent {
String
queryStr
=
hookContext
.
getQueryPlan
().
getQueryStr
();
String
queryStr
=
hookContext
.
getQueryPlan
().
getQueryStr
();
if
(
queryStr
!=
null
)
{
if
(
queryStr
!=
null
)
{
queryStr
=
queryStr
.
toLowerCase
();
queryStr
=
queryStr
.
toLowerCase
()
.
trim
()
;
}
}
ret
.
setAttribute
(
ATTRIBUTE_QUALIFIED_NAME
,
getQualifiedName
(
inputs
,
outputs
));
ret
.
setAttribute
(
ATTRIBUTE_QUALIFIED_NAME
,
getQualifiedName
(
inputs
,
outputs
));
...
...
addons/hive-bridge/src/test/java/org/apache/atlas/hive/bridge/HiveMetastoreBridgeIT.java
View file @
e86fc944
...
@@ -93,4 +93,29 @@ public class HiveMetastoreBridgeIT extends HiveITBase {
...
@@ -93,4 +93,29 @@ public class HiveMetastoreBridgeIT extends HiveITBase {
assertEquals
(
outputs
.
size
(),
1
);
assertEquals
(
outputs
.
size
(),
1
);
assertEquals
(
outputs
.
get
(
0
).
getGuid
(),
tableId
);
assertEquals
(
outputs
.
get
(
0
).
getGuid
(),
tableId
);
}
}
@Test
public
void
testCreateTableHiveProcessNameAttribute
()
throws
Exception
{
//test if \n is trimmed from name attribute of the process entity
String
tableName
=
tableName
();
String
tableName2
=
tableName
();
String
name
=
String
.
format
(
"create table %s (id string)"
,
tableName2
);
String
query
=
String
.
format
(
"create table %s (id string);%n%n%s;"
,
tableName
,
name
);
runCommand
(
query
);
String
dbId
=
assertDatabaseIsRegistered
(
DEFAULT_DB
);
String
tableId
=
assertTableIsRegistered
(
DEFAULT_DB
,
tableName
);
String
tableId2
=
assertTableIsRegistered
(
DEFAULT_DB
,
tableName2
);
//verify lineage is created
String
processId
=
assertEntityIsRegistered
(
HiveDataTypes
.
HIVE_PROCESS
.
getName
(),
AtlasClient
.
REFERENCEABLE_ATTRIBUTE_NAME
,
getTableProcessQualifiedName
(
DEFAULT_DB
,
tableName
),
null
);
AtlasEntity
processsEntity
=
atlasClientV2
.
getEntityByGuid
(
processId
).
getEntity
();
String
processId2
=
assertEntityIsRegistered
(
HiveDataTypes
.
HIVE_PROCESS
.
getName
(),
AtlasClient
.
REFERENCEABLE_ATTRIBUTE_NAME
,
getTableProcessQualifiedName
(
DEFAULT_DB
,
tableName2
),
null
);
AtlasEntity
processsEntity2
=
atlasClientV2
.
getEntityByGuid
(
processId2
).
getEntity
();
assertEquals
(
processsEntity2
.
getAttribute
(
"name"
),
name
);
}
}
}
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