[Checkins] SVN: Sandbox/adamg/ocql/trunk/src/ocql/ "as" tests still fail

Adam Groszer agroszer at gmail.com
Mon Aug 25 08:13:06 EDT 2008


Log message for revision 90193:
  "as" tests still fail

Changed:
  U   Sandbox/adamg/ocql/trunk/src/ocql/rewriter/rewriter.txt
  U   Sandbox/adamg/ocql/trunk/src/ocql/tests/functions.txt

-=-
Modified: Sandbox/adamg/ocql/trunk/src/ocql/rewriter/rewriter.txt
===================================================================
--- Sandbox/adamg/ocql/trunk/src/ocql/rewriter/rewriter.txt	2008-08-25 12:12:31 UTC (rev 90192)
+++ Sandbox/adamg/ocql/trunk/src/ocql/rewriter/rewriter.txt	2008-08-25 12:13:05 UTC (rev 90193)
@@ -133,7 +133,7 @@
     >>> opt = QueryOptimizer(qo)()
     >>> alg = Rewriter(opt)()
     >>> print str(alg)
-    Head(Reduce(<type 'set'>, `0`, Lambda i: `1`, +, Iter(<type 'set'>, Lambda i: Single(<type 'set'>, i), Make(<type 'set'>, <type 'set'>, IStaff))) + 
+    Head(Reduce(<type 'set'>, `0`, Lambda i: `1`, +, Iter(<type 'set'>, Lambda i: Single(<type 'set'>, i), Make(<type 'set'>, <type 'set'>, IStaff))) +
     Reduce(<type 'set'>, `0`, Lambda i: `1`, +, Iter(<type 'set'>, Lambda j: Single(<type 'set'>, j), Make(<type 'set'>, <type 'set'>, IVisitingStaff))))
 
     >>> qo = QueryParser("len ( set [ i in IStaff | i ] ) - len ( set [ j in IVisitingStaff | j ] )")(TestMetadata())
@@ -157,8 +157,8 @@
     Head(Reduce(<type 'set'>, `0`, Lambda i: `1`, +, Iter(<type 'set'>, Lambda i: Single(<type 'set'>, i), Make(<type 'set'>, <type 'set'>, IStaff))) /
     Reduce(<type 'set'>, `0`, Lambda i: `1`, +, Iter(<type 'set'>, Lambda j: Single(<type 'set'>, j), Make(<type 'set'>, <type 'set'>, IVisitingStaff))))
 
-#    >>> qo = QueryParser("set [ s in IStudents; a as s.major.address.street; a=='Hillhead Street' | s ]")(TestMetadata())
-#    >>> opt = QueryOptimizer(qo)()
-#    >>> alg = Rewriter(opt)()
-#    >>> print str(alg)
-#    Head(Iter(<type 'set'>, Lambda c: Iter(<type 'set'>, Lambda a: Single(<type 'set'>, a), Single(<type 'set'>, c.code)), Make(<type 'set'>, <type 'set'>, ICourse)))
+    >>> qo = QueryParser("set [ s in IStudents; a as s.major.address.street; a=='Hillhead Street' | s ]")(TestMetadata())
+    >>> opt = QueryOptimizer(qo)()
+    >>> alg = Rewriter(opt)()
+    >>> print str(alg)
+    Head(???)

Modified: Sandbox/adamg/ocql/trunk/src/ocql/tests/functions.txt
===================================================================
--- Sandbox/adamg/ocql/trunk/src/ocql/tests/functions.txt	2008-08-25 12:12:31 UTC (rev 90192)
+++ Sandbox/adamg/ocql/trunk/src/ocql/tests/functions.txt	2008-08-25 12:13:05 UTC (rev 90193)
@@ -111,13 +111,21 @@
     [set([]), set([Department <Computing Science>]), set([Department <Computing Science>, Department <Other department>])]
 
 Size expression in the result:
-     >>> engine.compile("list [ c in ICourse ; len(c.runBy) == 1 | c ]").execute()
-     [Course <C3>]
+    >>> engine.compile("list [ c in ICourse ; len(c.runBy) == 1 | c ]").execute()
+    [Course <C3>]
 
- Size operator in the result:
-     >>> engine.compile("list [ c in ICourse | len(c.runBy)  ]").execute()
-     [2, 0, 1]
+Size operator in the result:
+    >>> engine.compile("list [ c in ICourse | len(c.runBy)  ]").execute()
+    [2, 0, 1]
 
+Sample from the presentation:
+    >>> engine.compile("set [ p in IStaff; p.salary < 2300 | p ]").execute()
+    set([Staff <S1>])
+
+Sample from the presentation:
+    >>> engine.compile("set [ s in IStudents; a as s.major.address.street; a=='Hillhead Street' or a=='Gibson Street' | s ]").execute()
+    Student1, Student2
+
 More test ideas:
 engine.compile("""list [ d in IDepartments; c in ICourse; d == some c.runBy | list {d.name, c}  ]""").execute()
 engine.compile("""list [ d in IDepartments; | list {d, size set [ some c.runBy = d ; c in ICurses; c.credits <= 2 | c ] } ]""").execute()



More information about the Checkins mailing list