Changeset: 8f6063b93424 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8f6063b93424 Modified Files: clients/Tests/exports.stable.out monetdb5/modules/mosaic/TODO_MOSAIC.txt monetdb5/modules/mosaic/mosaic.c monetdb5/modules/mosaic/mosaic.h sql/backends/monet5/sql_mosaic.c sql/test/mosaic/Tests/All sql/test/mosaic/Tests/analysis.sql sql/test/mosaic/Tests/analysis.stable.out Branch: mosaic Log Message:
Update analysis test and TODO's. diffs (truncated from 302 to 300 lines): 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 @@ -1511,7 +1511,7 @@ str MKEYconstbulk_rotate_xor_hash(bat *r str MKEYhash(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p); str MKEYrotate(lng *ret, const lng *v, const int *nbits); str MKEYrotate_xor_hash(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p); -void MOSAnalysis(BAT *b, BAT *btech, BAT *output, BAT *factor, BAT *compress, BAT *decompress, str compressions); +str MOSAnalysis(BAT *b, BAT *btech, BAT *output, BAT *factor, BAT *compress, BAT *decompress, str compressions); void MOSblk(MosaicBlk blk); str MOScompress(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); str MOScompressInternal(BAT *bsrc, const char *compressions); diff --git a/monetdb5/modules/mosaic/TODO_MOSAIC.txt b/monetdb5/modules/mosaic/TODO_MOSAIC.txt --- a/monetdb5/modules/mosaic/TODO_MOSAIC.txt +++ b/monetdb5/modules/mosaic/TODO_MOSAIC.txt @@ -1,5 +1,5 @@ ####technical depth#### -Check MOSanalysis and its test. +Fix estimation. Use a differential approach? Fix/check/test MOSlayout. Add negative values to tests Add test for huge 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 @@ -1412,7 +1412,7 @@ struct PAT{ lng clk1, clk2; }pat[CANDIDATES]; -void +str MOSAnalysis(BAT *b, BAT *btech, BAT *boutput, BAT *bratio, BAT *bcompress, BAT *bdecompress, str compressions) { int i,j,cases, bit=1, bid= b->batCacheid; @@ -1420,6 +1420,7 @@ MOSAnalysis(BAT *b, BAT *btech, BAT *bou int antipattern[CANDIDATES]; int antipatternSize = 0; char buf[1024]={0}, *t; + str msg = MAL_SUCCEED; int filter[MOSAIC_METHODS]; @@ -1475,10 +1476,14 @@ MOSAnalysis(BAT *b, BAT *btech, BAT *bou } const char* compressions = buf; - MOScompressInternal( b, compressions); + msg = MOScompressInternal( b, compressions); + pat[i].clk1 = GDKms()- pat[i].clk1; - if(b->tmosaic == NULL){ + if(msg != MAL_SUCCEED || b->tmosaic == NULL){ + if (msg != MAL_SUCCEED) { + GDKfree(msg); + } // aborted compression experiment MOSdestroy(BBPdescriptor(bid)); @@ -1522,7 +1527,7 @@ MOSAnalysis(BAT *b, BAT *btech, BAT *bou BAT* decompressed; pat[i].clk2 = GDKms(); - MOSdecompressInternal( &decompressed, b); + msg = MOSdecompressInternal( &decompressed, b); pat[i].clk2 = GDKms()- pat[i].clk2; MOSdestroy(decompressed); BBPunfix(decompressed->batCacheid); @@ -1539,6 +1544,8 @@ MOSAnalysis(BAT *b, BAT *btech, BAT *bou } MOSunsetLock(b); + + if(msg != MAL_SUCCEED) return msg; // Probably a malloc failure. } // Collect the results in a table @@ -1548,16 +1555,18 @@ MOSAnalysis(BAT *b, BAT *btech, BAT *bou // round down to three decimals. pat[i].xf = ((dbl) (int) (pat[i].xf * 1000)) / 1000; - if( BUNappend(boutput,&pat[i].xsize,false) != GDK_SUCCEED || + if(msg == MAL_SUCCEED && (BUNappend(boutput,&pat[i].xsize,false) != GDK_SUCCEED || BUNappend(btech,pat[i].technique,false) != GDK_SUCCEED || BUNappend(bratio,&pat[i].xf,false) != GDK_SUCCEED || BUNappend(bcompress,&pat[i].clk1,false) != GDK_SUCCEED || - BUNappend(bdecompress,&pat[i].clk2,false) != GDK_SUCCEED ) - return; + BUNappend(bdecompress,&pat[i].clk2,false) != GDK_SUCCEED )) + msg = createException(MAL, "mosaic.analysis", SQLSTATE(HY001) MAL_MALLOC_FAIL); } GDKfree(pat[i].technique); } + + return msg; } /* slice a fixed size atom into thin bte-wide columns, used for experiments */ 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 @@ -227,7 +227,7 @@ mal_export str MOSprojection(Client cntx mal_export str MOSjoin(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); mal_export str MOSlayout(BAT *b, BAT *btech, BAT *bcount, BAT *binput, BAT *boutput, BAT *bproperties); mal_export str MOSsliceInternal(bat *slices, BUN size, BAT *b); -mal_export void MOSAnalysis(BAT *b, BAT *btech, BAT *output, BAT *factor, BAT *compress, BAT *decompress, str compressions); +mal_export str MOSAnalysis(BAT *b, BAT *btech, BAT *output, BAT *factor, BAT *compress, BAT *decompress, str compressions); mal_export str MOSslice(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); mal_export void MOSblk(MosaicBlk blk); mal_export BUN MOSlimit(void); 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 @@ -226,9 +226,17 @@ sql_mosaicAnalysis(Client cntxt, MalBlkP continue; // perform the analysis bn = store_funcs.bind_col(m->session->tr, c, 0); - MOSAnalysis(bn, btech, boutput, bfactor, bcompress, bdecompress, compressions); + msg = MOSAnalysis(bn, btech, boutput, bfactor, bcompress, bdecompress, compressions); BBPunfix(bn->batCacheid); (void) c; + + if(msg != MAL_SUCCEED){ + BBPunfix(btech->batCacheid); + BBPunfix(boutput->batCacheid); + BBPunfix(bfactor->batCacheid); + BBPunfix(bcompress->batCacheid); + return msg; + } } } } diff --git a/sql/test/mosaic/Tests/All b/sql/test/mosaic/Tests/All --- a/sql/test/mosaic/Tests/All +++ b/sql/test/mosaic/Tests/All @@ -9,4 +9,4 @@ prefix mix session_init session_exit -#analysis +analysis diff --git a/sql/test/mosaic/Tests/analysis.sql b/sql/test/mosaic/Tests/analysis.sql --- a/sql/test/mosaic/Tests/analysis.sql +++ b/sql/test/mosaic/Tests/analysis.sql @@ -1,4 +1,8 @@ -create table tmp4 (i int); +START TRANSACTION; + +create table if not exists tmp4 (i int); + +truncate TABLE tmp4; insert into tmp4 select * from generate_series(0, 10000000); @@ -6,8 +10,6 @@ insert into tmp4 select * from generate_ select technique, factor from mosaic.analysis('sys', 'tmp4', 'i') order by factor desc, technique; -select technique, factor from mosaic.analysis('sys', 'tmp4', 'i', 'capped, runlength') order by factor desc, technique; - -- should be materialized as the graph of a cutoff function. insert into tmp4 select 10000000 from tmp4; @@ -20,8 +22,12 @@ select technique, factor from mosaic.ana set optimizer='mosaic_pipe'; -alter table tmp4 alter column i set storage 'capped'; +alter table tmp4 alter column i set storage 'var'; + +select technique, factor from mosaic.analysis('sys', 'tmp4', 'i') order by factor desc, technique; select technique, factor from mosaic.analysis('sys', 'tmp4', 'i', 'linear, runlength') order by factor desc, technique; drop table tmp4; + +ROLLBACK; diff --git a/sql/test/mosaic/Tests/analysis.stable.out b/sql/test/mosaic/Tests/analysis.stable.out --- a/sql/test/mosaic/Tests/analysis.stable.out +++ b/sql/test/mosaic/Tests/analysis.stable.out @@ -21,67 +21,78 @@ stdout of test 'analysis` in directory ' # 16:07:15 > "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-15728" "--port=38225" # 16:07:15 > -#create table tmp4 (i int); -#insert into tmp4 select * from generate_series(0,10000000); +#START TRANSACTION; +#create table if not exists tmp4 (i int); +#truncate TABLE tmp4; +[ 0 ] +#insert into tmp4 select * from generate_series(0, 10000000); [ 10000000 ] #select technique, factor from mosaic.analysis('sys', 'tmp4', 'i') order by factor desc, technique; -% .L4, .L4 # table_name -% technique, factor # name -% clob, double # type -% 13, 24 # length -[ "linear ", 2886.002 ] -[ "frame ", 2449.179 ] -[ "delta ", 3.994 ] -[ "frame prefix ", 2.284 ] -[ "prefix ", 2.284 ] -[ "var ", 0.999 ] -[ "runlength ", 0.999 ] -#select technique, factor from mosaic.analysis('sys', 'tmp4', 'i', 'var, runlength') order by factor desc, technique; -% .L5, .L5 # table_name +% .%4, .%4 # table_name % technique, factor # name % clob, double # type % 11, 24 # length -[ "var ", 0.999 ] -[ "runlength ", 0.999 ] +[ "linear ", 175438.593 ] +[ "delta ", 15.998 ] +[ "frame ", 2.132 ] +[ "prefix ", 2.132 ] +[ "capped var ", 0.571 ] +[ "var ", 0.571 ] +[ "runlength ", 0.333 ] #insert into tmp4 select 10000000 from tmp4; [ 10000000 ] #select technique, factor from mosaic.analysis('sys', 'tmp4', 'i') order by factor desc, technique; -% .L4, .L4 # table_name +% .%4, .%4 # table_name % technique, factor # name % clob, double # type -% 23, 24 # length -[ "runlength linear ", 5457.025 ] -[ "linear ", 5312.084 ] -[ "runlength frame ", 4669.624 ] -[ "frame ", 4563.084 ] -[ "delta frame ", 7.988 ] -[ "runlength delta ", 7.988 ] -[ "delta prefix ", 7.101 ] -[ "runlength frame prefix ", 4.568 ] -[ "runlength prefix ", 4.567 ] -[ "frame prefix ", 4.266 ] -[ "prefix ", 4.263 ] -[ "delta ", 3.997 ] -[ "runlength ", 1.999 ] -[ "var ", 1.454 ] +% 17, 24 # length +[ "runlength linear ", 333333.343 ] +[ "linear ", 327868.843 ] +[ "runlength delta ", 19.072 ] +[ "delta frame ", 17.401 ] +[ "delta prefix ", 17.401 ] +[ "var delta ", 17.401 ] +[ "delta ", 15.999 ] +[ "frame ", 2.285 ] +[ "prefix ", 2.285 ] +[ "capped var ", 0.8 ] +[ "var ", 0.799 ] +[ "runlength ", 0.666 ] #select technique, factor from mosaic.analysis('sys', 'tmp4', 'i', 'linear, runlength') order by factor desc, technique; -% .L5, .L5 # table_name +% .%5, .%5 # table_name % technique, factor # name % clob, double # type % 17, 24 # length -[ "runlength linear ", 5457.025 ] -[ "linear ", 5312.084 ] -[ "runlength ", 1.999 ] +[ "runlength linear ", 333333.343 ] +[ "linear ", 327868.843 ] +[ "runlength ", 0.666 ] #set optimizer='mosaic_pipe'; #alter table tmp4 alter column i set storage 'var'; -#select technique, factor from mosaic.analysis('sys', 'tmp4', 'i', 'linear, runlength') order by factor desc, technique; -% .L5, .L5 # table_name +#select technique, factor from mosaic.analysis('sys', 'tmp4', 'i') order by factor desc, technique; +% .%4, .%4 # table_name % technique, factor # name % clob, double # type % 17, 24 # length -[ "runlength linear ", 5457.025 ] -[ "linear ", 5312.084 ] -[ "runlength ", 1.999 ] +[ "runlength linear ", 333333.343 ] +[ "linear ", 327868.843 ] +[ "runlength delta ", 19.072 ] +[ "delta frame ", 17.401 ] +[ "delta prefix ", 17.401 ] +[ "var delta ", 17.401 ] +[ "delta ", 15.999 ] +[ "frame ", 2.285 ] +[ "prefix ", 2.285 ] +[ "capped var ", 0.8 ] +[ "var ", 0.799 ] +[ "runlength ", 0.666 ] +#select technique, factor from mosaic.analysis('sys', 'tmp4', 'i', 'linear, runlength') order by factor desc, technique; +% .%5, .%5 # table_name +% technique, factor # name +% clob, double # type +% 17, 24 # length +[ "runlength linear ", 333333.343 ] +[ "linear ", 327868.843 ] +[ "runlength ", 0.666 ] #drop table tmp4; _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list