You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@metamodel.apache.org by "Radek Poskočil (JIRA)" <ji...@apache.org> on 2017/01/04 22:42:58 UTC

[jira] [Commented] (METAMODEL-1134) Support for NOT / NOT IN operator

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

Radek Poskočil commented on METAMODEL-1134:
-------------------------------------------

I have started working on it. At first I have implemented a negation of a condition in this seperated branch https://github.com/apache/metamodel/compare/master...rposkocil:feature/1134-condition-negation-causes.
-> possible to use NOT in where clauses on filter layer

Examples
NEW:
FilterItem positiveFilter = new FilterItem(selectItem, NegationOperator.NONE, OperatorType.EQUALS_TO, "a");
FilterItem negativeFilter = new FilterItem(selectItem, NegationOperator.NOT, OperatorType.EQUALS_TO, "a");
FilterItem composedFilter = new FilterItem(LogicalOperator.AND, NegationOperator.NOT, positiveFilter, negativeFilter);
=> toSql() -> NOT (c = 'a' AND NOT c = 'a')

BACKWARD COMPATIBILITY:
FilterItem positiveFilter2 = new FilterItem(selectItem, OperatorType.EQUALS_TO, "a");
FilterItem composedFilter2 = new FilterItem(LogicalOperator.AND, positiveFilter, negativeFilter);

> Support for NOT / NOT IN operator
> ---------------------------------
>
>                 Key: METAMODEL-1134
>                 URL: https://issues.apache.org/jira/browse/METAMODEL-1134
>             Project: Apache MetaModel
>          Issue Type: Improvement
>            Reporter: Hans Drexler
>
> In MetaModel it is not possible to write a query containing a NOT/NOT IN operator. In our case we want to select the highest job from a table that is not in failed or completed state. This can not be done (ok, this example is a bit too easy, but in our project we have a query that can not be handled).
> {code}
> select max(jobid) from foo where state not in ('COMPLETE', 'FAILED')
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)