Changeset: 91b11200d1af for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=91b11200d1af
Added Files:
        sql/scripts/76_mosaic.sql
Modified Files:
        sql/backends/monet5/sql.mal
        sql/backends/monet5/sql_upgrades.c
        sql/scripts/Makefile.ag
Branch: mosaic
Log Message:

Add SQL mosaic analysis support


diffs (128 lines):

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,14 +576,14 @@ 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)(
+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)(
+pattern mosaiclayout(sch:str,tbl:str,col:str)(
        technique:bat[:str],
        count:bat[:lng],
        inputsize:bat[:lng],
@@ -592,13 +592,13 @@ pattern mosaicLayout(sch:str,tbl:str,col
 address sql_mosaicLayout
 comment "Return a table with detailed compression information ";
 
-pattern mosaicAnalysis(sch:str,tbl:str,col:str,compression:str)(
+pattern mosaicanalysis(sch:str,tbl:str,col:str,compression:str)(
        technique:bat[:str],
        outputsize:bat[:lng],
        factor:bat[:dbl],
        run:bat[:lng])
 address sql_mosaicAnalysis;
-pattern mosaicAnalysis(sch:str,tbl:str,col:str)(
+pattern mosaicanalysis(sch:str,tbl:str,col:str)(
        technique:bat[:str],
        outputsize:bat[:lng],
        factor:bat[:dbl],
diff --git a/sql/backends/monet5/sql_upgrades.c 
b/sql/backends/monet5/sql_upgrades.c
--- a/sql/backends/monet5/sql_upgrades.c
+++ b/sql/backends/monet5/sql_upgrades.c
@@ -1751,6 +1751,42 @@ sql_update_nowrd(Client c, mvc *sql)
        return err;             /* usually MAL_SUCCEED */
 }
 
+static str
+sql_update_mosaic(Client c, mvc *sql)
+{
+       size_t bufsize = 10240, pos = 0;
+       char *buf = GDKmalloc(bufsize), *err = NULL;
+
+       (void) sql;
+       pos += snprintf(buf + pos, bufsize - pos, "set schema \"sys\";\n");
+
+       /* 76_mosaic.sql */
+       pos += snprintf(buf + pos, bufsize - pos,
+                       "drop function mosaic_layout(sch string, tbl string, 
col string,compression string);"
+                       "drop function mosaic_layout(sch string, tbl string, 
col string);"
+                       "drop function mosaic_analyse(sch string, tbl string, 
col string,compression string);"
+                       "drop function mosaic_analyse(sch string, tbl string, 
col string);"
+                       "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;"
+                       "create function mosaic_analysis(sch string, tbl 
string, col string)"
+                       "returns table(technique string, outputsize bigint, 
factor float, run bigint)"
+                       "external name sql.mosaicanalysis;"
+                       "create function mosaic_analysis(sch string, tbl 
string, col string, compression string)"
+                       "returns table(technique string, outputsize bigint, 
factor float, run bigint)"
+                       "external name sql.mosaicanalysis;"
+       );
+
+       assert(pos < bufsize);
+       printf("Running database upgrade commands:\n%s\n", buf);
+       err = SQLstatementIntern(c, &buf, "update", 1, 0, NULL);
+       GDKfree(buf);
+       return err;             /* usually MAL_SUCCEED */
+}
+
 void
 SQLupgrades(Client c, mvc *m)
 {
@@ -1877,4 +1913,5 @@ SQLupgrades(Client c, mvc *m)
                        GDKfree(err);
                }
        }
+       if(0)   sql_update_mosaic(c, m);
 }
diff --git a/sql/scripts/76_mosaic.sql b/sql/scripts/76_mosaic.sql
new file mode 100644
--- /dev/null
+++ b/sql/scripts/76_mosaic.sql
@@ -0,0 +1,24 @@
+-- This Source Code Form is subject to the terms of the Mozilla Public
+-- 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 - 2016 MonetDB B.V.
+
+-- 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;
+
+create function mosaic_analysis(sch string, tbl string, col string) 
+returns table(technique string, outputsize bigint, factor float, run bigint)
+external name sql.mosaicanalysis;
+
+create function mosaic_analysis(sch string, tbl string, col string, 
compression string) 
+returns table(technique string, outputsize bigint, factor float, run bigint)
+external name sql.mosaicanalysis;
diff --git a/sql/scripts/Makefile.ag b/sql/scripts/Makefile.ag
--- a/sql/scripts/Makefile.ag
+++ b/sql/scripts/Makefile.ag
@@ -34,6 +34,7 @@ headers_sql = {
                46_profiler.sql \
                51_sys_schema_extension.sql \
                75_storagemodel.sql \
+               76_mosaic.sql \
                80_statistics.sql \
                99_system.sql
 }
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to