Changeset: c857a626d709 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c857a626d709
Modified Files:
monetdb5/modules/mosaic/mosaic.c
monetdb5/modules/mosaic/mosaic.h
monetdb5/modules/mosaic/mosaic_hdr.c
Branch: mosaic
Log Message:
Small additions
diffs (112 lines):
diff --git a/monetdb5/modules/mosaic/mosaic.c b/monetdb5/modules/mosaic/mosaic.c
--- a/monetdb5/modules/mosaic/mosaic.c
+++ b/monetdb5/modules/mosaic/mosaic.c
@@ -238,7 +238,7 @@ MOSprepareEstimate(MOStask task) {
static str MOSestimate_inner_##TPE(MOStask task, MosaicEstimation* current,
const MosaicEstimation* previous) {\
\
BUN max_compression_length = 0;\
- MosaicEstimation estimations[MOSAICINDEX];\
+ MosaicEstimation estimations[MOSAIC_METHODS];\
const int size = sizeof(estimations) / sizeof(MosaicEstimation);\
for (int i = 0; i < size; i++) {\
estimations[i].uncompressed_size = previous->uncompressed_size;\
diff --git a/monetdb5/modules/mosaic/mosaic.h b/monetdb5/modules/mosaic/mosaic.h
--- a/monetdb5/modules/mosaic/mosaic.h
+++ b/monetdb5/modules/mosaic/mosaic.h
@@ -40,9 +40,7 @@
#define MOSAIC_PREFIX 7 // prefix/postfix bitwise compression
#define MOSAIC_EOL 8 // marker for the last block
-//Compression should have a significant reduction to apply.
-#define COMPRESS_THRESHOLD 50 //percent
-#define MOSAICINDEX 8 //> 2 elements
+#define METHOD_NOT_AVAILABLE -1
/*
* The header is reserved for meta information, e.g. oid indices.
@@ -50,11 +48,11 @@
*/
typedef Heap *mosaic; // compressed data is stored on a heap.
-#define METHOD_NOT_AVAILABLE -1
#define IS_NIL(TPE, VAL) is_##TPE##_nil(VAL)
#define ARE_EQUAL(v, w, HAS_NIL, TPE) ((v == w || (HAS_NIL && IS_NIL(TPE, v)
&& IS_NIL(TPE, w)) ) )
+/* For compression techniques based on value differences, we need the storage
type */
#define Deltabte uint8_t
#define Deltasht uint16_t
#define Deltaint uint32_t
@@ -72,7 +70,7 @@ typedef Heap *mosaic; // compressed data
#define GET_DELTA(TPE, x, y) ((DeltaTpe(TPE)) x - (DeltaTpe(TPE)) y)
#define ADD_DELTA(TPE, x, d) (TPE) ((DeltaTpe(TPE)) x + (DeltaTpe(TPE)) d)
-// types for safe Integer Promotion for the bitwise operations in getSuffixMask
+// Storage types for safe Integer Promotion for the bitwise operations in
getSuffixMask
#define IPbte uint32_t
#define IPsht uint32_t
#define IPint uint32_t
@@ -87,9 +85,9 @@ typedef Heap *mosaic; // compressed data
#define IPTpe(TPE) IP##TPE
typedef struct MOSAICHEADER{
- int version;
- int top; // TODO: rename to e.g. nblocks because it is the number of
blocks
- flt ratio; //compresion ratio
+ int version; // to recognize the underlying implementation
used.
+ int top; // TODO: rename to e.g. nblocks because
it is the number of blocks
+ flt ratio; // Compresion ratio achieved
/* Collect compression statistics for the particular task
* A value of METHOD_NOT_AVAILABLE in blks or elms indicates that the
corresponding method wasn't considered as candidate.
*/
@@ -106,6 +104,10 @@ typedef struct MOSAICHEADER{
BUN length_capped;
} * MosaicHdr;
+/* Each compressed block comes with a small header.
+ * It contains the compression type and the number of elements it covers
+ */
+
#define CNT_BITS 24
#define MOSAICMAXCNT ((1 << CNT_BITS) - 1)
@@ -171,6 +173,10 @@ typedef struct MOSTASK{
} *MOStask;
+/* The compressor is built around a two phase process
+ * where in the first phase we collect the structure of
+ * the final mosaic file
+ */
typedef struct _MosaicEstimation {
BUN compressed_size;
BUN uncompressed_size;
diff --git a/monetdb5/modules/mosaic/mosaic_hdr.c
b/monetdb5/modules/mosaic/mosaic_hdr.c
--- a/monetdb5/modules/mosaic/mosaic_hdr.c
+++ b/monetdb5/modules/mosaic/mosaic_hdr.c
@@ -3,12 +3,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
- * Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
+ * Copyright 1997 - July 2008 CWI, August 2008 - 2018 MonetDB B.V.
*/
/*
- * authors Martin Kersten, Aris Koning
- * The header block contains the mapping from OIDs to chunks
+ * authors Martin Kersten, Aris Koning
+ * The header block contains the mapping from OIDs to chunks, which should
become
+ * the basis for processing mitosis over a mosaic file.
*/
#include "monetdb_config.h"
@@ -24,7 +25,7 @@ MOSupdateHeader(MOStask task)
hdr->blks[MOSgetTag(task->blk)]++;
hdr->elms[MOSgetTag(task->blk)] += MOSgetCnt(task->blk);
- if( hdr->top < MOSAICINDEX-1 ){
+ if( hdr->top < MOSAIC_METHODS-1 ){
if( hdr->top == 0){
hdr->top++;
}
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list