[ https://issues.apache.org/jira/browse/OAK-9252?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Thomas Mueller reassigned OAK-9252: ----------------------------------- Assignee: Thomas Mueller > Query: multi-valued property condition can fail with "Type must be an array > type" > --------------------------------------------------------------------------------- > > Key: OAK-9252 > URL: https://issues.apache.org/jira/browse/OAK-9252 > Project: Jackrabbit Oak > Issue Type: Improvement > Reporter: Thomas Mueller > Assignee: Thomas Mueller > Priority: Major > > A condition of the form "property = 'literal'" can fail with the error > messageĀ "Type must be an array type" if: > * the property is multi-value and has no entries (count 0) > * the property type is not String (e.g. Name) > Example query: > {noformat} > select * from [nt:base] > where isdescendantnode('/etc') > and [jcr:mixinTypes] = 'mix:referenceable' > {noformat} > This can fail if there is no index for this (e.g. by disabling the nodetype > index), and if there is a node with an empty mixin type. Test case > (org.apache.jackrabbit.oak.jcr.query.QueryTest): > {noformat} > @Test > public void emptyMixin() throws RepositoryException { > Session session = createAdminSession(); > Node p = session.getRootNode().addNode("etc"); > Node r = p.addNode("r", "nt:unstructured"); > r.addMixin("mix:referenceable"); > session.save(); > r.removeMixin("mix:referenceable"); > session.save(); > assertTrue(r.hasProperty("jcr:mixinTypes")); > Property mix = r.getProperty("jcr:mixinTypes"); > assertTrue(mix.isMultiple()); > assertEquals(0, mix.getValues().length); > session.save(); > Query q = session.getWorkspace().getQueryManager().createQuery( > "select * from [nt:base] where isdescendantnode('/etc') " + > "and [jcr:mixinTypes] = 'mix:referenceable' " + > "option(index name [x])", Query.JCR_SQL2); > QueryResult qr = q.execute(); > NodeIterator ni = qr.getNodes(); > assertFalse(ni.hasNext()); > session.logout(); > } > {noformat} -- This message was sent by Atlassian Jira (v8.3.4#803005)