Changeset: 961473e2e4e4 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=961473e2e4e4
Modified Files:
        clients/Tests/MAL-signatures_all.stable.out
        clients/Tests/MAL-signatures_fits_geom.stable.out
        clients/Tests/MAL-signatures_geom.stable.out
        clients/Tests/MAL-signatures_none.stable.out
        clients/Tests/exports.stable.out
        gdk/gdk.h
        gdk/gdk_batop.c
        monetdb5/ChangeLog.Oct2014
        monetdb5/modules/kernel/algebra.c
        monetdb5/modules/kernel/algebra.h
        monetdb5/modules/kernel/algebra.mal
        monetdb5/optimizer/opt_prelude.c
        monetdb5/optimizer/opt_prelude.h
Branch: Oct2014
Log Message:

Cleanup: removed BAThistogram.


diffs (truncated from 395 to 300 lines):

diff --git a/clients/Tests/MAL-signatures_all.stable.out 
b/clients/Tests/MAL-signatures_all.stable.out
--- a/clients/Tests/MAL-signatures_all.stable.out
+++ b/clients/Tests/MAL-signatures_all.stable.out
@@ -232,10 +232,6 @@ comment Return the current size (in numb
 
 command aggr.exist(b:bat[:oid,:any_2],h:any_1):bit 
 address ALGexist;
-command aggr.histogram(b:bat[:any_1,:any_2]):bat[:any_2,:int] 
-address ALGhistogram;
-comment Produce a BAT containing the histogram over the tail values.
-
 command aggr.jsonaggr(val:bat[:oid,:dbl]):str 
 address JSONgroupStr;
 comment Aggregate the double values to array.
diff --git a/clients/Tests/MAL-signatures_fits_geom.stable.out 
b/clients/Tests/MAL-signatures_fits_geom.stable.out
--- a/clients/Tests/MAL-signatures_fits_geom.stable.out
+++ b/clients/Tests/MAL-signatures_fits_geom.stable.out
@@ -232,9 +232,6 @@ comment Return the current size (in numb
 
 command aggr.exist(b:bat[:oid,:any_2],h:any_1):bit 
 address ALGexist;
-command aggr.histogram(b:bat[:any_1,:any_2]):bat[:any_2,:int] 
-address ALGhistogram;
-comment Produce a BAT containing the histogram over the tail values.
 
 command aggr.jsonaggr(val:bat[:oid,:dbl]):str 
 address JSONgroupStr;
diff --git a/clients/Tests/MAL-signatures_geom.stable.out 
b/clients/Tests/MAL-signatures_geom.stable.out
--- a/clients/Tests/MAL-signatures_geom.stable.out
+++ b/clients/Tests/MAL-signatures_geom.stable.out
@@ -232,9 +232,6 @@ comment Return the current size (in numb
 
 command aggr.exist(b:bat[:oid,:any_2],h:any_1):bit 
 address ALGexist;
-command aggr.histogram(b:bat[:any_1,:any_2]):bat[:any_2,:int] 
-address ALGhistogram;
-comment Produce a BAT containing the histogram over the tail values.
 
 command aggr.jsonaggr(val:bat[:oid,:dbl]):str 
 address JSONgroupStr;
diff --git a/clients/Tests/MAL-signatures_none.stable.out 
b/clients/Tests/MAL-signatures_none.stable.out
--- a/clients/Tests/MAL-signatures_none.stable.out
+++ b/clients/Tests/MAL-signatures_none.stable.out
@@ -231,9 +231,6 @@ comment Return the current size (in numb
 
 command aggr.exist(b:bat[:oid,:any_2],h:any_1):bit 
 address ALGexist;
-command aggr.histogram(b:bat[:any_1,:any_2]):bat[:any_2,:int] 
-address ALGhistogram;
-comment Produce a BAT containing the histogram over the tail values.
 
 command aggr.jsonaggr(val:bat[:oid,:dbl]):str 
 address JSONgroupStr;
diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -136,7 +136,6 @@ BAT *BATgroupvariance_population(BAT *b,
 BAT *BATgroupvariance_sample(BAT *b, BAT *g, BAT *e, BAT *s, int tp, int 
skip_nils, int abort_on_error);
 BUN BATgrows(BAT *b);
 BAT *BAThash(BAT *b, BUN masksize);
-BAT *BAThistogram(BAT *b);
 BAT *BATimprints(BAT *b);
 BAT *BATins(BAT *b, BAT *c, bit force);
 BAT *BATintersectcand(BAT *a, BAT *b);
@@ -745,7 +744,6 @@ str ALGfetchoid(int *ret, int *bid, oid 
 str ALGfind(ptr ret, int *bid, ptr val);
 str ALGfirstn(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
 str ALGgroupby(int *res, int *gids, int *cnts);
-str ALGhistogram(int *result, int *bid);
 str ALGhmarkp(int *result, int *bid, int *nr_parts, int *part_nr);
 str ALGhsort(int *result, int *bid);
 str ALGhsort_rev(int *result, int *bid);
@@ -2328,7 +2326,6 @@ int hasSameSignature(MalBlkPtr mb, Instr
 int hasSideEffects(InstrPtr p, int strict);
 str hashRef;
 int headProp;
-str histogramRef;
 int hlbProp;
 int horiginProp;
 int hubProp;
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -3190,17 +3190,6 @@ gdk_export int ALIGNsetH(BAT *b1, BAT *b
  * @+ Common BAT Operations
  * Much used, but not necessarily kernel-operations on BATs.
  *
- * @- BAT aggregates
- * @multitable @columnfractions 0.08 0.7
- * @item BAT*
- * @tab
- *  BAThistogram(BAT *b)
- * @item BAT*
- * @end multitable
- *
- * The routine BAThistogram produces a new BAT with a frequency
- * distribution of the tail of its operand.
- *
  * For each BAT we maintain its dimensions as separately accessible
  * properties. They can be used to improve query processing at higher
  * levels.
@@ -3214,7 +3203,6 @@ gdk_export int ALIGNsetH(BAT *b1, BAT *b
 gdk_export void PROPdestroy(PROPrec *p);
 gdk_export PROPrec *BATgetprop(BAT *b, int idx);
 gdk_export void BATsetprop(BAT *b, int idx, int type, void *v);
-gdk_export BAT *BAThistogram(BAT *b);
 gdk_export int BATtopN(BAT *b, BUN topN);      /* used in 
monet5/src/modules/kernel/algebra.mx */
 
 /*
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -1440,12 +1440,6 @@ BATmark(BAT *b, oid oid_base)
        return bn;
 }
 
-static void
-BATsetprop_wrd(BAT *b, int idx, wrd val)
-{
-       BATsetprop(b, idx, TYPE_wrd, &val);
-}
-
 #define mark_grp_init(BUNfnd)                          \
        do {                                            \
                BUN w;                                  \
@@ -1834,185 +1828,6 @@ BATpropagate(BAT *dst, BAT *src, int idx
 
 
 /*
- * The BAThistogram function calculates the frequency distribution of
- * the tail values in its operand bat. Notice, that updates on the
- * result do not affect the delta administration.
- * Construction of a histogram over a string (or complex object) can
- * be sped up using the reference information in the BUN and bulk
- * copying the heap.
- *
- * There are separate versions for each type, and for each a hash- and
- * a merge-algorithms.
- */
-#define histoloop_sorted(BUNtail, cmpfnc, TYPE)                        \
-       do {                                                    \
-               const void *prev = BUNtail(bi, BUNfirst(b));    \
-                                                               \
-               BATloop(b, p, q) {                              \
-                       v = BUNtail(bi, p);                     \
-                       if (cmpfnc(v, prev, TYPE) == 0) {       \
-                               yy++;                           \
-                       } else {                                \
-                               bunfastins(bn, prev, &yy);      \
-                               yy = 1;                         \
-                       }                                       \
-                       prev = v;                               \
-               }                                               \
-               bunfastins(bn, prev, &yy);                      \
-       } while (0)
-
-#define histoloop_merge(BUNtail, HASHloop)                             \
-       do {                                                            \
-               BATiter bni = bat_iterator(bn);                         \
-                                                                       \
-               BATloop(b, p, q) {                                      \
-                       v = BUNtail(bi, p);                             \
-                       if (BATprepareHash(bn))                         \
-                               goto bunins_failed;                     \
-                       HASHloop(bni, bn->H->hash, r, v)                \
-                               break;                                  \
-                       if (r == BUN_NONE) {                            \
-                               /* not found */                         \
-                               if (BUNins(bn, v, &yy, FALSE) == NULL)  \
-                                       goto bunins_failed;             \
-                               r = BUNlast(bn) - 1;                    \
-                       }                                               \
-                       (* (int *) BUNtloc(bni, r))++;                  \
-               }                                                       \
-               HASHdestroy(bn);                                        \
-               IMPSdestroy(bn);                                        \
-       } while (0)
-
-BAT *
-BAThistogram(BAT *b)
-{
-       BAT *bn;
-       BUN r;
-       int yy = 0, tt = 0;
-       BUN p, q;
-       BATiter bi = bat_iterator(b);
-       int tricky;
-       const void *v;
-
-       BATcheck(b, "BAThistogram");
-
-       if (b->talign == 0) {
-               b->talign = OIDnew(1);
-       }
-
-       if (b->tkey || BATcount(b) <= 1) {
-               yy = 1;
-               return BATconst(BATmirror(b), TYPE_int, &yy, TRANSIENT);
-       }
-
-       tricky = (b->ttype == TYPE_str && strElimDoubles(b->T->vheap));
-       bn = BATnew(tricky ? (b->T->width == 1 ? TYPE_bte : (b->T->width == 2 ? 
TYPE_sht : (b->T->width == 4 ? TYPE_int : TYPE_lng))) : b->ttype, TYPE_int, 
200, TRANSIENT);
-       if (bn == NULL)
-               return bn;
-
-       if (BATtordered(b) || BATtrevordered(b)) {
-               /* the important information here is that equal values
-                * are consecutive; we don't care about sortedness as
-                * such */
-               switch (ATOMstorage(bn->htype)) {
-               case TYPE_bte:
-                       histoloop_sorted(BUNtloc, simple_CMP, bte);
-                       break;
-               case TYPE_sht:
-                       histoloop_sorted(BUNtloc, simple_CMP, sht);
-                       break;
-               case TYPE_int:
-               case TYPE_flt:
-                       histoloop_sorted(BUNtloc, simple_CMP, int);
-                       break;
-               case TYPE_lng:
-               case TYPE_dbl:
-                       histoloop_sorted(BUNtloc, simple_CMP, lng);
-                       break;
-               default:
-                       tt = bn->htype;
-                       if (bn->hvarsized)
-                               histoloop_sorted(BUNtvar, atom_CMP, tt);
-                       else
-                               histoloop_sorted(BUNtloc, atom_CMP, tt);
-                       break;
-               }
-       } else {
-               switch (ATOMstorage(bn->htype)) {
-               case TYPE_bte:
-                       histoloop_merge(BUNtloc, HASHloop_bte);
-                       break;
-               case TYPE_sht:
-                       histoloop_merge(BUNtloc, HASHloop_sht);
-                       break;
-               case TYPE_int:
-               case TYPE_flt:
-                       histoloop_merge(BUNtloc, HASHloop_int);
-                       break;
-               case TYPE_lng:
-               case TYPE_dbl:
-                       histoloop_merge(BUNtloc, HASHloop_lng);
-                       break;
-               default:
-                       if (bn->hvarsized)
-                               histoloop_merge(BUNtvar, HASHloopvar);
-                       else
-                               histoloop_merge(BUNtloc, HASHlooploc);
-                       break;
-               }
-       }
-
-       /*
-        * And now correct the interpretation of the values
-        * encountered by bulk copying the heap as well
-        */
-       if (tricky) {
-               assert(b->ttype == TYPE_str);
-               bn->H->vheap = (Heap *) GDKzalloc(sizeof(Heap));
-               if (bn->H->vheap == NULL)
-                       goto bunins_failed;
-               bn->H->vheap->parentid = bn->batCacheid;
-               bn->H->vheap->farmid = BBPselectfarm(TRANSIENT, b->ttype, 
varheap);
-               if (b->T->vheap->filename) {
-                       char *nme = BBP_physical(bn->batCacheid);
-
-                       bn->H->vheap->filename = GDKfilepath(-1, NULL, nme, 
"hheap");
-                       if (bn->H->vheap->filename == NULL)
-                               goto bunins_failed;
-               }
-               if (HEAPcopy(bn->H->vheap, b->T->vheap) < 0)
-                       goto bunins_failed;
-               bn->htype = b->ttype;
-               bn->hvarsized = 1;
-               bn->H->width = b->T->width;
-               bn->H->shift = b->T->shift;
-       }
-
-       bn->hsorted = BATcount(bn) <= 1 || BATtordered(b);
-       bn->hrevsorted = BATcount(bn) <= 1 || BATtrevordered(b);
-       bn->tsorted = BATcount(bn) <= 1;
-       bn->trevsorted = BATcount(bn) <= 1;
-       bn->halign = NOID_AGGR(b->talign);
-       if (BATcount(bn) == BATcount(b))
-               ALIGNsetH(bn, BATmirror(b));
-       BATkey(bn, TRUE);
-       BATkey(BATmirror(bn), BATcount(bn) < 2);
-       bn->H->nonil = b->T->nonil;
-       if (b->ttype == TYPE_bit) {
-               BATiter bni = bat_iterator(bn);
-               bit trueval = TRUE;
-               BUN p = BUNfnd(bn, &trueval);
-
-               BATsetprop_wrd(b, GDK_AGGR_SIZE, (p != BUN_NONE) ? *(int *) 
BUNtloc(bni, p) : 0);
-       }
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to