[ https://issues.apache.org/jira/browse/OAK-10033?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Nitin Gupta resolved OAK-10033. ------------------------------- Resolution: Fixed > Conditions on dates use the wrong range > --------------------------------------- > > Key: OAK-10033 > URL: https://issues.apache.org/jira/browse/OAK-10033 > Project: Jackrabbit Oak > Issue Type: Bug > Reporter: Mohit Kataria > Assignee: Mohit Kataria > Priority: Major > Fix For: 1.48.0 > > > For queries like: > SELECT * FROM [nt:base] AS main WHERE (main.[startTime] <> > cast('1971-01-01T13:00:00.000Z' AS date)) > The condition uses the wrong range, as negative values are possible. The > range should be -9223372036854775808 TO 9223372036854775807 and not 0 TO > 9223372036854775807. > {code:java} > [calendar@startTime] <> cast('1971-01-01T13:00:00.000Z' AS date) > +calendar@startTime:[0 TO 9223372036854775807] > -calendar@startTime:[31582800000 TO 31582800000]{code} > Source code: > [https://github.com/apache/jackrabbit-oak/blob/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/PropertyValueImpl.java] > [https://github.com/apache/jackrabbit-oak/blob/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndex.java#L1227] > {code:java} > // not null. For date lower bound of zero can be used > return NumericRangeQuery.newLongRange(propertyName, 0L, Long.MAX_VALUE, true, > true);{code} > This isn't correct, as 0 means 1970-01-01T00:00:00.000Z > It should probably be : > {code:java} > // not null. For date lower bound of zero can be used > return NumericRangeQuery.newLongRange(propertyName, Long.MIN_VALUE, > Long.MAX_VALUE, true, true);{code} -- This message was sent by Atlassian Jira (v8.20.10#820010)