[
https://issues.apache.org/jira/browse/OAK-12327?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18098969#comment-18098969
]
Julian Reschke commented on OAK-12327:
--------------------------------------
Wait.
In a multvalued property, each of the values have the same type.
So how can a mv property have both String and Date values?
> PropertyValueImpl with type restriction lost when "is not null"
> ---------------------------------------------------------------
>
> Key: OAK-12327
> URL: https://issues.apache.org/jira/browse/OAK-12327
> Project: Jackrabbit Oak
> Issue Type: Bug
> Components: query
> Affects Versions: 2.4.0
> Reporter: Julian Sedding
> Priority: Major
>
> When using a query on a multi-value property for pagination, it is desirable
> to use the {{first([prop])}} function to order the results.
> However, if the property is expected to by of type "String[]", but it cannot
> be ruled out that a property of the same name exists, but with the wrong
> type, then results become somewhat unexpected.
> In SLING-13248 it happened that a "String[]", but there was also a property
> of type "Date". The query returned the "Date" property starting with "2025-"
> before a "String[]" property containing "/acs-commons". However, the
> (expected) lexicographic sorting results in the "/" getting sorted before
> "2025-".
> In an attempt to fix SLING-13248, the idea was to use a query similar to the
> one below. I.e. make sure the property is both of type "String" and present
> (not null).
> {noformat}
> select [jcr:path] from [nt:base] where property([test], 'String') is not null
> order by first([test])
> {noformat}
> Unexpectedly, this query returns the property of type "Date", just as if the
> query was using the constraint "where [test] is not null".
> I traced this back to where the [SQL2Parser creates
> {{PropertyExistenceImpl}}|https://github.com/apache/jackrabbit-oak/blob/b9b83ed38968c4d9ae04c8d8f62d2986aeedea17/oak-core/src/main/java/org/apache/jackrabbit/oak/query/SQL2Parser.java#L546]
> and does not pass on the "type" information.
> cc [~joerghoh], [~thomasm]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)