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
57fbb9ce
Commit
57fbb9ce
authored
Sep 29, 2017
by
apoorvnaik
Committed by
Sarath Subramanian
Sep 29, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2184: IS_NULL and NOT_NULL operator support
Signed-off-by:
Sarath Subramanian
<
ssubramanian@hortonworks.com
>
parent
f18555cd
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
5 deletions
+22
-5
SearchParameters.java
...va/org/apache/atlas/model/discovery/SearchParameters.java
+4
-2
SearchProcessor.java
...main/java/org/apache/atlas/discovery/SearchProcessor.java
+18
-3
SearchPredicateUtil.java
.../main/java/org/apache/atlas/util/SearchPredicateUtil.java
+0
-0
No files found.
intg/src/main/java/org/apache/atlas/model/discovery/SearchParameters.java
View file @
57fbb9ce
...
...
@@ -346,10 +346,12 @@ public class SearchParameters implements Serializable {
IN
(
new
String
[]{
"in"
,
"IN"
}),
LIKE
(
new
String
[]{
"like"
,
"LIKE"
}),
STARTS_WITH
(
new
String
[]{
"startsWith"
,
"STARTSWITH"
,
"begins_with"
,
"BEGINS_WITH"
}),
ENDS_WITH
(
new
String
[]{
"endsWith"
,
"ENDSWITH"
,
"ends_with"
,
"
BEGIN
S_WITH"
}),
ENDS_WITH
(
new
String
[]{
"endsWith"
,
"ENDSWITH"
,
"ends_with"
,
"
END
S_WITH"
}),
CONTAINS
(
new
String
[]{
"contains"
,
"CONTAINS"
}),
CONTAINS_ANY
(
new
String
[]{
"containsAny"
,
"CONTAINSANY"
,
"contains_any"
,
"CONTAINS_ANY"
}),
CONTAINS_ALL
(
new
String
[]{
"containsAll"
,
"CONTAINSALL"
,
"contains_all"
,
"CONTAINS_ALL"
})
CONTAINS_ALL
(
new
String
[]{
"containsAll"
,
"CONTAINSALL"
,
"contains_all"
,
"CONTAINS_ALL"
}),
IS_NULL
(
new
String
[]{
"isNull"
,
"ISNULL"
,
"is_null"
,
"IS_NULL"
}),
NOT_NULL
(
new
String
[]{
"notNull"
,
"NOTNULL"
,
"not_null"
,
"NOT_NULL"
}),
;
static
final
Map
<
String
,
Operator
>
operatorsMap
=
new
HashMap
<>();
...
...
repository/src/main/java/org/apache/atlas/discovery/SearchProcessor.java
View file @
57fbb9ce
...
...
@@ -103,6 +103,14 @@ public abstract class SearchProcessor {
OPERATOR_MAP
.
put
(
SearchParameters
.
Operator
.
CONTAINS
,
"v.\"%s\": (*%s*)"
);
OPERATOR_PREDICATE_MAP
.
put
(
SearchParameters
.
Operator
.
CONTAINS
,
getContainsPredicateGenerator
());
// TODO: Add contains any, contains all mappings here
OPERATOR_MAP
.
put
(
SearchParameters
.
Operator
.
IS_NULL
,
"(*:* NOT v.\"%s\":[* TO *])"
);
OPERATOR_PREDICATE_MAP
.
put
(
SearchParameters
.
Operator
.
IS_NULL
,
getIsNullPredicateGenerator
());
OPERATOR_MAP
.
put
(
SearchParameters
.
Operator
.
NOT_NULL
,
"v.\"%s\":[* TO *]"
);
OPERATOR_PREDICATE_MAP
.
put
(
SearchParameters
.
Operator
.
NOT_NULL
,
getNotNullPredicateGenerator
());
}
protected
final
SearchContext
context
;
...
...
@@ -428,9 +436,10 @@ public abstract class SearchProcessor {
try
{
if
(
OPERATOR_MAP
.
get
(
op
)
!=
null
)
{
String
qualifiedName
=
type
.
getQualifiedAttributeName
(
attrName
);
String
qualifiedName
=
type
.
getQualifiedAttributeName
(
attrName
);
String
escapeIndexQueryValue
=
AtlasAttribute
.
escapeIndexQueryValue
(
attrVal
);
ret
=
String
.
format
(
OPERATOR_MAP
.
get
(
op
),
qualifiedName
,
AtlasStructType
.
AtlasAttribute
.
escapeIndexQueryValue
(
attrVal
)
);
ret
=
String
.
format
(
OPERATOR_MAP
.
get
(
op
),
qualifiedName
,
escapeIndexQueryValue
);
}
}
catch
(
AtlasBaseException
ex
)
{
LOG
.
warn
(
ex
.
getMessage
());
...
...
@@ -572,7 +581,13 @@ public abstract class SearchProcessor {
case
ENDS_WITH:
query
.
has
(
qualifiedName
,
AtlasGraphQuery
.
MatchingOperator
.
REGEX
,
getSuffixRegex
(
attrValue
));
break
;
case
IN:
case
IS_NULL:
query
.
has
(
qualifiedName
,
AtlasGraphQuery
.
ComparisionOperator
.
EQUAL
,
null
);
break
;
case
NOT_NULL:
query
.
has
(
qualifiedName
,
AtlasGraphQuery
.
ComparisionOperator
.
NOT_EQUAL
,
null
);
break
;
default
:
LOG
.
warn
(
"{}: unsupported operator. Ignored"
,
operator
);
break
;
}
...
...
repository/src/main/java/org/apache/atlas/util/SearchPredicateUtil.java
View file @
57fbb9ce
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