Changeset: c8106d92c513 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c8106d92c513
Modified Files:
monetdb5/modules/mosaic/mosaic.c
monetdb5/modules/mosaic/mosaic.h
monetdb5/modules/mosaic/mosaic_dictionary.c
monetdb5/modules/mosaic/mosaic_frame.c
monetdb5/optimizer/opt_pipes.c
sql/backends/monet5/sql.mal
sql/backends/monet5/sql_mosaic.c
sql/scripts/76_mosaic.sql
sql/test/mosaic/Tests/mix.sql
Branch: mosaic
Log Message:
Cleanup layout and debugging
diffs (216 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
@@ -76,11 +76,10 @@ MOSdumpTask(Client cntxt,MOStask task)
}
str
-MOSlayout(Client cntxt, BAT *b, BAT *btech, BAT *bcount, BAT *binput, BAT
*boutput, BAT *bproperties, str compressionscheme)
+MOSlayout(Client cntxt, BAT *b, BAT *btech, BAT *bcount, BAT *binput, BAT
*boutput, BAT *bproperties)
{
MOStask task=0;
- int i,ret,bid;
- BAT *bn= NULL;
+ int i;
char buf[BUFSIZ];
lng zero=0;
@@ -90,19 +89,6 @@ MOSlayout(Client cntxt, BAT *b, BAT *bte
if( b->tmosaic == NULL)
throw(MAL,"mosaic.layout","Compression heap missing");
- if(compressionscheme){
- //create a tempory compressed column
- for( i = 0; i< MOSAIC_METHODS; i++)
- task->filter[i]= strstr(compressionscheme,
MOSfiltername[i]) != 0;
- bid = b->batCacheid;
- MOScompressInternal(cntxt, &ret, &bid, task,FALSE);
- if( ret == 0)
- throw(MAL,"mosaic.layout","Compression failed");
- bn = BATdescriptor(ret);
- if( bn == NULL)
- throw(MAL,"mosaic.layout", RUNTIME_OBJECT_MISSING);
- b = bn;
- }
MOSinit(task,b);
MOSinitializeScan(cntxt,task,0,task->hdr->top);
@@ -116,26 +102,24 @@ MOSlayout(Client cntxt, BAT *b, BAT *bte
BUNappend(bproperties, buf, FALSE);
for(i=0; i < MOSAIC_METHODS-1; i++){
lng zero = 0;
- snprintf(buf,BUFSIZ,"%s_blks", MOSfiltername[i]);
+ snprintf(buf,BUFSIZ,"%s blocks", MOSfiltername[i]);
BUNappend(btech, buf, FALSE);
- BUNappend(bcount, &zero, FALSE);
- BUNappend(binput, &task->hdr->blks[i], FALSE);
- BUNappend(boutput, &zero , FALSE);
- BUNappend(bproperties, "", FALSE);
-
- snprintf(buf,BUFSIZ,"%s_elms", MOSfiltername[i]);
- BUNappend(btech, buf, FALSE);
- BUNappend(bcount, &zero, FALSE);
+ BUNappend(bcount, &task->hdr->blks[i], FALSE);
BUNappend(binput, &task->hdr->elms[i], FALSE);
BUNappend(boutput, &zero , FALSE);
BUNappend(bproperties, "", FALSE);
-
}
if( task->hdr->blks[MOSAIC_FRAME])
MOSlayout_frame_hdr(cntxt,task,btech,bcount,binput,boutput,bproperties);
if( task->hdr->blks[MOSAIC_DICT])
MOSlayout_dictionary_hdr(cntxt,task,btech,bcount,binput,boutput,bproperties);
+ BUNappend(btech, "========", FALSE);
+ BUNappend(bcount, &zero, FALSE);
+ BUNappend(binput, &zero, FALSE);
+ BUNappend(boutput, &zero , FALSE);
+ BUNappend(bproperties, "", FALSE);
+
while(task->start< task->stop){
switch(MOSgetTag(task->blk)){
case MOSAIC_NONE:
@@ -170,8 +154,6 @@ MOSlayout(Client cntxt, BAT *b, BAT *bte
assert(0);
}
}
- if( bn)
- BBPunfix(bn->batCacheid);
return MAL_SUCCEED;
}
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
@@ -232,7 +232,7 @@ mal_export str MOSthetasubselect(Client
mal_export str MOSprojection(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
InstrPtr pci);
mal_export str MOSsubjoin(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr
pci);
mal_export str MOSdump(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr
pci);
-mal_export str MOSlayout(Client cntxt, BAT *b, BAT *btech, BAT *bcount, BAT
*binput, BAT *boutput, BAT *bproperties, str compressionscheme);
+mal_export str MOSlayout(Client cntxt, BAT *b, BAT *btech, BAT *bcount, BAT
*binput, BAT *boutput, BAT *bproperties);
mal_export str MOSsliceInternal(Client cntxt, bat *slices, BUN size, BAT *b);
mal_export int MOSanalyseInternal(Client cntxt, int threshold, MOStask task,
bat bid);
mal_export void MOSanalyseReport(Client cntxt, BAT *b, BAT *btech, BAT
*output, BAT *factor, BAT *run, str compressions);
diff --git a/monetdb5/modules/mosaic/mosaic_dictionary.c
b/monetdb5/modules/mosaic/mosaic_dictionary.c
--- a/monetdb5/modules/mosaic/mosaic_dictionary.c
+++ b/monetdb5/modules/mosaic/mosaic_dictionary.c
@@ -114,11 +114,12 @@ MOSlayout_dictionary_hdr(Client cntxt, M
(void) cntxt;
for(i=0; i< task->hdr->dictsize; i++){
- MOSdump_dictionaryInternal(buf, BUFSIZ, task,i);
- BUNappend(btech, "dictionary_hdr", FALSE);
+ snprintf(buf, BUFSIZ,"dictionary[%d]",i);
+ BUNappend(btech, buf, FALSE);
BUNappend(bcount, &zero, FALSE);
BUNappend(binput, &zero, FALSE);
BUNappend(boutput, &task->hdr->dictfreq[i], FALSE);
+ MOSdump_dictionaryInternal(buf, BUFSIZ, task,i);
BUNappend(bproperties, buf, FALSE);
}
}
diff --git a/monetdb5/modules/mosaic/mosaic_frame.c
b/monetdb5/modules/mosaic/mosaic_frame.c
--- a/monetdb5/modules/mosaic/mosaic_frame.c
+++ b/monetdb5/modules/mosaic/mosaic_frame.c
@@ -100,11 +100,12 @@ MOSlayout_frame_hdr(Client cntxt, MOStas
(void) cntxt;
for(i=0; i< task->hdr->framesize; i++, j++){
- MOSdump_frameInternal(buf, BUFSIZ, task,i);
- BUNappend(btech, "frame_hdr", FALSE);
+ snprintf(buf,BUFSIZ,"frame[%d]",i);
+ BUNappend(btech, buf, FALSE);
BUNappend(bcount, &j, FALSE);
BUNappend(binput, &cnt, FALSE);
BUNappend(boutput, &task->hdr->framefreq[i], FALSE);
+ MOSdump_frameInternal(buf, BUFSIZ, task,i);
BUNappend(bproperties, buf, FALSE);
}
}
diff --git a/monetdb5/optimizer/opt_pipes.c b/monetdb5/optimizer/opt_pipes.c
--- a/monetdb5/optimizer/opt_pipes.c
+++ b/monetdb5/optimizer/opt_pipes.c
@@ -87,6 +87,7 @@ static struct PIPELINES {
"optimizer.querylog();"
"optimizer.multiplex();"
"optimizer.generator();"
+ "optimizer.mosaic();"
"optimizer.profiler();"
"optimizer.candidates();"
"optimizer.garbageCollector();",
diff --git a/sql/backends/monet5/sql.mal b/sql/backends/monet5/sql.mal
--- a/sql/backends/monet5/sql.mal
+++ b/sql/backends/monet5/sql.mal
@@ -576,13 +576,6 @@ pattern droporderindex(sch:str,tbl:str,c
address sql_droporderindex
comment "Drop the order index on a column";
-pattern mosaiclayout(sch:str,tbl:str,col:str,compressionscheme:str)(
- technique:bat[:str],
- count:bat[:lng],
- inputsize:bat[:lng],
- outputsize:bat[:lng],
- properties:bat[:str])
-address sql_mosaicLayout;
pattern mosaiclayout(sch:str,tbl:str,col:str)(
technique:bat[:str],
count:bat[:lng],
diff --git a/sql/backends/monet5/sql_mosaic.c b/sql/backends/monet5/sql_mosaic.c
--- a/sql/backends/monet5/sql_mosaic.c
+++ b/sql/backends/monet5/sql_mosaic.c
@@ -31,7 +31,6 @@ sql_mosaicLayout(Client cntxt, MalBlkPtr
str sch = 0, tbl = 0, col = 0;
BAT *bn, *btech, *bcount, *binput, *boutput, *bproperties;
int *tech,*count,*input,*output, *properties;
- str compressionscheme= NULL;
if (msg != MAL_SUCCEED || (msg = checkSQLContext(cntxt)) != NULL)
return msg;
@@ -82,10 +81,6 @@ sql_mosaicLayout(Client cntxt, MalBlkPtr
sch = *getArgReference_str(stk, pci, 5);
tbl = *getArgReference_str(stk, pci, 6);
col = *getArgReference_str(stk, pci, 7);
- if ( pci->argc == 9){
- // use a predefined collection of compression schemes.
- compressionscheme = *getArgReference_str(stk,pci,8);
- }
#ifdef DEBUG_SQL_MOSAIC
mnstr_printf(cntxt->fdout, "#mosaic layout %s.%s.%s \n", sch, tbl, col);
@@ -112,7 +107,7 @@ sql_mosaicLayout(Client cntxt, MalBlkPtr
continue;
// perform the analysis
bn =
store_funcs.bind_col(m->session->tr, c, 0);
- MOSlayout(cntxt, bn, btech,
bcount, binput, boutput, bproperties, compressionscheme);
+ MOSlayout(cntxt, bn, btech,
bcount, binput, boutput, bproperties);
BBPunfix(bn->batCacheid);
(void) c;
}
diff --git a/sql/scripts/76_mosaic.sql b/sql/scripts/76_mosaic.sql
--- a/sql/scripts/76_mosaic.sql
+++ b/sql/scripts/76_mosaic.sql
@@ -7,10 +7,6 @@
-- support routines for the compressed store
set schema sys;
-create function mosaic_layout(sch string, tbl string, col string,compression
string)
-returns table(technique string, "count" bigint, inputsize bigint, outputsize
bigint,properties string)
-external name sql.mosaiclayout;
-
create function mosaic_layout(sch string, tbl string, col string)
returns table(technique string, "count" bigint, inputsize bigint, outputsize
bigint,properties string)
external name sql.mosaiclayout;
diff --git a/sql/test/mosaic/Tests/mix.sql b/sql/test/mosaic/Tests/mix.sql
--- a/sql/test/mosaic/Tests/mix.sql
+++ b/sql/test/mosaic/Tests/mix.sql
@@ -18,8 +18,8 @@ select * from mix0;
-- analyse the impact of the various compression schemes
alter table mix0 set read only;
---select * from mosaic_analysis('sys','mix0','i') order by factor desc;
+select * from mosaic_analysis('sys','mix0','i') order by factor desc;
-alter table mix0 alter column i set storage 'dictionary';
+alter table mix0 alter column i set storage 'mosaic';
select * from mosaic_layout('sys','mix0','i') ;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list