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
0a876f93
Commit
0a876f93
authored
Jan 16, 2018
by
apoorvnaik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2342: Remove limit restriction on min,max,sum,count
parent
76fbe643
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
27 deletions
+30
-27
EntityDiscoveryService.java
...va/org/apache/atlas/discovery/EntityDiscoveryService.java
+1
-3
GremlinClause.java
...y/src/main/java/org/apache/atlas/query/GremlinClause.java
+5
-3
GremlinQueryComposer.java
...ain/java/org/apache/atlas/query/GremlinQueryComposer.java
+0
-0
SelectClauseComposer.java
...ain/java/org/apache/atlas/query/SelectClauseComposer.java
+5
-1
DSLQueriesTest.java
.../src/test/java/org/apache/atlas/query/DSLQueriesTest.java
+10
-10
GremlinQueryComposerTest.java
...java/org/apache/atlas/query/GremlinQueryComposerTest.java
+9
-10
No files found.
repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java
View file @
0a876f93
...
...
@@ -734,9 +734,7 @@ public class EntityDiscoveryService implements AtlasDiscoveryService {
Object
vals
=
map
.
get
(
key
);
if
(
vals
instanceof
List
)
{
List
l
=
(
List
)
vals
;
for
(
Object
o
:
l
)
{
list
.
add
(
o
);
}
list
.
addAll
(
l
);
}
}
...
...
repository/src/main/java/org/apache/atlas/query/GremlinClause.java
View file @
0a876f93
...
...
@@ -61,10 +61,12 @@ enum GremlinClause {
INLINE_MIN
(
"r.min({it.value('%s')}).value('%s')"
),
INLINE_GET_PROPERTY
(
"it.value('%s')"
),
INLINE_TRANSFORM_CALL
(
"f(%s)"
),
INLINE_DEFAULT_SORT
(
".sort{a,b -> a[0] <=> b[0]}"
),
INLINE_DEFAULT_SORT
(
".sort()"
),
INLINE_SORT_DESC
(
".sort{a,b -> b <=> a}"
),
INLINE_DEFAULT_TUPLE_SORT
(
".sort{a,b -> a[0] <=> b[0]}"
),
// idx of the tuple field to be sorted on
INLINE_SORT_ASC
(
".sort{a,b -> a[%s] <=> b[%s]}"
),
INLINE_SORT_DESC
(
".sort{a,b -> b[%s] <=> a[%s]}"
),
INLINE_
TUPLE_
SORT_ASC
(
".sort{a,b -> a[%s] <=> b[%s]}"
),
INLINE_
TUPLE_
SORT_DESC
(
".sort{a,b -> b[%s] <=> a[%s]}"
),
V
(
"V()"
),
VALUE_MAP
(
"valueMap(%s)"
);
...
...
repository/src/main/java/org/apache/atlas/query/GremlinQueryComposer.java
View file @
0a876f93
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/query/SelectClauseComposer.java
View file @
0a876f93
...
...
@@ -108,7 +108,11 @@ class SelectClauseComposer {
}
public
boolean
onlyAggregators
()
{
return
aggCount
>
0
&&
aggCount
==
items
.
length
;
return
hasAggregators
()
&&
aggCount
==
items
.
length
;
}
public
boolean
hasAggregators
()
{
return
aggCount
>
0
;
}
public
String
getLabelHeader
()
{
...
...
repository/src/test/java/org/apache/atlas/query/DSLQueriesTest.java
View file @
0a876f93
...
...
@@ -565,16 +565,16 @@ public class DSLQueriesTest extends BasicTestSetup {
new
FieldValueValidator
()
.
withFieldNames
(
"'count'"
,
"'sum'"
)
.
withExpectedValues
(
4
,
86
)
},
{
"from hive_db groupby (owner) select min(name) orderby name limit 2 "
,
new
FieldValueValidator
()
.
withFieldNames
(
"min(name)"
)
.
withExpectedValues
(
"Logging"
)
.
withExpectedValues
(
"Reporting"
)
},
{
"from hive_db groupby (owner) select min(name) orderby name desc limit 2 "
,
new
FieldValueValidator
()
.
withFieldNames
(
"min(name)"
)
.
withExpectedValues
(
"Reporting"
)
.
withExpectedValues
(
"Sales"
)
}
//
{ "from hive_db groupby (owner) select min(name) orderby name limit 2 ",
//
new FieldValueValidator()
//
.withFieldNames("min(name)")
//
.withExpectedValues("Logging")
//
.withExpectedValues("Reporting") },
//
{ "from hive_db groupby (owner) select min(name) orderby name desc limit 2 ",
//
new FieldValueValidator()
//
.withFieldNames("min(name)")
//
.withExpectedValues("Reporting")
//
.withExpectedValues("Sales") }
};
}
...
...
repository/src/test/java/org/apache/atlas/query/GremlinQueryComposerTest.java
View file @
0a876f93
...
...
@@ -31,7 +31,7 @@ import org.testng.annotations.Test;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
when
;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
static
org
.
testng
.
Assert
.
assertFalse
;
import
static
org
.
testng
.
Assert
.
fail
;
public
class
GremlinQueryComposerTest
{
@Test
...
...
@@ -102,7 +102,7 @@ public class GremlinQueryComposerTest {
public
void
groupByMin
()
{
verify
(
"from DB groupby (owner) select min(name) orderby name limit 2"
,
"def f(l){ t=[['min(name)']]; l.get(0).each({k,r -> L:{ def min=r.min({it.value('DB.name')}).value('DB.name'); t.add([min]); } }); t; }; "
+
"f(g.V().has('__typeName', 'DB').group().by('DB.owner').
limit(local, 2).limit(2).
toList())"
);
"f(g.V().has('__typeName', 'DB').group().by('DB.owner').toList())"
);
}
@Test
...
...
@@ -192,13 +192,13 @@ public class GremlinQueryComposerTest {
@Test
public
void
countMinMax
()
{
verify
(
"from DB groupby (owner) select count()"
,
"def f(l){ t=[['count()']]; l.get(0).each({k,r -> L:{ def count=r.size(); t.add([count]); } }); t; }; f(g.V().has('__typeName', 'DB').group().by('DB.owner').
limit(local, 25).limit(25).
toList())"
);
"def f(l){ t=[['count()']]; l.get(0).each({k,r -> L:{ def count=r.size(); t.add([count]); } }); t; }; f(g.V().has('__typeName', 'DB').group().by('DB.owner').toList())"
);
verify
(
"from DB groupby (owner) select max(name)"
,
"def f(l){ t=[['max(name)']]; l.get(0).each({k,r -> L:{ def max=r.max({it.value('DB.name')}).value('DB.name'); t.add([max]); } }); t; }; f(g.V().has('__typeName', 'DB').group().by('DB.owner').
limit(local, 25).limit(25).
toList())"
);
"def f(l){ t=[['max(name)']]; l.get(0).each({k,r -> L:{ def max=r.max({it.value('DB.name')}).value('DB.name'); t.add([max]); } }); t; }; f(g.V().has('__typeName', 'DB').group().by('DB.owner').toList())"
);
verify
(
"from DB groupby (owner) select min(name)"
,
"def f(l){ t=[['min(name)']]; l.get(0).each({k,r -> L:{ def min=r.min({it.value('DB.name')}).value('DB.name'); t.add([min]); } }); t; }; f(g.V().has('__typeName', 'DB').group().by('DB.owner').
limit(local, 25).limit(25).
toList())"
);
"def f(l){ t=[['min(name)']]; l.get(0).each({k,r -> L:{ def min=r.min({it.value('DB.name')}).value('DB.name'); t.add([min]); } }); t; }; f(g.V().has('__typeName', 'DB').group().by('DB.owner').toList())"
);
verify
(
"from Table select sum(createTime)"
,
"def f(r){ t=[['sum(createTime)']]; def sum=r.sum({it.value('Table.createTime')}); t.add([sum]); t;}; f(g.V().has('__typeName', 'Table').
limit(local, 25).limit(25).
toList())"
);
"def f(r){ t=[['sum(createTime)']]; def sum=r.sum({it.value('Table.createTime')}); t.add([sum]); t;}; f(g.V().has('__typeName', 'Table').toList())"
);
}
@Test
...
...
@@ -352,12 +352,11 @@ public class GremlinQueryComposerTest {
}
private
AtlasDSLParser
.
QueryContext
getParsedQuery
(
String
query
)
{
AtlasDSL
.
Parser
parser
=
new
AtlasDSL
.
Parser
();
AtlasDSLParser
.
QueryContext
queryContext
=
null
;
try
{
queryContext
=
p
arser
.
parse
(
query
);
queryContext
=
AtlasDSL
.
P
arser
.
parse
(
query
);
}
catch
(
AtlasBaseException
e
)
{
assertFalse
(
e
!=
null
,
e
.
getMessage
());
fail
(
e
.
getMessage
());
}
return
queryContext
;
}
...
...
@@ -381,7 +380,7 @@ public class GremlinQueryComposerTest {
private
static
class
TestLookup
implements
org
.
apache
.
atlas
.
query
.
Lookup
{
AtlasTypeRegistry
registry
;
public
TestLookup
(
AtlasTypeRegistry
typeRegistry
)
{
TestLookup
(
AtlasTypeRegistry
typeRegistry
)
{
this
.
registry
=
typeRegistry
;
}
...
...
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