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

Modified Files:
        lalg2sql.brg 
Log Message:


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.122
retrieving revision 1.123
diff -u -d -r1.122 -r1.123
--- lalg2sql.brg        1 Mar 2008 11:47:13 -0000       1.122
+++ lalg2sql.brg        10 Mar 2008 09:09:04 -0000      1.123
@@ -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