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
48a088fc
Commit
48a088fc
authored
Mar 11, 2015
by
Harish Butani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BUG-32980 add is operator in Query DSL
parent
2f231bef
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
2 deletions
+9
-2
Expressions.scala
.../scala/org/apache/hadoop/metadata/query/Expressions.scala
+1
-1
QueryParser.scala
.../scala/org/apache/hadoop/metadata/query/QueryParser.scala
+2
-1
ParserTest.scala
...t/scala/org/apache/hadoop/metadata/query/ParserTest.scala
+6
-0
No files found.
repository/src/main/scala/org/apache/hadoop/metadata/query/Expressions.scala
View file @
48a088fc
...
@@ -523,7 +523,7 @@ object Expressions {
...
@@ -523,7 +523,7 @@ object Expressions {
case
class
isTraitUnaryExpression
(
traitName
:
String
,
child
:
Expression
)
case
class
isTraitUnaryExpression
(
traitName
:
String
,
child
:
Expression
)
extends
Expression
with
UnaryNode
{
extends
Expression
with
UnaryNode
{
// validate TraitName
// validate TraitName
typSystem
.
getDataType
(
classOf
[
Class
Type
],
traitName
)
typSystem
.
getDataType
(
classOf
[
Trait
Type
],
traitName
)
lazy
val
dataType
=
{
lazy
val
dataType
=
{
if
(!
resolved
)
{
if
(!
resolved
)
{
throw
new
UnresolvedException
(
this
,
throw
new
UnresolvedException
(
this
,
...
...
repository/src/main/scala/org/apache/hadoop/metadata/query/QueryParser.scala
View file @
48a088fc
...
@@ -57,6 +57,7 @@ trait QueryKeywords {
...
@@ -57,6 +57,7 @@ trait QueryKeywords {
protected
val
GROUPBY
=
Keyword
(
"groupby"
)
protected
val
GROUPBY
=
Keyword
(
"groupby"
)
protected
val
LOOP
=
Keyword
(
"loop"
)
protected
val
LOOP
=
Keyword
(
"loop"
)
protected
val
ISA
=
Keyword
(
"isa"
)
protected
val
ISA
=
Keyword
(
"isa"
)
protected
val
IS
=
Keyword
(
"is"
)
protected
val
HAS
=
Keyword
(
"has"
)
protected
val
HAS
=
Keyword
(
"has"
)
protected
val
AS
=
Keyword
(
"as"
)
protected
val
AS
=
Keyword
(
"as"
)
protected
val
TIMES
=
Keyword
(
"times"
)
protected
val
TIMES
=
Keyword
(
"times"
)
...
@@ -195,7 +196,7 @@ class QueryParser extends StandardTokenParsers with QueryKeywords with Expressio
...
@@ -195,7 +196,7 @@ class QueryParser extends StandardTokenParsers with QueryKeywords with Expressio
def
compE
=
def
compE
=
arithE
~
(
LT
|
LTE
|
EQ
|
NEQ
|
GT
|
GTE
)
~
arithE
^^
{
case
l
~
op
~
r
=>
l
.
compareOp
(
op
)(
r
)}
|
arithE
~
(
LT
|
LTE
|
EQ
|
NEQ
|
GT
|
GTE
)
~
arithE
^^
{
case
l
~
op
~
r
=>
l
.
compareOp
(
op
)(
r
)}
|
arithE
~
ISA
~
ident
^^
{
case
l
~
i
~
t
=>
l
.
isTrait
(
t
)}
|
arithE
~
(
ISA
|
IS
)
~
ident
^^
{
case
l
~
i
~
t
=>
l
.
isTrait
(
t
)}
|
arithE
~
HAS
~
ident
^^
{
case
l
~
i
~
f
=>
l
.
hasField
(
f
)}
|
arithE
~
HAS
~
ident
^^
{
case
l
~
i
~
f
=>
l
.
hasField
(
f
)}
|
arithE
arithE
...
...
repository/src/test/scala/org/apache/hadoop/metadata/query/ParserTest.scala
View file @
48a088fc
...
@@ -57,6 +57,12 @@ class ParserTest extends BaseTest {
...
@@ -57,6 +57,12 @@ class ParserTest extends BaseTest {
println
(
p
(
"DB name = \"Reporting\""
).
right
.
get
.
toString
)
println
(
p
(
"DB name = \"Reporting\""
).
right
.
get
.
toString
)
}
}
@Test
def
testIsTrait
:
Unit
=
{
val
p
=
new
QueryParser
println
(
p
(
"Table isa Dimension"
).
right
.
get
.
toString
)
println
(
p
(
"Table is Dimension"
).
right
.
get
.
toString
)
}
@Test
def
test4
:
Unit
=
{
@Test
def
test4
:
Unit
=
{
val
p
=
new
QueryParser
val
p
=
new
QueryParser
println
(
p
(
"DB where (name = \"Reporting\") select name as _col_0, (createTime + 1) as _col_1"
).
right
.
get
.
toString
)
println
(
p
(
"DB where (name = \"Reporting\") select name as _col_0, (createTime + 1) as _col_1"
).
right
.
get
.
toString
)
...
...
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