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
ba4df832
Commit
ba4df832
authored
Jan 31, 2018
by
Ashutosh Mestry
Committed by
apoorvnaik
Jan 31, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2430: Addressed close for nested queries.
Signed-off-by:
apoorvnaik
<
apoorvnaik@apache.org
>
parent
134d60fb
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
8 deletions
+17
-8
GremlinQueryComposer.java
...ain/java/org/apache/atlas/query/GremlinQueryComposer.java
+0
-0
IdentifierHelper.java
...rc/main/java/org/apache/atlas/query/IdentifierHelper.java
+8
-8
DSLQueriesTest.java
.../src/test/java/org/apache/atlas/query/DSLQueriesTest.java
+1
-0
GremlinQueryComposerTest.java
...java/org/apache/atlas/query/GremlinQueryComposerTest.java
+8
-0
No files found.
repository/src/main/java/org/apache/atlas/query/GremlinQueryComposer.java
View file @
ba4df832
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/query/IdentifierHelper.java
View file @
ba4df832
...
@@ -47,12 +47,12 @@ public class IdentifierHelper {
...
@@ -47,12 +47,12 @@ public class IdentifierHelper {
return
ret
;
return
ret
;
}
}
public
static
I
dentifierMetadata
create
(
GremlinQueryComposer
.
Context
context
,
public
static
I
nfo
create
(
GremlinQueryComposer
.
Context
context
,
org
.
apache
.
atlas
.
query
.
Lookup
lookup
,
org
.
apache
.
atlas
.
query
.
Lookup
lookup
,
String
identifier
)
{
String
identifier
)
{
I
dentifierMetadata
ia
=
new
IdentifierMetadata
(
identifier
);
I
nfo
idInfo
=
new
Info
(
identifier
);
i
a
.
update
(
lookup
,
context
);
i
dInfo
.
update
(
lookup
,
context
);
return
i
a
;
return
i
dInfo
;
}
}
private
static
String
extract
(
Pattern
p
,
String
s
)
{
private
static
String
extract
(
Pattern
p
,
String
s
)
{
...
@@ -106,7 +106,7 @@ public class IdentifierHelper {
...
@@ -106,7 +106,7 @@ public class IdentifierHelper {
}
}
public
static
class
I
dentifierMetadata
{
public
static
class
I
nfo
{
private
String
raw
;
private
String
raw
;
private
String
actual
;
private
String
actual
;
private
String
[]
parts
;
private
String
[]
parts
;
...
@@ -123,7 +123,7 @@ public class IdentifierHelper {
...
@@ -123,7 +123,7 @@ public class IdentifierHelper {
private
String
qualifiedName
;
private
String
qualifiedName
;
private
boolean
isDate
;
private
boolean
isDate
;
public
I
dentifierMetadata
(
String
s
)
{
public
I
nfo
(
String
s
)
{
this
.
raw
=
removeQuotes
(
s
);
this
.
raw
=
removeQuotes
(
s
);
this
.
actual
=
IdentifierHelper
.
get
(
raw
);
this
.
actual
=
IdentifierHelper
.
get
(
raw
);
}
}
...
...
repository/src/test/java/org/apache/atlas/query/DSLQueriesTest.java
View file @
ba4df832
...
@@ -214,6 +214,7 @@ public class DSLQueriesTest extends BasicTestSetup {
...
@@ -214,6 +214,7 @@ public class DSLQueriesTest extends BasicTestSetup {
{
"hive_db as db1 hive_table where (db1.name = \"Reporting\")"
,
0
},
{
"hive_db as db1 hive_table where (db1.name = \"Reporting\")"
,
0
},
{
"hive_table where (name = \"sales_fact\" and createTime > \"2014-01-01\" ) select name as _col_0, createTime as _col_1"
,
1
},
{
"hive_table where (name = \"sales_fact\" and createTime > \"2014-01-01\" ) select name as _col_0, createTime as _col_1"
,
1
},
{
"hive_table where (name = \"sales_fact\" and createTime >= \"2014-12-11T02:35:58.440Z\" ) select name as _col_0, createTime as _col_1"
,
1
},
{
"hive_table where (name = \"sales_fact\" and createTime >= \"2014-12-11T02:35:58.440Z\" ) select name as _col_0, createTime as _col_1"
,
1
},
{
"hive_table where (name = \"sales_fact\" and db.name = \"Sales\") select name, createTime"
,
1
},
{
"Dimension"
,
5
},
{
"Dimension"
,
5
},
{
"JdbcAccess"
,
2
},
{
"JdbcAccess"
,
2
},
{
"ETL"
,
5
},
{
"ETL"
,
5
},
...
...
repository/src/test/java/org/apache/atlas/query/GremlinQueryComposerTest.java
View file @
ba4df832
...
@@ -314,6 +314,14 @@ public class GremlinQueryComposerTest {
...
@@ -314,6 +314,14 @@ public class GremlinQueryComposerTest {
}
}
@Test
@Test
public
void
whereComplexAndSelect
()
{
String
exSel
=
"def f(r){ t=[['name']]; r.each({t.add([it.value('Table.name')])}); t.unique(); }"
;
String
exMain
=
"g.V().has('__typeName', 'Table').and(__.out('__Table.db').has('DB.name', eq(\"Reporting\")).dedup().in('__Table.db'),__.has('Table.name', eq(\"sales_fact\"))).limit(local, 25).limit(25).toList()"
;
verify
(
"Table where db.name = \"Reporting\" and name =\"sales_fact\" select name"
,
getExpected
(
exSel
,
exMain
));
verify
(
"Table where db.name = \"Reporting\" and name =\"sales_fact\""
,
exMain
);
}
@Test
public
void
invalidQueries
()
{
public
void
invalidQueries
()
{
verify
(
"hdfs_path like h1"
,
""
);
verify
(
"hdfs_path like h1"
,
""
);
}
}
...
...
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