Update of /cvsroot/monetdb/pathfinder/compiler/sql
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv27259/compiler/sql

Modified Files:
      Tag: xquery-decomposition
        lalg2sql.brg 
Log Message:
propagated changes of Thursday Mar 06 2008 - Monday Mar 10 2008
from the development trunk to the xquery-decomposition branch

===================================================================
2008/03/10 - mayrm: compiler/sql/lalg2sql.brg,1.123


Bugfix: Since SQL lacks support for boolean types we have to bind the input 
operators
        of joins trying to join over boolean values.
===================================================================



Index: lalg2sql.brg
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/sql/lalg2sql.brg,v
retrieving revision 1.102.2.8
retrieving revision 1.102.2.9
diff -u -d -r1.102.2.8 -r1.102.2.9
--- lalg2sql.brg        6 Mar 2008 15:31:34 -0000       1.102.2.8
+++ lalg2sql.brg        10 Mar 2008 10:48:55 -0000      1.102.2.9
@@ -2535,15 +2535,74 @@
         {
             assert (kids[0] && nts[0]);
             assert (kids[1] && nts[1]);
+
             /* reduce the first child */
             reduce (kids[0], nts[0]);
 
+            if (p->kind == la_eqjoin) {
+                 PFalg_simple_type_t l_ty;
+
+                 l_ty = type_of (p, p->sem.eqjoin.att1);
+
+                 assert (monomorphic (l_ty));
+
+                 /* if the the eqjoin joins over boolean values
+                  * we have to bind the underlying node */
+                 if (l_ty == aat_bln && !BOUND(L(p)))
+                     bind_operator (L(p), false);
+            }
+            else if (p->kind == la_thetajoin) {
+                PFalg_simple_type_t l_ty;
+
+                /* iterate over all predicates and add them to the wherelist */
+                for (unsigned int i = 0; i < p->sem.thetajoin.count; i++) {
+
+                    l_ty   = type_of (p, p->sem.thetajoin.pred[i].left);
+
+                    assert (monomorphic (l_ty));
+                    
+                    /* if the thetajoin joins over boolean values
+                     * we have to bind the underlying node */
+                    if (l_ty == aat_bln && !BOUND (L(p)))
+                        bind_operator (L(p), false);
+                }
+            }
+
             /* copy all existing column, from, and where lists
                of the left child */
             copy_cols_from_where (p, L(p));
 
             reduce (kids[1], nts[1]);
 
+            if (p->kind == la_eqjoin) {
+                 PFalg_simple_type_t r_ty;
+
+                 r_ty = type_of (p, p->sem.eqjoin.att2);
+
+                 assert (monomorphic (r_ty));
+
+                 /* if the the eqjoin joins over boolean values
+                  * we have to bind the underlying node */
+                 if (r_ty == aat_bln && !BOUND(R(p)))
+                     bind_operator (R(p), false);
+            }
+            else if (p->kind == la_thetajoin) {
+                PFalg_simple_type_t r_ty;
+
+                /* iterate over all predicates and add them to the wherelist */
+                for (unsigned int i = 0; i < p->sem.thetajoin.count; i++) {
+
+                    r_ty   = type_of (p, p->sem.thetajoin.pred[i].right);
+
+                    assert (monomorphic (r_ty));
+                    
+                    /* if the thetajoin joins over boolean values
+                     * we have to bind the underlying node */
+                    if (r_ty == aat_bln && !BOUND (R(p)))
+                        bind_operator (R(p), false);
+                }
+            }
+
             /* copy all existing expression from right child */
             for (unsigned int i = 0; i < PFarray_last (COLMAP(R(p))); i++) {
                 sql_column_env_t entry = col_env_at (COLMAP(R(p)), i);


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to