[
https://issues.apache.org/jira/browse/OAK-2497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14338114#comment-14338114
]
Thomas Mueller commented on OAK-2497:
-------------------------------------
According to the JCR spec at
http://www.day.com/specs/jcr/2.0/6_Query.html#6.7.16%20Comparison :
"If operand1 and operand2 evaluate to values of different property types, the
value of operand2 is converted to the property type of the value of operand1 as
described in ยง3.6.4 Property Type Conversion. If the type conversion fails, the
query is invalid."
About invalid queries:
"An invalid query causes the repository to throw InvalidQueryException. Which
method invocation throws this exception is implementation determined, but for
an invalid query, the exception must be thrown no later than completion of the
Query.execute()."
So we should not throw a InvalidQueryException while traversing.
In many cases, there is no restriction on the property type for a given
property name. For such cases, to check if the value can be converted, we would
have to traverse the whole result in Query.execute(). That would be slow if the
query has many results. So I think that's not an option for us.
What we currently do is use an unexpected conversion rule (the property _types_
are compared).
I think it's more reasonable to either:
* throw a RepositoryException while traversing (at the point when type
conversion fails), or
* use a different, more intuitive conversion rule.
A similar problem occurs when using "order by x" with a mixed value type of x.
About this, the spec says "if v1 is a different property type than v2, the
relative order of nt1 and nt2 is implementation determined".
What we could do is: If one of the values is a binary, we could compare the
binaries. If not, convert both values to a string, and compare the strings.
> Range query with incorrectly formatted date
> -------------------------------------------
>
> Key: OAK-2497
> URL: https://issues.apache.org/jira/browse/OAK-2497
> Project: Jackrabbit Oak
> Issue Type: Bug
> Components: query
> Reporter: Thomas Mueller
> Assignee: Thomas Mueller
> Fix For: 1.2, 1.1.7
>
>
> Range queries on Date properties, with incorrectly formatted date, return no
> results (instead of either failing, or returning the expected result).
> Example date: {{2015-01-22T17:10:05.666z}}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)