[Checkins] SVN: Sandbox/adamg/ocql/trunk/src/ocql/ moving optimization checking tests from test_zope to compiler_optimized.txt

Charith Paranaliyanage paranaliyanage at gmail.com
Fri Aug 29 08:55:03 EDT 2008


Log message for revision 90586:
  moving optimization checking tests from test_zope to compiler_optimized.txt

Changed:
  U   Sandbox/adamg/ocql/trunk/src/ocql/compiler/compiler_optimized.txt
  U   Sandbox/adamg/ocql/trunk/src/ocql/testing/utils_opt.py
  U   Sandbox/adamg/ocql/trunk/src/ocql/tests/test_zope.py

-=-
Modified: Sandbox/adamg/ocql/trunk/src/ocql/compiler/compiler_optimized.txt
===================================================================
--- Sandbox/adamg/ocql/trunk/src/ocql/compiler/compiler_optimized.txt	2008-08-29 12:44:38 UTC (rev 90585)
+++ Sandbox/adamg/ocql/trunk/src/ocql/compiler/compiler_optimized.txt	2008-08-29 12:55:01 UTC (rev 90586)
@@ -20,10 +20,14 @@
 
     >>> from ocql.engine import OCQLEngine
 
-    >>> from ocql.testing.utils_opt import setupInterfaces
-    >>> setupInterfaces(None)
-    >>> from ocql.testing.utils_opt import setupCatalog
-    >>> setupCatalog(None)
+    >>> import ocql.testing.utils_opt
+    >>> ocql.testing.utils_opt.setupInterfaces(None)
+    >>> import ocql.testing.utils
+    >>> ocql.testing.utils.setupInterfaces(None)
+    >>> import ocql.testing.utils_opt
+    >>> ocql.testing.utils_opt.setupCatalog(None)
+    >>> import ocql.testing.utils_opt
+    >>> ocql.testing.utils.setupCatalog(None)
 
 We'll use the same queries as in aoptimizer.txt.
 Algebra trees get omitted as they are already checked over there.
@@ -123,4 +127,17 @@
     >>> run = OCQLEngine().compile(query)
     >>> result = run.execute()
     >>> sorted(result)
-    [u'0', u'1', u'2', u'3', u'4', u'6', u'7', u'8', u'9']
\ No newline at end of file
+    [u'0', u'1', u'2', u'3', u'4', u'6', u'7', u'8', u'9']
+
+
+
+    >>> query = "set [ c in IStudent; c.country == 'USA' | c.name ]"
+    >>> run = OCQLEngine().compile(query)
+    >>> run
+    RunnableQuery:
+    reduce(set.union,
+    map(lambda c: set([c.name]),
+    set(metadata.getFromIndex("IStudent", "country", "==", 'USA'))), set())
+    >>> result = run.execute()
+    >>> result
+    set([u'Jane'])

Modified: Sandbox/adamg/ocql/trunk/src/ocql/testing/utils_opt.py
===================================================================
--- Sandbox/adamg/ocql/trunk/src/ocql/testing/utils_opt.py	2008-08-29 12:44:38 UTC (rev 90585)
+++ Sandbox/adamg/ocql/trunk/src/ocql/testing/utils_opt.py	2008-08-29 12:55:01 UTC (rev 90586)
@@ -120,4 +120,4 @@
         id = intids.register(o)
         cat.index_doc(id, o)
 
-    component.provideUtility(cat, ICatalog, name='foo-catalog')
+    component.provideUtility(cat, ICatalog, name='boo-catalog')

Modified: Sandbox/adamg/ocql/trunk/src/ocql/tests/test_zope.py
===================================================================
--- Sandbox/adamg/ocql/trunk/src/ocql/tests/test_zope.py	2008-08-29 12:44:38 UTC (rev 90585)
+++ Sandbox/adamg/ocql/trunk/src/ocql/tests/test_zope.py	2008-08-29 12:55:01 UTC (rev 90586)
@@ -99,7 +99,7 @@
         #
         # set [ c in IStudent | c ]
         #
-        query = "[c in IStudent | c]"
+        query = "set [c in IStudent | c]"
         qo = Head(Query(
                 metadata, symbols,
                 set,
@@ -119,7 +119,7 @@
         #
         # set [ c in IStudent | c.name ]
         #
-        query = "[c in IStudent | c.name]"
+        query = "set [c in IStudent | c.name]"
         qo = Head(Query(
                    metadata, symbols,
                    set,
@@ -136,9 +136,9 @@
         #
         # Filtering --one result
         #
-        # set [ c in IProject , c.description="test" | c.name]
+        # set [ c in IProject; c.description="test" | c.name]
         #
-        query = "[c in IProject , c.description=test | c.name]"
+        query = "set [c in IProject; c.description==test | c.name]"
         qo = Head(Query(
                    metadata, symbols,
                    set,
@@ -160,9 +160,9 @@
         #
         # Filtering --one result using optimization
         #
-        # set [ c in IStudent , c.country="USA" | c.name]
+        # set [ c in IStudent; c.country="USA" | c.name]
         #
-        query = "[c in IStudent , c.country==USA | c.name]"
+        query = "set [c in IStudent; c.country==USA | c.name]"
         qo = Head(Query(
                    metadata, symbols,
                    set,
@@ -184,9 +184,9 @@
         #
         # Filtering --one result using optimization
         #
-        # set [ c in IStudent , c.country!="USA" | c.name]
+        # set [ c in IStudent; c.country!="USA" | c.name]
         #
-        query = "[c in IStudent , c.country != USA | c.name]"
+        query = "[c in IStudent; c.country != USA | c.name]"
         qo = Head(Query(
                    metadata, symbols,
                    set,
@@ -208,9 +208,9 @@
         #
         # Filtering --one result using optimization
         #
-        # set [ c in IStudent , c.country <= "Sri Lanka" | c.name]
+        # set [ c in IStudent; c.country <= "Sri Lanka" | c.name]
         #
-        query = "[c in IStudent , c.country <= 'Sri Lanka' | c.name]"
+        query = "[c in IStudent; c.country <= 'Sri Lanka' | c.name]"
         qo = Head(Query(
                    metadata, symbols,
                    set,
@@ -232,9 +232,9 @@
         #
         # Filtering --one result using optimization
         #
-        # set [ c in IStudent , c.country >= "Sri Lanka" | c.name]
+        # set [ c in IStudent; c.country >= "Sri Lanka" | c.name]
         #
-        query = "[c in IStudent , c.country >= 'Sri Lanka' | c.name]"
+        query = "[c in IStudent; c.country >= 'Sri Lanka' | c.name]"
         qo = Head(Query(
                    metadata, symbols,
                    set,
@@ -256,9 +256,9 @@
         #
         # Filtering --one result using optimization
         #
-        # set [ c in IStudent , c.country < "Sri Lanka" | c.name]
+        # set [ c in IStudent; c.country < "Sri Lanka" | c.name]
         #
-        query = "[c in IStudent , c.country < 'Sri Lanka' | c.name]"
+        query = "[c in IStudent; c.country < 'Sri Lanka' | c.name]"
         qo = Head(Query(
                    metadata, symbols,
                    set,
@@ -280,9 +280,9 @@
         #
         # Filtering --one result using optimization
         #
-        # set [ c in IStudent , c.country > "Sri Lanka" | c.name]
+        # set [ c in IStudent; c.country > "Sri Lanka" | c.name]
         #
-        query = "[c in IStudent , c.country > 'Sri Lanka' | c.name]"
+        query = "[c in IStudent; c.country > 'Sri Lanka' | c.name]"
         qo = Head(Query(
                    metadata, symbols,
                    set,
@@ -305,11 +305,11 @@
         #
         # join -- Mentor who is mentoring Hungary student
         #
-        # set [ m in IMentor, every set [ s in IStudent, some s.mentor = m | s.country ] == Hungary  | m.name ]
+        # set [ m in IMentor; every set [ s in IStudent; some s.mentor == m | s.country ] == Hungary  | m.name ]
         #
-        query = """set [ m in IMentor,
+        query = """set [ m in IMentor;
             every
-            set [ s in IStudent, some s.mentor = m; s.country=Hungary | s.name] == Stewart
+            set [ s in IStudent; some s.mentor == m; s.country == Hungary | s.name] == Stewart
             | m.name ]"""
         qo=Head(Query(
             metadata, symbols,



More information about the Checkins mailing list