You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "nit0906 (via GitHub)" <gi...@apache.org> on 2023/05/24 14:30:51 UTC
[GitHub] [jackrabbit-oak] nit0906 commented on pull request #954: OAK-10261 Query with OR clause with COALESCE function
nit0906 commented on PR #954:
URL: https://github.com/apache/jackrabbit-oak/pull/954#issuecomment-1561272857
hi @thomasmueller - I had added a failing IT for this issue early on
` @Test
public void testCoalesceWithoutIndex() throws CommitFailedException {
final String age = "age";
final String experience = "experience";
Tree t = root.getTree("/");
Tree indexDefn = createTestIndexNode("test-index-no-coalesce", t, indexOptions.getIndexType());
TestUtil.useV2(indexDefn);
Tree props = TestUtil.newRulePropTree(indexDefn, NT_UNSTRUCTURED);
TestUtil.enableForOrdered(props, age);
TestUtil.enableForOrdered(props, experience);
root.commit();
List<String> expected = Lists.newArrayList();
List<String> expected2 = Lists.newArrayList();
Tree content = root.getTree("/").addChild("content");
t = content.addChild("test1");
t.setProperty(JCR_PRIMARYTYPE, NT_UNSTRUCTURED, NAME);
t.setProperty(age, 1);
t.setProperty(experience, 1);
expected.add(t.getPath());
expected2.add(t.getPath());
t = content.addChild("test2");
t.setProperty(JCR_PRIMARYTYPE, NT_UNSTRUCTURED, NAME);
t.setProperty(age, 2);
t.setProperty(experience, 6);
expected.add(t.getPath());
expected2.add(t.getPath());
t = content.addChild("test3");
t.setProperty(JCR_PRIMARYTYPE, NT_UNSTRUCTURED, NAME);
t.setProperty(experience, 3);
expected.add(t.getPath());
expected2.add(t.getPath());
t = content.addChild("test4");
t.setProperty(JCR_PRIMARYTYPE, NT_UNSTRUCTURED, NAME);
t.setProperty(age, 4);
expected.add(t.getPath());
expected2.add(t.getPath());
t = content.addChild("test5");
t.setProperty(JCR_PRIMARYTYPE, NT_UNSTRUCTURED, NAME);
t.setProperty(age, 6);
t.setProperty(experience, 2);
t = content.addChild("test6");
t.setProperty(JCR_PRIMARYTYPE, NT_UNSTRUCTURED, NAME);
t.setProperty(age, 10);
t = content.addChild("test7");
t.setProperty(JCR_PRIMARYTYPE, NT_UNSTRUCTURED, NAME);
t.setProperty(age, 25);
expected2.add(t.getPath());
root.commit();
// asserting the initial state
for (String s : expected) {
assertTrue("wrong initial state", root.getTree(s).exists());
}
String statement =
"SELECT * " +
"FROM [" + NT_UNSTRUCTURED + "] AS c " +
"WHERE " +
"( " +
"COALESCE(c.[" + age + "], c.[" + experience + "]) < 5)" +
" AND ISDESCENDANTNODE(c, '" + content.getPath() + "') " +
"ORDER BY age DESC ";
TestUtil.assertEventually(() -> assertQuery(statement, SQL2, expected), 3000 * 5);
final String statement2 =
"SELECT * " +
"FROM [" + NT_UNSTRUCTURED + "] AS c " +
"WHERE " +
"( " +
"COALESCE(c.[" + age + "], c.[" + experience + "]) < 5" +
" OR (COALESCE(c.[" + age + "], c.[" + experience+ "]) = 25))" +
" AND ISDESCENDANTNODE(c, '" + content.getPath() + "') " +
"ORDER BY age DESC ";
TestUtil.assertEventually(() -> assertQuery(statement2, SQL2, expected2), 3000 * 5);
}`
This still seems to fail even after the fix.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@jackrabbit.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org