[teiid-issues] [JBoss JIRA] (TEIID-2366) If where clause contains both equal and greater then conditions then query may return no results

Paul Lysak (JIRA) jira-events at lists.jboss.org
Tue Jan 29 09:20:47 EST 2013


Paul Lysak created TEIID-2366:
---------------------------------

             Summary: If where clause contains both equal and greater then conditions then query may return no results
                 Key: TEIID-2366
                 URL: https://issues.jboss.org/browse/TEIID-2366
             Project: Teiid
          Issue Type: Bug
          Components: Query Engine
    Affects Versions: 8.2
            Reporter: Paul Lysak
            Assignee: Steven Hawkins


If WHERE clause contains '>' and '=' conditions for the same field then query may produce no result - depending on conditions order.

The problem seems to be in org.teiid.query.rewriter.QueryRewriter class, method rewriteAndConjunct(). Pay attention to following piece of code:

... if (cc1.getOperator() == CompareCriteria.EQ) {
   if (!Evaluator.compare(cc1, ((Constant)cc1.getRightExpression()).getValue(), ((Constant)cc.getRightExpression()).getValue())) {
  return FALSE_CRITERIA;
  }

Note that cc1 (which is guaranteed to have EQ criterion) is passed to Evaluator.compare. Thus right expressions of cc and cc1 are required to be equal. But if we have one contition EQ and another GT then it should instead check if right side of EQ is bigger then right side of GT.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the teiid-issues mailing list