Changeset: d8347a756a55 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d8347a756a55
Modified Files:
        sql/backends/monet5/sql.c
        sql/backends/monet5/sql.h
        sql/backends/monet5/sql.mal
        sql/backends/monet5/sql_upgrades.c
        sql/scripts/Makefile.ag
        sql/test/Tests/systemfunctions_bam.stable.out
        sql/test/Tests/systemfunctions_bam.stable.out.int128
        sql/test/leaks/Tests/check1_bam.stable.out.int128
        sql/test/leaks/Tests/check2_bam.stable.out.int128
        sql/test/leaks/Tests/check3_bam.stable.out.int128
        sql/test/leaks/Tests/check4_bam.stable.out.int128
        sql/test/leaks/Tests/check5_bam.stable.out.int128
Branch: default
Log Message:

removed cluster test


diffs (truncated from 573 to 300 lines):

diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -40,7 +40,6 @@
 #include <rel_dump.h>
 #include <rel_bin.h>
 #include <bbp.h>
-#include <cluster.h>
 #include <opt_pipes.h>
 #include "clients.h"
 #include "mal_instruction.h"
@@ -4031,168 +4030,6 @@ SQLargRecord(Client cntxt, MalBlkPtr mb,
 }
 
 /*
- * The table is searched for all columns and they are
- * re-clustered on the hash value over the  primary key.
- * Initially the first column
- */
-
-str
-SQLcluster1(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
-{
-       str *sch = getArgReference_str(stk, pci, 1);
-       str *tbl = getArgReference_str(stk, pci, 2);
-       sql_trans *tr;
-       sql_schema *s;
-       sql_table *t;
-       sql_column *c;
-       mvc *m = NULL;
-       str msg;
-       int first = 1;
-       bat mid, hid, bid;
-       BAT *map = NULL, *b;
-       node *o;
-
-       if ((msg = getSQLContext(cntxt, mb, &m, NULL)) != NULL)
-               return msg;
-       if ((msg = checkSQLContext(cntxt)) != NULL)
-               return msg;
-       s = mvc_bind_schema(m, *sch);
-       if (s == NULL)
-               throw(SQL, "sql.cluster", "3F000!Schema missing");
-       t = mvc_bind_table(m, s, *tbl);
-       if (t == NULL)
-               throw(SQL, "sql.cluster", "42S02!Table missing");
-       tr = m->session->tr;
-       t->base.wtime = s->base.wtime = tr->wtime = tr->wstime;
-       t->base.rtime = s->base.rtime = tr->rtime = tr->stime;
-
-       /* actually build the hash on the multi-column primary key */
-
-       for (o = t->columns.set->h; o; o = o->next) {
-               sql_delta *d;
-               c = o->data;
-               if (first) {
-                       first = 0;
-                       b = store_funcs.bind_col(tr, c, RDONLY);
-                       msg = CLUSTER_key(&hid, &b->batCacheid);
-                       BBPunfix(b->batCacheid);
-                       if (msg)
-                               return msg;
-                       msg = CLUSTER_map(&mid, &hid);
-                       BBPdecref(hid, TRUE);
-                       if (msg)
-                               return msg;
-                       map = BATdescriptor(mid);
-                       if (map == NULL)
-                               throw(SQL, "sql.cluster", "Can not access 
descriptor");
-               }
-
-               b = store_funcs.bind_col(tr, c, RDONLY);
-               if (b == NULL)
-                       throw(SQL, "sql.cluster", "Can not access descriptor");
-               msg = CLUSTER_apply(&bid, b, map);
-               BBPunfix(b->batCacheid);
-               if (msg) {
-                       BBPunfix(map->batCacheid);
-                       return msg;
-               }
-               d = c->data;
-               if (d->bid)
-                       BBPdecref(d->bid, TRUE);
-               if (d->ibid)
-                       BBPdecref(d->ibid, TRUE);
-               d->bid = 0;
-               d->ibase = 0;
-               d->ibid = bid;  /* use the insert bat */
-               c->base.wtime = tr->wstime;
-               c->base.rtime = tr->stime;
-       }
-       /* bat was cleared */
-       t->cleared = 1;
-       if (map) {
-               BBPunfix(map->batCacheid);
-               BBPdecref(mid, TRUE);
-       }
-       return MAL_SUCCEED;
-}
-
-str
-SQLcluster2(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
-{
-       str *sch = getArgReference_str(stk, pci, 1);
-       str *tbl = getArgReference_str(stk, pci, 2);
-       sql_trans *tr;
-       sql_schema *s;
-       sql_table *t;
-       sql_column *c;
-       mvc *m = NULL;
-       str msg;
-       int first = 1;
-       bat mid, hid, bid;
-       BAT *b;
-       node *o;
-
-       if ((msg = getSQLContext(cntxt, mb, &m, NULL)) != NULL)
-               return msg;
-       if ((msg = checkSQLContext(cntxt)) != NULL)
-               return msg;
-       s = mvc_bind_schema(m, *sch);
-       if (s == NULL)
-               throw(SQL, "sql.cluster", "3F000!Schema missing");
-       t = mvc_bind_table(m, s, *tbl);
-       if (t == NULL)
-               throw(SQL, "sql.cluster", "42S02!Table missing");
-       tr = m->session->tr;
-
-       t->base.wtime = s->base.wtime = tr->wtime = tr->wstime;
-       t->base.rtime = s->base.rtime = tr->rtime = tr->stime;
-       for (o = t->columns.set->h; o; o = o->next) {
-               sql_delta *d;
-               c = o->data;
-               if (first) {
-                       bat psum;
-                       int bits = 10, off = 0;
-                       first = 0;
-                       b = store_funcs.bind_col(tr, c, RDONLY);
-                       msg = MKEYbathash(&hid, &b->batCacheid);
-                       BBPunfix(b->batCacheid);
-                       if (msg)
-                               return msg;
-                       msg = CLS_create_wrd(&psum, &mid, &hid, &bits, &off);
-                       BBPdecref(hid, TRUE);
-                       BBPdecref(psum, TRUE);
-                       if (msg)
-                               return msg;
-               }
-
-               b = store_funcs.bind_col(tr, c, RDONLY);
-               if (b == NULL)
-                       throw(SQL, "sql.cluster", "Can not access descriptor");
-               msg = CLS_map(&bid, &mid, &b->batCacheid);
-               BBPunfix(b->batCacheid);
-               if (msg) {
-                       BBPunfix(bid);
-                       return msg;
-               }
-
-               d = c->data;
-               if (d->bid)
-                       BBPdecref(d->bid, TRUE);
-               if (d->ibid)
-                       BBPdecref(d->ibid, TRUE);
-               d->bid = 0;
-               d->ibase = 0;
-               d->ibid = bid;  /* use the insert bat */
-
-               c->base.wtime = tr->wstime;
-               c->base.rtime = tr->stime;
-       }
-       /* bat was cleared */
-       t->cleared = 1;
-       return MAL_SUCCEED;
-}
-
-/*
  * Vacuum cleaning tables
  * Shrinking and re-using space to vacuum clean the holes in the relations.
  */
diff --git a/sql/backends/monet5/sql.h b/sql/backends/monet5/sql.h
--- a/sql/backends/monet5/sql.h
+++ b/sql/backends/monet5/sql.h
@@ -134,8 +134,6 @@ sql5_export str mvc_restart_seq(Client c
 sql5_export str zero_or_one(ptr ret, const bat *bid);
 sql5_export str not_unique(bit *ret, const bat *bid);
 sql5_export str not_unique_oids(bat *ret, const bat *bid);
-sql5_export str SQLcluster1(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci);
-sql5_export str SQLcluster2(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci);
 sql5_export str SQLshrink(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr 
pci);
 sql5_export str SQLreuse(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr 
pci);
 sql5_export str SQLvacuum(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr 
pci);
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
@@ -1013,14 +1013,6 @@ pattern calc.rowid(v:any_1, schema:str, 
 address sql_rowid
 comment "return the next rowid";
 
-pattern cluster1(sch:str, tbl:str)
-address SQLcluster1
-comment "Cluster the columns of a table on the (first) primary key";
-
-pattern cluster2(sch:str, tbl:str)
-address SQLcluster2
-comment "Cluster the columns of a table on the (first) primary key";
-
 pattern shrink(sch:str, tbl:str)
 address SQLshrink
 comment "Consolidate the deletion table over all columns using shrinking";
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
@@ -1379,6 +1379,10 @@ from sys.storagemodel() group by \"schem
                }
        }
 
+       /* remove code from 19_cluster.sql script */
+       pos += snprintf(buf + pos, bufsize - pos, "drop procedure 
sys.cluster1;\n");
+       pos += snprintf(buf + pos, bufsize - pos, "drop procedure 
sys.cluster2;\n");
+
        if (schema) {
                pos += snprintf(buf + pos, bufsize - pos, "set schema 
\"%s\";\n", schema);
                free(schema);
diff --git a/sql/scripts/Makefile.ag b/sql/scripts/Makefile.ag
--- a/sql/scripts/Makefile.ag
+++ b/sql/scripts/Makefile.ag
@@ -29,7 +29,6 @@ headers_sql = {
                15_querylog.sql \
                16_tracelog.sql \
                17_temporal.sql \
-               19_cluster.sql \
                20_vacuum.sql \
                21_dependency_functions.sql \
                22_clients.sql \
diff --git a/sql/test/Tests/systemfunctions_bam.stable.out 
b/sql/test/Tests/systemfunctions_bam.stable.out
--- a/sql/test/Tests/systemfunctions_bam.stable.out
+++ b/sql/test/Tests/systemfunctions_bam.stable.out
@@ -182,10 +182,6 @@ Ready.
 [ "sys",       "chi2prob",     0,      "double",       "-- The contents of 
this file are subject to the MonetDB Public License\n-- Version 1.1 (the 
\"License\"); you may not use this file except in\n-- compliance with the 
License. You may obtain a copy of the License at\n-- 
http://www.monetdb.org/Legal/MonetDBLicense\n--\n-- Software distributed under 
the License is distributed on an \"AS IS\"\n-- basis, WITHOUT WARRANTY OF ANY 
KIND, either express or implied. See the\n-- License for the specific language 
governing rights and limitations\n-- under the License.\n--\n-- The Original 
Code is the MonetDB Database System.\n--\n-- The Initial Developer of the 
Original Code is CWI.\n-- Portions created by CWI are Copyright (C) 1997-July 
2008 CWI.\n-- Copyright August 2008-2015 MonetDB B.V.\n-- All Rights 
Reserved.\n\n-- (co) Arjen de Rijke, Bart Scheers\n-- Use statistical functions 
from gsl library\n\n-- Calculate Chi squared probability\ncreate function 
sys.chi2prob(chi2 double, datapoints double)\nreturns d
 ouble external name gsl.\"chi2prob\";" ]
 [ "sys",       "chi2prob",     1,      "double",       ""      ]
 [ "sys",       "chi2prob",     2,      "double",       ""      ]
-[ "sys",       "cluster1",     0,      "clob", "-- The contents of this file 
are subject to the MonetDB Public License\n-- Version 1.1 (the \"License\"); 
you may not use this file except in\n-- compliance with the License. You may 
obtain a copy of the License at\n-- 
http://www.monetdb.org/Legal/MonetDBLicense\n--\n-- Software distributed under 
the License is distributed on an \"AS IS\"\n-- basis, WITHOUT WARRANTY OF ANY 
KIND, either express or implied. See the\n-- License for the specific language 
governing rights and limitations\n-- under the License.\n--\n-- The Original 
Code is the MonetDB Database System.\n--\n-- The Initial Developer of the 
Original Code is CWI.\n-- Portions created by CWI are Copyright (C) 1997-July 
2008 CWI.\n-- Copyright August 2008-2015 MonetDB B.V.\n-- All Rights 
Reserved.\n\n-- Clustering a relational table should be done with care.\n-- 
For, the oid's are used in join-indices.\n\n-- Clustering of tables may improve 
IO performance\n-- The foreign key constraints should b
 e dropped before\n-- and re-established after the cluster operation.\n\ncreate 
procedure cluster1(sys string, tab string)\n\texternal name sql.cluster1;"      
]
-[ "sys",       "cluster1",     1,      "clob", ""      ]
-[ "sys",       "cluster2",     0,      "clob", "create procedure cluster2(sys 
string, tab string)\n\texternal name sql.cluster2;"      ]
-[ "sys",       "cluster2",     1,      "clob", ""      ]
 [ "sys",       "columnsize",   0,      "bigint",       "-- The predicted 
storage footprint of the complete database\n-- determines the amount of 
diskspace needed for persistent storage\n-- and the upperbound when all 
possible index structures are created.\n-- The storage requirement for foreign 
key joins is split amongst the participants.\n\ncreate function 
sys.columnsize(nme string, i bigint, d bigint)\nreturns 
bigint\nbegin\n\tcase\n\twhen nme = 'boolean' then return i;\n\twhen nme = 
'char' then return 2*i;\n\twhen nme = 'smallint' then return 2 * i;\n\twhen nme 
= 'int'\t then return 4 * i;\n\twhen nme = 'bigint'\t then return 8 * 
i;\n\twhen nme = 'hugeint'\t then return 16 * i;\n\twhen nme = 'timestamp' then 
return 8 * i;\n\twhen  nme = 'varchar' then\n\t\tcase\n\t\twhen cast(d as 
bigint) << 8 then return i;\n\t\twhen cast(d as bigint) << 16 then return 2 * 
i;\n\t\twhen cast(d as bigint) << 32 then return 4 * i;\n\t\telse return 8 * 
i;\n\t\tend case;\n\telse return 8 * i;\n\tend case;\nend;"      ]
 [ "sys",       "columnsize",   1,      "clob", ""      ]
 [ "sys",       "columnsize",   2,      "bigint",       ""      ]
diff --git a/sql/test/Tests/systemfunctions_bam.stable.out.int128 
b/sql/test/Tests/systemfunctions_bam.stable.out.int128
--- a/sql/test/Tests/systemfunctions_bam.stable.out.int128
+++ b/sql/test/Tests/systemfunctions_bam.stable.out.int128
@@ -185,10 +185,6 @@ Ready.
 [ "sys",       "chi2prob",     0,      "double",       "-- The contents of 
this file are subject to the MonetDB Public License\n-- Version 1.1 (the 
\"License\"); you may not use this file except in\n-- compliance with the 
License. You may obtain a copy of the License at\n-- 
http://www.monetdb.org/Legal/MonetDBLicense\n--\n-- Software distributed under 
the License is distributed on an \"AS IS\"\n-- basis, WITHOUT WARRANTY OF ANY 
KIND, either express or implied. See the\n-- License for the specific language 
governing rights and limitations\n-- under the License.\n--\n-- The Original 
Code is the MonetDB Database System.\n--\n-- The Initial Developer of the 
Original Code is CWI.\n-- Portions created by CWI are Copyright (C) 1997-July 
2008 CWI.\n-- Copyright August 2008-2015 MonetDB B.V.\n-- All Rights 
Reserved.\n\n-- (co) Arjen de Rijke, Bart Scheers\n-- Use statistical functions 
from gsl library\n\n-- Calculate Chi squared probability\ncreate function 
sys.chi2prob(chi2 double, datapoints double)\nreturns d
 ouble external name gsl.\"chi2prob\";" ]
 [ "sys",       "chi2prob",     1,      "double",       ""      ]
 [ "sys",       "chi2prob",     2,      "double",       ""      ]
-[ "sys",       "cluster1",     0,      "clob", "-- The contents of this file 
are subject to the MonetDB Public License\n-- Version 1.1 (the \"License\"); 
you may not use this file except in\n-- compliance with the License. You may 
obtain a copy of the License at\n-- 
http://www.monetdb.org/Legal/MonetDBLicense\n--\n-- Software distributed under 
the License is distributed on an \"AS IS\"\n-- basis, WITHOUT WARRANTY OF ANY 
KIND, either express or implied. See the\n-- License for the specific language 
governing rights and limitations\n-- under the License.\n--\n-- The Original 
Code is the MonetDB Database System.\n--\n-- The Initial Developer of the 
Original Code is CWI.\n-- Portions created by CWI are Copyright (C) 1997-July 
2008 CWI.\n-- Copyright August 2008-2015 MonetDB B.V.\n-- All Rights 
Reserved.\n\n-- Clustering a relational table should be done with care.\n-- 
For, the oid's are used in join-indices.\n\n-- Clustering of tables may improve 
IO performance\n-- The foreign key constraints should b
 e dropped before\n-- and re-established after the cluster operation.\n\ncreate 
procedure cluster1(sys string, tab string)\n\texternal name sql.cluster1;"      
]
-[ "sys",       "cluster1",     1,      "clob", ""      ]
-[ "sys",       "cluster2",     0,      "clob", "create procedure cluster2(sys 
string, tab string)\n\texternal name sql.cluster2;"      ]
-[ "sys",       "cluster2",     1,      "clob", ""      ]
 [ "sys",       "columnsize",   0,      "bigint",       "-- The predicted 
storage footprint of the complete database\n-- determines the amount of 
diskspace needed for persistent storage\n-- and the upperbound when all 
possible index structures are created.\n-- The storage requirement for foreign 
key joins is split amongst the participants.\n\ncreate function 
sys.columnsize(nme string, i bigint, d bigint)\nreturns 
bigint\nbegin\n\tcase\n\twhen nme = 'boolean' then return i;\n\twhen nme = 
'char' then return 2*i;\n\twhen nme = 'smallint' then return 2 * i;\n\twhen nme 
= 'int'\t then return 4 * i;\n\twhen nme = 'bigint'\t then return 8 * 
i;\n\twhen nme = 'hugeint'\t then return 16 * i;\n\twhen nme = 'timestamp' then 
return 8 * i;\n\twhen  nme = 'varchar' then\n\t\tcase\n\t\twhen cast(d as 
bigint) << 8 then return i;\n\t\twhen cast(d as bigint) << 16 then return 2 * 
i;\n\t\twhen cast(d as bigint) << 32 then return 4 * i;\n\t\telse return 8 * 
i;\n\t\tend case;\n\telse return 8 * i;\n\tend case;\nend;"      ]
 [ "sys",       "columnsize",   1,      "clob", ""      ]
 [ "sys",       "columnsize",   2,      "bigint",       ""      ]
diff --git a/sql/test/leaks/Tests/check1_bam.stable.out.int128 
b/sql/test/leaks/Tests/check1_bam.stable.out.int128
--- a/sql/test/leaks/Tests/check1_bam.stable.out.int128
+++ b/sql/test/leaks/Tests/check1_bam.stable.out.int128
@@ -40,10 +40,10 @@ Ready.
 [ "oid",       "bit",  4       ]
 [ "oid",       "bit",  45      ]
 [ "oid",       "bit",  329     ]
-[ "oid",       "bit",  1515    ]
-[ "oid",       "bit",  1515    ]
-[ "oid",       "bit",  1515    ]
-[ "oid",       "bte",  4247    ]
+[ "oid",       "bit",  1513    ]
+[ "oid",       "bit",  1513    ]
+[ "oid",       "bit",  1513    ]
+[ "oid",       "bte",  4243    ]
 [ "oid",       "int",  0       ]
 [ "oid",       "int",  0       ]
 [ "oid",       "int",  0       ]
@@ -104,16 +104,16 @@ Ready.
 [ "oid",       "int",  329     ]
 [ "oid",       "int",  329     ]
 [ "oid",       "int",  329     ]
-[ "oid",       "int",  1515    ]
-[ "oid",       "int",  1515    ]
-[ "oid",       "int",  1515    ]
-[ "oid",       "int",  1515    ]
-[ "oid",       "int",  1515    ]
-[ "oid",       "int",  4247    ]
-[ "oid",       "int",  4247    ]
-[ "oid",       "int",  4247    ]
-[ "oid",       "int",  4247    ]
-[ "oid",       "int",  4247    ]
+[ "oid",       "int",  1513    ]
+[ "oid",       "int",  1513    ]
+[ "oid",       "int",  1513    ]
+[ "oid",       "int",  1513    ]
+[ "oid",       "int",  1513    ]
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to