Update of /cvsroot/monetdb/pathfinder/compiler/algebra
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv16708/compiler/algebra
Modified Files:
algebra_cse.c
Log Message:
-- The equality-check for the referenced-table-operator now checks all
semantical information (e.g. also tcols and keypositions).
U algebra_cse.c
Index: algebra_cse.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/algebra_cse.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -d -r1.83 -r1.84
--- algebra_cse.c 27 May 2009 14:02:41 -0000 1.83
+++ algebra_cse.c 28 May 2009 16:34:58 -0000 1.84
@@ -184,20 +184,59 @@
break;
case la_ref_tbl:
-
- if (strcmp(a->sem.ref_tbl.name, b->sem.ref_tbl.name) != 0)
+ {
+ /* comparison of the names of the tables */
+ if (strcmp (a->sem.ref_tbl.name, b->sem.ref_tbl.name)
!= 0)
return false;
+ /* comparison of the schemas */
if (a->schema.count != b->schema.count)
return false;
-
- for (unsigned int i = 0; i < a->schema.count; i++)
+ for (unsigned int i = 0; i < a->schema.count; i++)
if (a->schema.items[i].name != b->schema.items[i].name
||
a->schema.items[i].type != b->schema.items[i].type)
return false;
- return true;
+
+ /* comparison of the tcols */
+ unsigned int tcols_count = PFarray_last
(a->sem.ref_tbl.tcols);
+ for (unsigned int i = 0; i < tcols_count; i++)
+ {
+ char* tcol1 = *(char**) PFarray_at
(a->sem.ref_tbl.tcols, i);
+ char* tcol2 = *(char**) PFarray_at
(b->sem.ref_tbl.tcols, i);
+
+ if (strcmp (tcol1, tcol2) != 0)
+ return false;
+ }
+
+ /* comparison of the keys */
+ unsigned int key_count1 = PFarray_last
(a->sem.ref_tbl.keys);
+ unsigned int key_count2 = PFarray_last
(b->sem.ref_tbl.keys);
+ if (key_count1 != key_count2)
+ return false;
+ for (unsigned int k = 0; k < key_count1; k++)
+ {
+ PFarray_t * keyPositions1 =
+ *((PFarray_t**) PFarray_at
(a->sem.ref_tbl.keys, k));
+ PFarray_t * keyPositions2 =
+ *((PFarray_t**) PFarray_at
(b->sem.ref_tbl.keys, k));
+
+ unsigned int position_count1 =
PFarray_last (keyPositions1);
+ unsigned int position_count2 =
PFarray_last (keyPositions2);
+ if (position_count1 != position_count2)
+ return false;
+ for (unsigned int p = 0; p <
position_count1; p++)
+ {
+ int pos1 = *((int*) PFarray_at
(keyPositions1, p));
+ int pos2 = *((int*) PFarray_at
(keyPositions2, p));
+ if (pos1 != pos2)
+ return false;
+ }
+ }
+
+ return true;
+ }
break;
-
+
case la_attach:
return (a->sem.attach.res == b->sem.attach.res &&
PFalg_atom_comparable (a->sem.attach.value,
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins