Update of /cvsroot/monetdb/pathfinder/compiler/algebra
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv5763/compiler/algebra

Modified Files:
      Tag: M5XQ
        builtins.c 
Log Message:
propagated changes of Tuesday Sep 08 2009
from the development trunk to the M5XQ branch

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2009/09/08 - sjoerd: compiler/algebra/builtins.c,1.127
propagated changes of Monday Sep 07 2009 - Tuesday Sep 08 2009
from the Aug2009 branch to the development trunk

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2009/09/07 - tsheyar: compiler/algebra/builtins.c,1.126.2.1
-- Extend fn:distinct-values to cope with a mix of string and untypedAtomic 
items.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


U builtins.c
Index: builtins.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/builtins.c,v
retrieving revision 1.121.2.4
retrieving revision 1.121.2.5
diff -u -d -r1.121.2.4 -r1.121.2.5
--- builtins.c  15 Jun 2009 12:43:55 -0000      1.121.2.4
+++ builtins.c  8 Sep 2009 08:05:29 -0000       1.121.2.5
@@ -4533,14 +4533,44 @@
 {
     (void) loop; (void) ordering; (void) side_effects;
 
-    return (struct PFla_pair_t) {
-                  .rel = rowid (
-                             distinct (
-                                 project (args[0].rel,
-                                      proj (col_iter, col_iter),
-                                      proj (col_item, col_item))),
-                             col_pos),
-                  .frag = args[0].frag };
+    if (PFprop_type_of (args[0].rel, col_item) & aat_uA &&
+        PFprop_type_of (args[0].rel, col_item) & aat_str) {
+        PFla_op_t *type = type (args[0].rel, col_res, col_item, aat_uA);
+
+        /* select those rows that have type "untypedAtomic" (part1) */
+        PFla_op_t *part1 = project (
+                               cast (
+                                   type_assert_pos (
+                                       select_ (type, col_res),
+                                       col_item, aat_uA),
+                                   col_item2, col_item, aat_str),
+                               proj (col_iter, col_iter),
+                               proj (col_item, col_item2));
+
+        /* select the remaining rows (part2) */
+        PFla_op_t *part2 = project (
+                               type_assert_neg (
+                                   select_ (not (type, col_res1, col_res),
+                                            col_res1),
+                                   col_item, aat_uA),
+                               proj (col_iter, col_iter),
+                               proj (col_item, col_item));
+
+        return (struct PFla_pair_t) {
+                      .rel = rowid (
+                                 distinct (disjunion (part1, part2)),
+                                 col_pos),
+                      .frag = args[0].frag };
+    }
+    else
+        return (struct PFla_pair_t) {
+                      .rel = rowid (
+                                 distinct (
+                                     project (args[0].rel,
+                                          proj (col_iter, col_iter),
+                                          proj (col_item, col_item))),
+                                 col_pos),
+                      .frag = args[0].frag };
 }
 
 struct PFla_pair_t


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to