Quanlong Huang created ORC-971:
----------------------------------

             Summary: LESS_THAN_EQUALS doesn't handle the case when min=max
                 Key: ORC-971
                 URL: https://issues.apache.org/jira/browse/ORC-971
             Project: ORC
          Issue Type: Bug
          Components: C++
    Affects Versions: 1.7.0
            Reporter: Quanlong Huang
            Assignee: Quanlong Huang


When evaluating the LESS_THAN_EQUALS predicates, the case that has identical 
minValue and maxValue is not handled correctly. E.g. predicate "x <= 15" on a 
range [15, 15] should get YES or YES_NULL results. But what we currently get is 
YES_NO or YES_NO_NULL.

The issue is in evaluatePredicateRange():
 
[https://github.com/apache/orc/blob/12e2f7488a7b5a11f734522dedf3648bd29cd1cc/c%2B%2B/src/sargs/PredicateLeaf.cc#L340-L348]
{code:cpp}
      case PredicateLeaf::Operator::LESS_THAN_EQUALS:
        loc = compareToRange(values.at(0), minValue, maxValue);
        if (loc == Location::AFTER || loc == Location::MAX) {    // 'loc' could 
be MIN and MIN could equal to MAX. This case is missed here.
          return hasNull ? TruthValue::YES_NULL : TruthValue::YES;
        } else if (loc == Location::BEFORE) {
          return hasNull ? TruthValue::NO_NULL : TruthValue::NO;
        } else {
          return hasNull ? TruthValue::YES_NO_NULL : TruthValue::YES_NO;
        }
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to