Changeset: 44739044dfc8 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=44739044dfc8
Modified Files:
gdk/gdk_relop.mx
Branch: default
Log Message:
Only comment and whitespace changes.
diffs (truncated from 978 to 300 lines):
diff --git a/gdk/gdk_relop.mx b/gdk/gdk_relop.mx
--- a/gdk/gdk_relop.mx
+++ b/gdk/gdk_relop.mx
@@ -63,7 +63,8 @@ All Rights Reserved.
BUN _rcount = BATcount(r);
BUN _slices = 0;
- /* limit estimate with simple bounds first; only spend effort
if the join result might be big */
+ /* limit estimate with simple bounds first; only spend
+ * effort if the join result might be big */
if (@1 == JOIN_EQ) {
if (l->tkey)
@3 = r->hkey ? MIN(_rcount, _lcount) : _rcount;
@@ -168,7 +169,7 @@ All Rights Reserved.
@:joinestimate(@1, @2, _estimate)@
bn = BATnew(BAThtype(l), BATttype(r), _estimate);
- if (bn == NULL)
+ if (bn == NULL)
return bn;
}
@
@@ -224,7 +225,8 @@ All Rights Reserved.
/* lookup value in r (if not nil, that is) */
if (!@1_EQ(v1, nil, @4)) {
if (r_scan > 0) {
- /* first try scanning; but give up
after a while */
+ /* first try scanning; but
+ * give up after a while */
for (r_lim = MIN(r_last, r_end +
r_scan); r_end < r_lim; r_end++) {
v2 = BUNh@3(ri, r_end);
neq = @1_CMP(v1, v2, @4);
@@ -234,16 +236,23 @@ All Rights Reserved.
r_start = r_end;
}
if (neq == 1) {
- /* use binary search after failed scan
or if scanning is impossible (l not sorted) */
+ /* use binary search after
+ * failed scan or if scanning
+ * is impossible (l not
+ * sorted) */
if (r_scan < 0 || r_start < r_last) {
- /* if merge not ended (or if no
merge at all) */
+ /* if merge not ended
+ * (or if no merge at
+ * all) */
r_start = SORTfndfirst(rr, v1);
}
if (r_start < r_last) {
v2 = BUNh@3(ri, r_start);
neq = !@1_EQ(v1, v2, @4);
} else if (r_scan >= 0) {
- /* r is already at end => break
off merge join */
+ /* r is already at end
+ * => break off merge
+ * join */
break;
}
}
@@ -274,7 +283,8 @@ All Rights Reserved.
}
@
@c
-/* serves both normal equi-join (nil_on_miss==NULL) and outerjoin
(nil_on_miss=nil) */
+/* serves both normal equi-join (nil_on_miss==NULL) and outerjoin
+ * (nil_on_miss=nil) */
static BAT *
mergejoin(BAT *l, BAT *r, BAT *bn, ptr nil_on_miss, BUN estimate, BUN *limit)
{
@@ -295,7 +305,8 @@ mergejoin(BAT *l, BAT *r, BAT *bn, ptr n
BUN i;
int logr = 4;
- /* 4*log2(r.count) = estimation of the cost of binary search in
units of scan comparisons */
+ /* 4*log2(r.count) = estimation of the cost of binary
+ * search in units of scan comparisons */
for (i = BATcount(r); i > 0; logr++)
i >>= 1;
r_scan = logr; /* opportunistic scan window in r */
@@ -354,7 +365,8 @@ mergejoin(BAT *l, BAT *r, BAT *bn, ptr n
@:mergejoin(atom,var,loc,loc)@
}
} else {
- /* we can't handle void r anyway, so don't worry about
it here */
+ /* we can't handle void r anyway, so don't
+ * worry about it here */
loc = ATOMstorage(l->ttype);
@:mergejoin(atom,loc,loc,loc)@
}
@@ -417,7 +429,8 @@ batmergejoin(BAT *l, BAT *r, BUN estimat
{
@:joincheck(BATmergejoin,l->ttype,r->htype)@
if (BAThdense(r) || (swap && BATtdense(l))) {
- /* batmergejoin can't handle void tail columns at all
(fetchjoin is better anyway) */
+ /* batmergejoin can't handle void tail columns at all
+ * (fetchjoin is better anyway) */
BAT *left = limit ? BATslice(l, 0, *limit) : l;
BAT *bn = batfetchjoin(left, r, estimate, swap, FALSE);
if (limit)
@@ -425,7 +438,8 @@ batmergejoin(BAT *l, BAT *r, BUN estimat
return bn;
}
if (swap && (!BAThordered(r) || (BATtordered(l) && BATcount(l) >
BATcount(r)))) {
- /* reverse join if required (r not sorted) or if l is larger
(quick jump through l with binary search) */
+ /* reverse join if required (r not sorted) or if l is
+ * larger (quick jump through l with binary search) */
BAT *bn = mergejoin(BATmirror(r), BATmirror(l), NULL, NULL,
estimate, limit);
return bn ? BATmirror(bn) : NULL;
@@ -443,8 +457,8 @@ BATmergejoin(BAT *l, BAT *r, BUN estimat
BAT *
BATleftmergejoin(BAT *l, BAT *r, BUN estimate)
{
- /* do not swap left and right input,
- and hence maintain order of left head in result */
+ /* do not swap left and right input, and hence maintain order
+ * of left head in result */
return batmergejoin(l, r, estimate, FALSE, NULL);
}
@@ -817,7 +831,7 @@ defaultfetchjoin_@1_@2(BAT *bn, BAT *l,
BATaccessBegin(l, USE_TAIL, MMAP_SEQUENTIAL);
/* use MMAP_WILLNEED only if random access is not too scattered, *
* i.e., only if number of lookups is more than 10% of inner BAT */
- if (BATcount(l) > BATcount(r)/10)
+ if (BATcount(l) > BATcount(r)/10)
BATaccessBegin(r, USE_TAIL, MMAP_WILLNEED);
BATloop(l, l_cur, l_end) {
BUN _yy = (BUN) (offset + * (oid *) BUNtloc(li, l_cur));
@@ -835,10 +849,10 @@ defaultfetchjoin_@1_@2(BAT *bn, BAT *l,
BATaccessEnd(l, USE_TAIL, MMAP_SEQUENTIAL);
/* use MMAP_WILLNEED only if random access is not too scattered, *
* i.e., only if number of lookups is more than 10% of inner BAT */
- if (BATcount(l) > BATcount(r)/10)
+ if (BATcount(l) > BATcount(r)/10)
BATaccessEnd(r, USE_TAIL, MMAP_WILLNEED);
if (nondense) {
- BATiter bni;
+ BATiter bni;
/* not (yet?) completely type-optimized ! */
ALGODEBUG THRprintf(GDKout, "#BATfetchjoin:
defaultvoidfetchjoin(@1): discovered non-density, resuming with non-void
head\n");
bn = BATnew(BAThtype(l), ATOMtype(tpe), BATcount(l));
@@ -867,12 +881,14 @@ defaultfetchjoin_@1_@2(BAT *bn, BAT *l,
@c
@= voidfetchjoin
if (BATtdense(l)) {
- /* dense => ordered, i.e., we did check the bounderies already
above */
- /* and we can do a "synchronized walk" through l & r */
+ /* dense => ordered, i.e., we did check the bounderies
+ * already above and we can do a "synchronized walk"
+ * through l & r */
ALGODEBUG THRprintf(GDKout, "#BATfetchjoin: BAThvoid(l) &&
!BATtvoid(l) && BATtdense(l)\n");
@:densevoidfetchjoin(@1)@
} else if (BATtordered(l) || hitalways) {
- /* we did check the bounderies already above BATtordered(l) or
simply "trust" hitalways */
+ /* we did check the bounderies already above
+ * BATtordered(l) or simply "trust" hitalways */
ALGODEBUG THRprintf(GDKout, "#BATfetchjoin: BAThvoid(l) &&
!BATtvoid(l) && !BATtdense(l) && ( BATtordered(l) [== %d] || hitalways [== %d]
)\n", BATtordered(l), (int)hitalways);
@:orderedvoidfetchjoin(@1)@
} else {
@@ -917,14 +933,16 @@ batfetchjoin(BAT *l, BAT *r, BUN estimat
} else {
ERRORcheck(!BAThdense(r), "BATfetchjoin: head column of right
input must be dense");
}
- /* not checking boundaries is very dangerous; use regression tests with
debugmask=8 first */
+ /* not checking boundaries is very dangerous; use regression
+ * tests with debugmask=8 first */
PROPDEBUG {
hitalways_check = hitalways;
hitalways = FALSE;
}
if (lcount == 0 || rcount == 0) {
- /* below range checking do not support empty bats. so treat
them separately (easy) */
+ /* below range checking do not support empty bats. so
+ * treat them separately (easy) */
@:return_empty_join_result(l_orig,r, BATfetchjoin: |l|==0 or
|r|==0,1)@
@= return_empty_join_result
ALGODEBUG THRprintf(GDKout, "#@3 => empty result\n");
@@ -951,7 +969,8 @@ batfetchjoin(BAT *l, BAT *r, BUN estimat
@
@c
} else if (hitalways && BATtdense(l) && BAThdense(r) && l->tseqbase ==
r->hseqbase) {
- /* always hit and tail of left is alligned with head of right */
+ /* always hit and tail of left is alligned with head
+ * of right */
ALGODEBUG THRprintf(GDKout, "#BATfetchjoin: BATtdense(l) &&
BAThdense(r)\n");
ALGODEBUG THRprintf(GDKout, "#BATfetchjoin: VIEWcreate(l,r)\n");
@@ -963,7 +982,8 @@ batfetchjoin(BAT *l, BAT *r, BUN estimat
return VIEWcreate(l, l);
} else if (BATtordered(l)) {
- /* optimization to be able to carry over more void head columns
*/
+ /* optimization to be able to carry over more void
+ * head columns */
/* (only needed if neither operand is empty) */
oid r_lo = *(oid *) BUNhead(ri, BUNfirst(r));
oid r_hi = *(oid *) BUNhead(ri, BUNlast(r) - 1);
@@ -1035,12 +1055,15 @@ batfetchjoin(BAT *l, BAT *r, BUN estimat
/* TODO: apply the "string trick" (see below) here too */
if (BATtdense(l)) {
- /* dense => ordered, i.e., we did check the bounderies
already above */
- /* and we can do a "synchronized walk" through l & r */
+ /* dense => ordered, i.e., we did check the
+ * bounderies already above and we can do a
+ * "synchronized walk" through l & r */
ALGODEBUG THRprintf(GDKout, "#BATfetchjoin:
!BAThvoid(l) && BATtdense(l)\n");
@:fetchjoin_switch_lht(dense)@
} else if (BATtordered(l) || hitalways) {
- /* we did check the bounderies already above
BATtordered(l) or simply "trust" hitalways */
+ /* we did check the bounderies already above
+ * BATtordered(l) or simply "trust"
+ * hitalways */
ALGODEBUG THRprintf(GDKout, "#BATfetchjoin:
!BAThvoid(l) && !BATtdense(l) && ( BATtordered(l) [== %d] || hitalways [== %d]
)\n", BATtordered(l), (int) hitalways);
@:fetchjoin_switch_lht(ordered)@
} else {
@@ -1092,7 +1115,7 @@ batfetchjoin(BAT *l, BAT *r, BUN estimat
ALGODEBUG THRprintf(GDKout, "#BATfetchjoin: BAThvoid(l) &&
!BATtvoid(l)\n");
- if (ATOMstorage(tpe) == TYPE_str &&
+ if (ATOMstorage(tpe) == TYPE_str &&
/* GDK_ELIMDOUBLES(r->T->vheap) && */
(!rcount || (lcount << 3) > rcount)) {
/* insert double-eliminated strings as ints */
@@ -1165,7 +1188,8 @@ batfetchjoin(BAT *l, BAT *r, BUN estimat
bn->T->shift = r->T->shift;
}
if (nondense) {
- /* if join columns are ordered, head inherits ordering
*/
+ /* if join columns are ordered, head inherits
+ * ordering */
bn->hsorted = BATtordered(l) & BAThordered(r) &
BAThordered(l);
bn->hrevsorted = BATtordered(l) & BAThordered(r) &
BAThrevordered(l);
} else {
@@ -1249,13 +1273,12 @@ BAT *
BATleftfetchjoin(BAT *l, BAT *r, BUN estimate)
{
/* fetchjoin now implies that you assure no fetch misses (hitalways) */
- /* do not swap left and right input,
- and hence maintain order of left head in result */
+ /* do not swap left and right input, and hence maintain order
+ * of left head in result */
return batfetchjoin(l, r, estimate, FALSE, TRUE);
}
/*
- * @-
* This routine does the join optimization.
*/
static BAT *
@@ -1280,7 +1303,6 @@ batjoin(BAT *l, BAT *r, BUN estimate, bi
@:return_empty_join_result(l,r, BATjoin: |l|==0 or |r|==0 or
tail(l)==NIL or head(r)==NIL,0)@
}
/*
- * @-
* collect statistics that help us decide what to do
*/
lsize = lcount * (Hsize(l) + Tsize(l)) + (l->H->vheap ?
l->H->vheap->size : 0) + (l->T->vheap ? l->T->vheap->size : 0) + 2 * lcount *
sizeof(BUN);
@@ -1293,7 +1315,7 @@ batjoin(BAT *l, BAT *r, BUN estimate, bi
rfetch = BAThdense(r);
lfetch = BATtdense(l);
/* in case of fetchjoin, make sure we propagate a non-join
- void column */
+ * void column */
if (lfetch && rfetch) {
if (BAThvoid(l) && !BATtvoid(r))
lfetch = 0;
@@ -1301,7 +1323,7 @@ batjoin(BAT *l, BAT *r, BUN estimate, bi
rfetch = 0;
}
/* in case of fetchjoin, make sure we exploit sortedness for
- sequential access */
+ * sequential access */
if (lfetch && rfetch) {
if (BATtordered(l) && !BAThordered(r))
lfetch = 0;
@@ -1310,63 +1332,75 @@ batjoin(BAT *l, BAT *r, BUN estimate, bi
}
must_hash = swap && rsize > lsize ? l->T->hash == NULL : r->H->hash ==
NULL;
/*
- * @-
- * Inner input out of memory => sort-merge-join performs better than
hash-join or even random-access fetch-join.
+ * Inner input out of memory => sort-merge-join performs
+ * better than hash-join or even random-access fetch-join.
*/
if (((swap && MIN(lsize, rsize) > mem_size) ||
(!swap && rsize > mem_size)) &&
!(BATtordered(l) & BAThordered(r))) {
/* inner input out of memory, but not both sorted
- (sequential-access fetch/merge handled by special
- cases below) */
+ * (sequential-access fetch/merge handled by special
+ * cases below) */
if (BATtordered(l) || swap) {
/* left tail already sorted (i.e., no re-order
- required) or left-order-preserving not
- required (i.e., re-order allowed) */
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list