Update of /cvsroot/monetdb/sql/src/backends/monet5
In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv343/d/d

Modified Files:
        sql.mx 
Log Message:
The interface to the table compression operation.


Index: sql.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/sql.mx,v
retrieving revision 1.399
retrieving revision 1.400
diff -u -d -r1.399 -r1.400
--- sql.mx      22 Feb 2010 14:07:29 -0000      1.399
+++ sql.mx      23 Feb 2010 16:49:07 -0000      1.400
@@ -797,12 +797,19 @@
 address SQLcluster2
 comment "Cluster the columns of a table on the (first) primary key";
 
-pattern compress(sch:str, tbl:str)
-address SQLcompress
+pattern dictionary(sch:str, tbl:str):void
+address SQLdictcompress
 comment "Perform dictionary compression on a table";
-pattern decompress(sch:str, tbl:str)
-address SQLdecompress
+pattern dictionary(sch:str, tbl:str):void
+address SQLdictdecompress
 comment "Perform dictionary decompression on a table";
+
+pattern gzcompress(sch:str, tbl:str):void
+address SQLgzcompress
+comment "Perform LZ compression on a table";
+pattern gzdecompress(sch:str, tbl:str):void
+address SQLgzdecompress
+comment "Perform LZ decompression on a table";
 @-
 The distributed processing of queries requires the SQL runtime
 system to be able to deliver portions of the BATs in an efficient
@@ -1056,8 +1063,10 @@
 sql5_export str not_unique(bit *ret, int *bid);
 sql5_export str not_unique_oids(bat *ret, bat *bid);
 sql5_export str SQLcluster(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr 
pci);
-sql5_export str SQLcompress(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci);
-sql5_export str SQLdecompress(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci);
+sql5_export str SQLdictcompress(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci);
+sql5_export str SQLdictdecompress(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci);
+sql5_export str SQLgzcompress(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci);
+sql5_export str SQLgzdecompress(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci);
 sql5_export str SQLoctopusBind(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci);
 sql5_export str SQLoctopusBinddbat(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci);
 sql5_export str SQLargRecord(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci);
@@ -1226,6 +1235,7 @@
 #include <rel_dump.h>
 #include <rel_bin.h>
 #include <math.h>
+#include <bbp.h>
 #include <cluster.h>
 #include <replication.h>
 #include <opt_dictionary.h>
@@ -4996,12 +5006,54 @@
        t->base.rtime = s->base.rtime = tr->rtime = tr->stime;
        return MAL_SUCCEED;
 @c
-str SQLcompress(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci){
+str SQLdictcompress(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci){
        @:compression(DICTcompress(&ret, &nme, &b->batCacheid))@
 }
-str SQLdecompress(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci){
+str SQLdictdecompress(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci){
        @:compression(DICTdecompress(&ret, &nme))@
 }
+...@-
+LZ compression is inherited from the underlying stream implementation.
+...@= gzcompression
+       str *sch = (str *) getArgReference(stk,pci,1);
+       str *tbl = (str *) getArgReference(stk,pci,2);
+       sql_schema      *s;
+       sql_table       *t;
+       mvc *m = NULL;
+       str msg = getContext(cntxt,mb, &m, NULL);
+       sql_trans *tr = m->session->tr;
+       node *o;
+       int ret;
+
+       if (msg)
+               return msg;
+       s = mvc_bind_schema(m, *sch);
+       if ( s == NULL)
+               throw(MAL,"sql.cluster","Schema missing");
+       t = mvc_bind_table(m, s, *tbl);
+       if ( t == NULL)
+               throw(MAL,"sql.cluster","Table missing");
+
+       /* actually build the hash on the multi-column primary key */
+
+       for (o = t->columns.set->h; o; o = o->next) {
+               BAT *b;
+               sql_column      *c = o->data;
+
+               b = store_funcs.bind_col(tr, c, 0);
+               if (b == NULL)
+                       throw(MAL,"sql.compress","Can not access descriptor");
+               msg = @1;
+               BBPreleaseref(b->batCacheid);
+       }
+       return MAL_SUCCEED;
+...@c
+str SQLgzcompress(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci){
+       @:gzcompression(CMDbbpcompress(&ret, &b->batCacheid))@
+}
+str SQLgzdecompress(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci){
+       @:gzcompression(CMDbbpdecompress(&ret, &b->batCacheid))@
+}
 @- Shredding RDF documents through SQL
 Wrapper around the RDF shredder of the rdf module of M5. The first time
 the database is going to be used for rdf run sql/src/sql/rdf.sql.


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to