Changeset: 44e6c2b9abe3 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=44e6c2b9abe3
Modified Files:
gdk/gdk_align.mx
Branch: headless
Log Message:
Merge
diffs (truncated from 1184 to 300 lines):
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -891,7 +891,6 @@
dirtyflushed:1, /* was dirty before commit started? */
descdirty:1, /* bat descriptor dirty marker */
lview:1, /* bat is a *logical* view on parentid */
- set:1, /* real set semantics */
restricted:2, /* access priviliges */
persistence:2, /* should the COL persist on disk? */
unused:21; /* value=0 for now */
@@ -1480,7 +1479,6 @@
gdk_export BUN BATguess(COL *b);
gdk_export BUN BATgrows(COL *b);
gdk_export COL *BATkey(COL *b, int onoff);
-gdk_export COL *BATset(COL *b, int onoff);
gdk_export COL *BATmode(COL *b, int onoff);
gdk_export COL *BATroles(COL *b, const char *nme);
gdk_export COL *BATcol_name(COL *b, const char *nme);
@@ -1734,7 +1732,7 @@
#define BATordered(b) (((b)->type == TYPE_void)?GDK_SORTED:(b)->sorted)
#define BATdense(b) (BATvoid(b) && (b)->seqbase != oid_nil)
#define BATvoid(b) (((b)->dense&(b)->sorted&1) || (b)->type==TYPE_void)
-#define BATkey(b) (b->key != FALSE || BATdense(b))
+#define BATiskey(b) (b->key != FALSE || BATdense(b))
/* set some properties that are trivial to deduce */
#define BATsettrivprop(b) \
@@ -2713,8 +2711,6 @@
* @item int
* @tab ALIGNsync (BAT *b1, BAT *b2)
* @item int
- * @tab ALIGNrelated (BAT *b1, BAT *b2)
- * @item int
* @tab ALIGNsetH ((BAT *dst, BAT *src)
*
* @item BAT *
@@ -2739,10 +2735,8 @@
* @end multitable
* @
* Alignments of two columns of a BAT means that the system knows
- * whether these two columns are exactly equal. Relatedness of two
- * BATs means that one pair of columns (either head or tail) of
- * both BATs is aligned. The first property is checked by @%ALIGNsynced@,
- * the latter by @%ALIGNrelated@.
+ * whether these two columns are exactly equal. The property is
+ * checked by @%ALIGNsynced@.
* @
* The @%BATpropcheck@ examines a BAT and tries to set all applicable
* properties (key,sorted,align,dense).
@@ -2771,7 +2765,6 @@
*
*/
gdk_export int ALIGNsynced(COL *b1, COL *b2);
-gdk_export int ALIGNrelated(COL *b1, COL *b2);
gdk_export COL *BATpropcheck(COL *b, int mode);
@@ -2781,13 +2774,8 @@
gdk_export COL *VIEWcreate(COL *b);
gdk_export COL *VIEWcreate_(COL *b, int stable);
-gdk_export COL *VIEWhead(COL *b);
-gdk_export COL *VIEWhead_(COL *b, int mode);
-gdk_export COL *VIEWcombine(COL *b);
gdk_export COL *VIEWreset(COL *b);
-gdk_export COL *BATmaterialize(COL *b);
-gdk_export COL *BATmaterializeh(COL *b);
-gdk_export COL *BATmaterializet(COL *b);
+gdk_export COL *COLmaterialize(COL *b);
gdk_export void VIEWdestroy(COL *b);
gdk_export void VIEWbounds(COL *b, COL *view, BUN l, BUN h);
gdk_export void VIEWunlink(COL *b);
diff --git a/gdk/gdk_align.mx b/gdk/gdk_align.c
rename from gdk/gdk_align.mx
rename to gdk/gdk_align.c
--- a/gdk/gdk_align.mx
+++ b/gdk/gdk_align.c
@@ -1,155 +1,158 @@
-@/
-The contents of this file are subject to the MonetDB Public License
-Version 1.1 (the "License"); you may not use this file except in
-compliance with the License. You may obtain a copy of the License at
-http://monetdb.cwi.nl/Legal/MonetDBLicense-1.1.html
+/*
+ * The contents of this file are subject to the MonetDB Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://monetdb.cwi.nl/Legal/MonetDBLicense-1.1.html
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the MonetDB Database System.
+ *
+ * The Initial Developer of the Original Code is CWI.
+ * Portions created by CWI are Copyright (C) 1997-July 2008 CWI.
+ * Copyright August 2008-2011 MonetDB B.V.
+ * All Rights Reserved.
+ */
-Software distributed under the License is distributed on an "AS IS"
-basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
-License for the specific language governing rights and limitations
-under the License.
+/*
+ * @f gdk_align
+ * @a Peter Boncz, Niels Nes
+ * @* BAT Alignment
+ * For BATs that result from a n-ary relational scheme it may help to
+ * align the BATs on their head value. In particular, it permits
+ * replacing a hash-join by a merge-join, which is significantly
+ * faster on large tables. Especially if the BATs involved cause page
+ * activity or when you can not afford the large hash structures to
+ * speed-up processing.
+ *
+ * For orthogonality, we support alignment between arbitrary columns
+ * (head or tail).
+ *
+ * All standard GDK set-calls update the alignment info in their
+ * respective ways. For example, the routine @emph{BUNclustercopy}
+ * shuffles the first argument, such that the BUNs are in the same
+ * order as those in the second argument. This operation will mark
+ * both columns of the first @emph{BAT} as synced with the second
+ * (likewise, @emph{BATcopy()}, which makes a copy, instead of
+ * in-place shuffling, has the same alignment effect, @emph{BATmark()}
+ * marks the tail column as synced with the head of the original
+ * @emph{BAT}, and for instance @emph{BATsemijoin()} marks both return
+ * columns as aligned with its left parameter).
+ *
+ * Each alignment sequence is given a unique identifier, so as to
+ * easily detect this situation. It is retained in the @emph{BAT
+ * descriptor}. @+ Alignment Design Considerations Alignment
+ * primitives require the right hooks to be inserted in several places
+ * in the GDK, apart form this file:
+ * @itemize
+ * @item @emph{ BUN update operations}.
+ * The updated BATs have to be marked as
+ * un-aligned.
+ * @item @emph{ set operations}.
+ * For most relational operations some
+ * statements can be made about the size and order of the BATs
+ * they produce. This information can be formalized by indicating alignment
+ * information automatically.
+ * @item @emph{ transaction operations}.
+ * Alignment statuses must be
+ * kept consistent under database commits and aborts.
+ * @end itemize
+ *
+ * As for performance, the most important observation to make is that
+ * operations that do not need alignment, will suffer most from
+ * overheads introduced in the BUN update mechanism. For this reason,
+ * the alignment-delete operation has to be very cheap. It is captured
+ * by the @emph{ALIGNdel} macro, and just zaps one character field in
+ * the @emph{BAT} record.
+ *
+ * @+ Alignment Implementation
+ * The @emph{BAT} record is equipped with an @emph{batAlign} field
+ * that keeps both information about the head and tail column. The
+ * leftmost 4 bits are for the head, the rightmost 4 for the
+ * tail. This has been done to make the zap ultra-cheap.
+ *
+ * Both head and tail column contain an OID in the @emph{halign} and
+ * @emph{talign} fields respectively to mark their alignment
+ * group. All BATs with the same OID in this field (and the
+ * ALIGN_SYNCED bit on) are guaranteed by the system to have equal
+ * head columns. As an exception, they might also have TYPE_void head
+ * columns (a virtual column). In such a case, the tail values
+ * correspond to the head values that would have been there in a
+ * non-virtual column, continuing the same head-sequence as the other
+ * BATs in the sync group.
+ */
-The Original Code is the MonetDB Database System.
-
-The Initial Developer of the Original Code is CWI.
-Portions created by CWI are Copyright (C) 1997-July 2008 CWI.
-Copyright August 2008-2011 MonetDB B.V.
-All Rights Reserved.
-@
-
-@f gdk_align
-@a Peter Boncz, Niels Nes
-@* BAT Alignment
-For BATs that result from a n-ary relational scheme it may help to
-align the BATs on their head value. In particular, it permits
-replacing a hash-join by a merge-join, which is significantly faster
-on large tables. Especially if the BATs involved cause page activity
-or when you can not afford the large hash structures to speed-up processing.
-@-
-For orthogonality, we support alignment between arbitrary columns (head or
tail).
-@-
-All standard GDK set-calls update the alignment info in their respective
-ways. For example, the routine @emph{BUNclustercopy} shuffles the first
argument,
-such that the BUNs are in the same order as those in the second argument.
-This operation will mark both columns of the first @emph{BAT} as synced with
-the second (likewise, @emph{BATcopy()}, which makes a copy, instead of
in-place
-shuffling, has the same alignment effect, @emph{BATmark()} marks the tail
column
-as synced with the head of the original @emph{BAT}, and for
-instance @emph{BATsemijoin()} marks both return columns as aligned with its
left parameter).
-
-Each alignment sequence is given a unique identifier, so as to easily
-detect this situation. It is retained in the @emph{BAT descriptor}.
-@+ Alignment Design Considerations
-Alignment primitives require the right hooks to be inserted in
-several places in the GDK, apart form this file:
-@itemize
-@item @emph{ BUN update operations}.
-The updated BATs have to be marked as
-un-aligned.
-@item @emph{ set operations}.
-For most relational operations some
-statements can be made about the size and order of the BATs
-they produce. This information can be formalized by indicating alignment
-information automatically.
-@item @emph{ transaction operations}.
-Alignment statuses must be
-kept consistent under database commits and aborts.
-@end itemize
-
-As for performance, the most important observation to make is that
-operations that do not need alignment, will suffer most from
-overheads introduced in the BUN update mechanism. For this reason,
-the alignment-delete operation has to be very cheap. It is
-captured by the @emph{ALIGNdel} macro, and just zaps one character
-field in the @emph{BAT} record.
-@
-@{
-@+ Alignment Implementation
-The @emph{BAT} record is equipped with an @emph{batAlign} field that keeps
-both information about the head and tail column. The leftmost
-4 bits are for the head, the rightmost 4 for the tail. This
-has been done to make the zap ultra-cheap.
-
-Both head and tail column contain an OID in the @emph{halign} and @emph{talign}
-fields respectively to mark their alignment group. All BATs with the
-same OID in this field (and the ALIGN_SYNCED bit on) are guaranteed
-by the system to have equal head columns. As an exception, they
-might also have TYPE_void head columns (a virtual column).
-In such a case, the tail values correspond to the head values
-that would have been there in a non-virtual column, continuing
-the same head-sequence as the other BATs in the sync group.
-@c
#include "monetdb_config.h"
#include "gdk.h"
int
-ALIGNcommit(BAT *b)
+ALIGNcommit(COL *b)
{
BATcheck(b, "ALIGNcommit");
- if (!b->halign) {
- b->halign = OIDnew(1);
- }
- if (!b->talign) {
- b->talign = OIDnew(1);
+ if (!b->align) {
+ b->align = OIDnew(1);
}
return 0;
}
int
-ALIGNundo(BAT *b)
+ALIGNundo(COL *b)
{
BATcheck(b, "ALIGNundo");
return 0;
}
int
-ALIGNsetH(BAT *b1, BAT *b2)
+ALIGNset(COL *b1, COL *b2)
{
ssize_t diff;
- BATcheck(b1, "ALIGNsetH: bat 1 required");
- BATcheck(b2, "ALIGNsetH: bat 2 required");
+ BATcheck(b1, "ALIGNsetH: COL 1 required");
+ BATcheck(b2, "ALIGNsetH: COL 2 required");
diff = (ssize_t) (BUNfirst(b1) - BUNfirst(b2));
- if (b2->halign == 0) {
- b2->halign = OIDnew(1);
- b2->batDirtydesc = TRUE;
+ if (b2->align == 0) {
+ b2->align = OIDnew(1);
+ b2->descdirty = TRUE;
} else {
/* propagate GDK_AGGR information */
BATpropagate(b1, b2, GDK_AGGR_SIZE);
BATpropagate(b1, b2, GDK_AGGR_CARD);
}
- if (BAThvoid(b2)) {
+ if (BATvoid(b2)) {
/* b2 is either dense or has a void(nil) head */
- if (b1->htype != TYPE_void)
- b1->hdense = TRUE;
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list