[ 
https://issues.apache.org/jira/browse/S2GRAPH-222?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16513352#comment-16513352
 ] 

Daewon Jeong edited comment on S2GRAPH-222 at 6/15/18 5:17 AM:
---------------------------------------------------------------

[~steamshon]

I think `Where Parser` should follow the grammar of the where clause of 
standard SQL.

If  follow the syntax of the standard SQL clause, user can easily predict usage.

I think that the revised contents have been modified well in the parts which 
had been previously implemented incorrectly (not the general processing but 
specifically the `NOT IN` processing)

But for a more predictable syntax, I think it would be better to implement all 
the `NOT condition` clauses of the type supported by the standard SQL.
{code:sql}
NOT condition
{code}
Below is all valid SQL queries.

 

ex) NOT IN clause
{code:sql}
SELECT Id, CompanyName, City, Country
FROM Supplier
WHERE NOT (Country IN ('USA', 'UK', 'Japan'))
{code}
{code:sql}
SELECT Id, ProductName, UnitPrice
FROM Product
WHERE UnitPrice NOT IN (10,20,30,40,50)
{code}
ex) NOT like
{code:sql}
SELECT *
FROM suppliers
WHERE supplier_name NOT LIKE '%o%';
{code}
{code:sql}
SELECT *
FROM suppliers
WHERE NOT(supplier_name LIKE '%o%');
{code}
link: [http://www.dofactory.com/sql/where-in]


was (Author: daewon):
[~steamshon]

I think `Where Parser` should follow the grammar of the where clause of 
standard SQL.

If  follow the syntax of the standard SQL clause, user can easily predict usage.

I think that the revised contents have been modified well in the parts which 
had been previously implemented incorrectly (not the general processing but 
specifically the `NOT IN` processing)

But for a more predictable syntax, I think it would be better to implement all 
the `NOT condition` clauses of the type supported by the standard SQL.

 

> Support Not logical operator in  WhereParser.
> ---------------------------------------------
>
>                 Key: S2GRAPH-222
>                 URL: https://issues.apache.org/jira/browse/S2GRAPH-222
>             Project: S2Graph
>          Issue Type: New Feature
>          Components: s2core
>            Reporter: DOYUNG YOON
>            Assignee: DOYUNG YOON
>            Priority: Minor
>
> `And/Or` operator is implemented as a logical operator, but `Not` is not 
> implemented in WhereParser.
> This is illustrated by following examples.
> Following query works only because we added hardcoded implementation on `not 
> in` as predicates.
> {noformat}
> query {
>   s2graph { 
>     User(id: 1) {
>       id
>       Friends(limit: 10, filter: "friend_name not in ('steamshon')") {
>         User { 
>           id
>         }
>       }
>     }
>   }
> }
> {noformat}
> I believe implementing `Not` as a logical operator is more general, so below 
> is my suggestion.
> {noformat}
> query {
>   s2graph { 
>     User(id: 1) {
>       id
>       Friends(limit: 10, filter: "NOT (friend_name in ('steamshon'))") {
>         User { 
>           id
>         }
>       }
>     }
>   }
> }
> {noformat}
> In this way, we don't need to implement not case for all predicates, such as 
> `in`, `between`, `contains`, `eq`.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to