jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexparvule...@apache.org
Subject svn commit: r1389360 - in /jackrabbit/oak/trunk/oak-core/src/test: java/org/apache/jackrabbit/oak/query/ resources/org/apache/jackrabbit/oak/query/
Date Mon, 24 Sep 2012 13:31:08 GMT
Author: alexparvulescu
Date: Mon Sep 24 13:31:08 2012
New Revision: 1389360

URL: http://svn.apache.org/viewvc?rev=1389360&view=rev
Log:
OAK-336 Document SQL2 "measure"
 - moved "measure" related tests to their own test file
 - removed the "score" query condition, you are not supposed to filter on: it http://wiki.apache.org/lucene-java/LuceneFAQ#Can_I_filter_by_score.3F

Added:
    jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2_measure.txt
  (with props)
Modified:
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/QueryTest.java
    jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2.txt
    jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2_explain.txt

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/QueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/QueryTest.java?rev=1389360&r1=1389359&r2=1389360&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/QueryTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/QueryTest.java
Mon Sep 24 13:31:08 2012
@@ -58,6 +58,11 @@ public class QueryTest extends AbstractQ
     }
 
     @Test
+    public void sql2_measure() throws Exception {
+        test("sql2_measure.txt");
+    }
+
+    @Test
     public void xpath() throws Exception {
         test("xpath.txt");
     }

Modified: jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2.txt
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2.txt?rev=1389360&r1=1389359&r2=1389360&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2.txt
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2.txt
Mon Sep 24 13:31:08 2012
@@ -34,7 +34,7 @@ select * from [nt:base] where name = 'He
 select * from [nt:base] where name = 'World'
 /test/a
 
-select * from [nt:base] where isdescendantnode('/test') and name = 'World' and score() >=
0.0
+select * from [nt:base] where isdescendantnode('/test') and name = 'World'
 /test/a
 
 commit / - "test"
@@ -152,9 +152,6 @@ select * from [nt:base] as p inner join 
 /parents, /parents/p1
 /parents, /parents/p2
 
-explain select * from [nt:base] as p inner join [nt:base] as p2 on issamenode(p2, p) where
p.[jcr:path] = '/parents'
-[nt:base] as [p] /* traverse "//*" where [p].[jcr:path] = cast('/parents' as string) */ inner
join [nt:base] as [p2] /* traverse "" */ on issamenode([p2], [p], [.])
-
 select * from [nt:base] as p inner join [nt:base] as p2 on issamenode(p2, p) where p.[jcr:path]
= '/parents'
 /parents, /parents
 
@@ -208,9 +205,6 @@ select * from [nt:base] as p left outer 
 /parents/p1, /children/c2
 /parents/p2, /children/c3
 
-explain select * from [nt:base] as p inner join [nt:base] as c on p.id = c.p
-[nt:base] as [p] /* traverse "//*" where [p].[id] is not null */ inner join [nt:base] as
[c] /* traverse "//*" where [c].[p] is not null */ on [p].[id] = [c].[p]
-
 measure select * from [nt:base] as p inner join [nt:base] as c on p.id = c.p
 c, 630
 p, 210

Modified: jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2_explain.txt
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2_explain.txt?rev=1389360&r1=1389359&r2=1389360&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2_explain.txt
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2_explain.txt
Mon Sep 24 13:31:08 2012
@@ -102,6 +102,12 @@ commit / + "children": { "c1": {"p": "1"
 explain select * from [nt:base] as p inner join [nt:base] as c on p.id = c.p
 [nt:base] as [p] /* traverse "//*" where [p].[id] is not null */ inner join [nt:base] as
[c] /* traverse "//*" where [c].[p] is not null */ on [p].[id] = [c].[p]
 
+explain select * from [nt:base] as p inner join [nt:base] as p2 on issamenode(p2, p) where
p.[jcr:path] = '/parents'
+[nt:base] as [p] /* traverse "//*" where [p].[jcr:path] = cast('/parents' as string) */ inner
join [nt:base] as [p2] /* traverse "" */ on issamenode([p2], [p], [.])
+
+explain select * from [nt:base] as p inner join [nt:base] as c on p.id = c.p
+[nt:base] as [p] /* traverse "//*" where [p].[id] is not null */ inner join [nt:base] as
[c] /* traverse "//*" where [c].[p] is not null */ on [p].[id] = [c].[p]
+
 commit / - "parents"
 commit / - "children"
 

Added: jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2_measure.txt
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2_measure.txt?rev=1389360&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2_measure.txt
(added)
+++ jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2_measure.txt
Mon Sep 24 13:31:08 2012
@@ -0,0 +1,53 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# Syntax:
+# * lines starting with "#" are remarks.
+# * lines starting with "select" are queries, followed by expected results and an empty line
+# * lines starting with "explain" are followed by expected query plan and an empty line
+# * lines starting with "sql1" are run using the sql1 language
+# * lines starting with "xpath2sql" are just converted from xpath to sql2
+# * all other lines are are committed into the microkernel (line by line)
+# * new tests are typically be added on top, after the syntax docs
+# * use ascii character only
+
+commit / + "parents": { "p0": {"id": "0"}, "p1": {"id": "1"}, "p2": {"id": "2"}}
+commit / + "children": { "c1": {"p": "1"}, "c2": {"p": "1"}, "c3": {"p": "2"}, "c4": {"p":
"3"}}
+
+measure select * from [nt:base] as c right outer join [nt:base] as p on p.id = c.p where
p.id is not null and not isdescendantnode(p, '/jcr:system')
+c, 630
+p, 210
+query, 4
+
+measure select * from [nt:base] as p left outer join [nt:base] as c on p.id = c.p where p.id
is not null
+c, 630
+p, 210
+query, 4
+
+measure select * from [nt:base] as p left outer join [nt:base] as c on p.id = c.p where p.id
is not null and c.p is null
+c, 630
+p, 210
+query, 1
+
+measure select * from [nt:base] as p left outer join [nt:base] as c on p.id = c.p where p.id
is not null and c.p is not null
+c, 630
+p, 210
+query, 3
+
+measure select * from [nt:base] as p inner join [nt:base] as c on p.id = c.p
+c, 630
+p, 210
+query, 3
+

Propchange: jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2_measure.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message