Changeset: 9ff002210cd3 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9ff002210cd3
Modified Files:
clients/Tests/exports.stable.out
gdk/gdk.h
gdk/gdk_private.h
sql/backends/monet5/sql.c
sql/include/sql_catalog.h
sql/scripts/75_storagemodel.sql
sql/server/sql_parser.y
sql/server/sql_scan.c
sql/test/Tests/systemfunctions.stable.out
sql/test/Tests/systemfunctions.stable.out.int128
Branch: default
Log Message:
Introducing CREATE IMPRINTS INDEX...
Simple wrapper around existing code.
diffs (257 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
@@ -268,6 +268,7 @@ var_t HEAP_malloc(Heap *heap, size_t nby
gdk_return HEAPextend(Heap *h, size_t size, int mayshare);
size_t HEAPmemsize(Heap *h);
size_t HEAPvmsize(Heap *h);
+void IMPSdestroy(BAT *b);
lng IMPSimprintsize(BAT *b);
int MT_check_nr_cores(void);
int MT_create_thread(MT_Id *t, void( *function)(void *), void *arg, enum
MT_thr_detach d);
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -2021,6 +2021,7 @@ gdk_export gdk_return BAThash(BAT *b, BU
*/
gdk_export gdk_return BATimprints(BAT *b);
+gdk_export void IMPSdestroy(BAT *b);
gdk_export lng IMPSimprintsize(BAT *b);
/* The ordered index structure */
diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h
--- a/gdk/gdk_private.h
+++ b/gdk/gdk_private.h
@@ -169,8 +169,6 @@ void BBPdump(void); /* never called: fo
__attribute__((__visibility__("hidden")));
__hidden int HEAPwarm(Heap *h)
__attribute__((__visibility__("hidden")));
-__hidden void IMPSdestroy(BAT *b)
- __attribute__((__visibility__("hidden")));
__hidden void IMPSfree(BAT *b)
__attribute__((__visibility__("hidden")));
__hidden int IMPSgetbin(int tpe, bte bits, const char *restrict bins, const
void *restrict v)
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
@@ -610,6 +610,12 @@ alter_table(Client cntxt, mvc *sql, char
OIDXcreateImplementation(cntxt,
newBatType(TYPE_void,b->ttype), b, -1);
BBPunfix(b->batCacheid);
}
+ if (i->type == imprints_idx) {
+ sql_kc *ic = i->columns->h->data;
+ BAT *b = mvc_bind(sql, nt->s->base.name,
nt->base.name, ic->c->base.name, 0);
+ BATimprints(b);
+ BBPunfix(b->batCacheid);
+ }
mvc_copy_idx(sql, nt, i);
}
}
@@ -754,6 +760,12 @@ drop_index(Client cntxt, mvc *sql, char
OIDXdropImplementation(cntxt, b);
BBPunfix(b->batCacheid);
}
+ if (i->type == imprints_idx) {
+ sql_kc *ic = i->columns->h->data;
+ BAT *b = mvc_bind(sql, s->base.name,
ic->c->t->base.name, ic->c->base.name, 0);
+ IMPSdestroy(b);
+ BBPunfix(b->batCacheid);
+ }
mvc_drop_idx(sql, s, i);
}
return NULL;
diff --git a/sql/include/sql_catalog.h b/sql/include/sql_catalog.h
--- a/sql/include/sql_catalog.h
+++ b/sql/include/sql_catalog.h
@@ -358,6 +358,7 @@ typedef enum idx_type {
join_idx,
oph_idx, /* order preserving hash */
no_idx, /* no idx, ie no storage */
+ imprints_idx,
ordered_idx,
new_idx_types
} idx_type;
diff --git a/sql/scripts/75_storagemodel.sql b/sql/scripts/75_storagemodel.sql
--- a/sql/scripts/75_storagemodel.sql
+++ b/sql/scripts/75_storagemodel.sql
@@ -31,7 +31,7 @@ returns table (
heapsize bigint,
hashes bigint,
phash boolean,
- imprints bigint,
+ "imprints" bigint,
sorted boolean,
orderidx bigint
)
@@ -54,7 +54,7 @@ returns table (
heapsize bigint,
hashes bigint,
phash boolean,
- imprints bigint,
+ "imprints" bigint,
sorted boolean,
orderidx bigint
)
@@ -74,7 +74,7 @@ returns table (
heapsize bigint,
hashes bigint,
phash boolean,
- imprints bigint,
+ "imprints" bigint,
sorted boolean,
orderidx bigint
)
@@ -94,7 +94,7 @@ returns table (
heapsize bigint,
hashes bigint,
phash boolean,
- imprints bigint,
+ "imprints" bigint,
sorted boolean,
orderidx bigint
)
@@ -222,7 +222,7 @@ returns table (
columnsize bigint,
heapsize bigint,
hashes bigint,
- imprints bigint,
+ "imprints" bigint,
sorted boolean,
orderidx bigint)
begin
@@ -244,6 +244,6 @@ as select "schema","table",max(count) as
sum(columnsize) as columnsize,
sum(heapsize) as heapsize,
sum(hashes) as hashes,
- sum(imprints) as imprints,
+ sum("imprints") as "imprints",
sum(case when sorted = false then 8 * count else 0 end) as auxiliary
from sys.storagemodel() group by "schema","table";
diff --git a/sql/server/sql_parser.y b/sql/server/sql_parser.y
--- a/sql/server/sql_parser.y
+++ b/sql/server/sql_parser.y
@@ -531,7 +531,7 @@ int yydebug=1;
%token START TRANSACTION READ WRITE ONLY ISOLATION LEVEL
%token UNCOMMITTED COMMITTED sqlREPEATABLE SERIALIZABLE DIAGNOSTICS sqlSIZE
STORAGE
-%token <sval> ASYMMETRIC SYMMETRIC ORDER ORDERED BY
+%token <sval> ASYMMETRIC SYMMETRIC ORDER ORDERED BY IMPRINTS
%token <operation> EXISTS ESCAPE HAVING sqlGROUP sqlNULL
%token <operation> FROM FOR MATCH
@@ -1248,6 +1248,7 @@ index_def:
opt_index_type:
UNIQUE { $$ = hash_idx; }
| ORDERED { $$ = ordered_idx; }
+ | IMPRINTS { $$ = imprints_idx; }
| /* empty */ { $$ = hash_idx; }
;
diff --git a/sql/server/sql_scan.c b/sql/server/sql_scan.c
--- a/sql/server/sql_scan.c
+++ b/sql/server/sql_scan.c
@@ -194,6 +194,7 @@ scanner_init_keywords(void)
keywords_insert("GROUP", sqlGROUP);
keywords_insert("HAVING", HAVING);
keywords_insert("ILIKE", ILIKE);
+ keywords_insert("IMPRINTS", IMPRINTS);
keywords_insert("IN", sqlIN);
keywords_insert("INNER", INNER);
keywords_insert("INTO", INTO);
diff --git a/sql/test/Tests/systemfunctions.stable.out
b/sql/test/Tests/systemfunctions.stable.out
--- a/sql/test/Tests/systemfunctions.stable.out
+++ b/sql/test/Tests/systemfunctions.stable.out
@@ -4372,7 +4372,7 @@ Ready.
[ "sys", "stddev_samp", 1, "timestamp", "" ]
[ "sys", "stop", 0, "int", "create procedure sys.stop(tag
int)\nexternal name sql.sysmon_stop;" ]
[ "sys", "stop", 0, "bigint", "create procedure sys.stop(tag
bigint)\nexternal name sql.sysmon_stop;" ]
-[ "sys", "storage", 0, "clob", "create function
sys.\"storage\"()\nreturns table (\n \"schema\" string,\n \"table\" string,\n
\"column\" string,\n \"type\" string,\n \"mode\" string,\n location string,\n
\"count\" bigint,\n typewidth int,\n columnsize bigint,\n heapsize bigint,\n
hashes bigint,\n phash boolean,\n imprints bigint,\n sorted boolean,\n orderidx
bigint\n)\nexternal name sql.\"storage\";" ]
+[ "sys", "storage", 0, "clob", "create function
sys.\"storage\"()\nreturns table (\n \"schema\" string,\n \"table\" string,\n
\"column\" string,\n \"type\" string,\n \"mode\" string,\n location string,\n
\"count\" bigint,\n typewidth int,\n columnsize bigint,\n heapsize bigint,\n
hashes bigint,\n phash boolean,\n \"imprints\" bigint,\n sorted boolean,\n
orderidx bigint\n)\nexternal name sql.\"storage\";" ]
[ "sys", "storage", 1, "clob", "" ]
[ "sys", "storage", 2, "clob", "" ]
[ "sys", "storage", 3, "clob", "" ]
@@ -4387,7 +4387,7 @@ Ready.
[ "sys", "storage", 12, "bigint", "" ]
[ "sys", "storage", 13, "boolean", "" ]
[ "sys", "storage", 14, "bigint", "" ]
-[ "sys", "storage", 0, "clob", "create function
sys.\"storage\"( sname string)\nreturns table (\n \"schema\" string,\n
\"table\" string,\n \"column\" string,\n \"type\" string,\n \"mode\" string,\n
location string,\n \"count\" bigint,\n typewidth int,\n columnsize bigint,\n
heapsize bigint,\n hashes bigint,\n phash boolean,\n imprints bigint,\n sorted
boolean,\n orderidx bigint\n)\nexternal name sql.\"storage\";" ]
+[ "sys", "storage", 0, "clob", "create function
sys.\"storage\"( sname string)\nreturns table (\n \"schema\" string,\n
\"table\" string,\n \"column\" string,\n \"type\" string,\n \"mode\" string,\n
location string,\n \"count\" bigint,\n typewidth int,\n columnsize bigint,\n
heapsize bigint,\n hashes bigint,\n phash boolean,\n \"imprints\" bigint,\n
sorted boolean,\n orderidx bigint\n)\nexternal name sql.\"storage\";" ]
[ "sys", "storage", 1, "clob", "" ]
[ "sys", "storage", 2, "clob", "" ]
[ "sys", "storage", 3, "clob", "" ]
@@ -4403,7 +4403,7 @@ Ready.
[ "sys", "storage", 13, "boolean", "" ]
[ "sys", "storage", 14, "bigint", "" ]
[ "sys", "storage", 15, "clob", "" ]
-[ "sys", "storage", 0, "clob", "create function
sys.\"storage\"( sname string, tname string)\nreturns table (\n \"schema\"
string,\n \"table\" string,\n \"column\" string,\n \"type\" string,\n \"mode\"
string,\n location string,\n \"count\" bigint,\n typewidth int,\n columnsize
bigint,\n heapsize bigint,\n hashes bigint,\n phash boolean,\n imprints
bigint,\n sorted boolean,\n orderidx bigint\n)\nexternal name sql.\"storage\";"
]
+[ "sys", "storage", 0, "clob", "create function
sys.\"storage\"( sname string, tname string)\nreturns table (\n \"schema\"
string,\n \"table\" string,\n \"column\" string,\n \"type\" string,\n \"mode\"
string,\n location string,\n \"count\" bigint,\n typewidth int,\n columnsize
bigint,\n heapsize bigint,\n hashes bigint,\n phash boolean,\n \"imprints\"
bigint,\n sorted boolean,\n orderidx bigint\n)\nexternal name sql.\"storage\";"
]
[ "sys", "storage", 1, "clob", "" ]
[ "sys", "storage", 2, "clob", "" ]
[ "sys", "storage", 3, "clob", "" ]
@@ -4420,7 +4420,7 @@ Ready.
[ "sys", "storage", 14, "bigint", "" ]
[ "sys", "storage", 15, "clob", "" ]
[ "sys", "storage", 16, "clob", "" ]
-[ "sys", "storage", 0, "clob", "create function
sys.\"storage\"( sname string, tname string, cname string)\nreturns table (\n
\"schema\" string,\n \"table\" string,\n \"column\" string,\n \"type\"
string,\n \"mode\" string,\n location string,\n \"count\" bigint,\n typewidth
int,\n columnsize bigint,\n heapsize bigint,\n hashes bigint,\n phash
boolean,\n imprints bigint,\n sorted boolean,\n orderidx bigint\n)\nexternal
name sql.\"storage\";" ]
+[ "sys", "storage", 0, "clob", "create function
sys.\"storage\"( sname string, tname string, cname string)\nreturns table (\n
\"schema\" string,\n \"table\" string,\n \"column\" string,\n \"type\"
string,\n \"mode\" string,\n location string,\n \"count\" bigint,\n typewidth
int,\n columnsize bigint,\n heapsize bigint,\n hashes bigint,\n phash
boolean,\n \"imprints\" bigint,\n sorted boolean,\n orderidx
bigint\n)\nexternal name sql.\"storage\";" ]
[ "sys", "storage", 1, "clob", "" ]
[ "sys", "storage", 2, "clob", "" ]
[ "sys", "storage", 3, "clob", "" ]
@@ -4438,7 +4438,7 @@ Ready.
[ "sys", "storage", 15, "clob", "" ]
[ "sys", "storage", 16, "clob", "" ]
[ "sys", "storage", 17, "clob", "" ]
-[ "sys", "storagemodel", 0, "clob", "create function
sys.storagemodel()\nreturns table (\n \"schema\" string,\n \"table\" string,\n
\"column\" string,\n \"type\" string,\n \"count\" bigint,\n columnsize
bigint,\n heapsize bigint,\n hashes bigint,\n imprints bigint,\n sorted
boolean,\n orderidx bigint)\nbegin\n return select i.\"schema\", i.\"table\",
i.\"column\", i.\"type\", i.\"count\",\n columnsize(i.\"type\", i.count,
i.\"distinct\"),\n heapsize(i.\"type\", i.\"distinct\", i.\"atomwidth\"),\n
hashsize(i.\"reference\", i.\"count\"),\n
imprintsize(i.\"count\",i.\"type\"),\n i.sorted, i.orderidx\n from
sys.storagemodelinput i;\nend;" ]
+[ "sys", "storagemodel", 0, "clob", "create function
sys.storagemodel()\nreturns table (\n \"schema\" string,\n \"table\" string,\n
\"column\" string,\n \"type\" string,\n \"count\" bigint,\n columnsize
bigint,\n heapsize bigint,\n hashes bigint,\n \"imprints\" bigint,\n sorted
boolean,\n orderidx bigint)\nbegin\n return select i.\"schema\", i.\"table\",
i.\"column\", i.\"type\", i.\"count\",\n columnsize(i.\"type\", i.count,
i.\"distinct\"),\n heapsize(i.\"type\", i.\"distinct\", i.\"atomwidth\"),\n
hashsize(i.\"reference\", i.\"count\"),\n
imprintsize(i.\"count\",i.\"type\"),\n i.sorted, i.orderidx\n from
sys.storagemodelinput i;\nend;" ]
[ "sys", "storagemodel", 1, "clob", "" ]
[ "sys", "storagemodel", 2, "clob", "" ]
[ "sys", "storagemodel", 3, "clob", "" ]
diff --git a/sql/test/Tests/systemfunctions.stable.out.int128
b/sql/test/Tests/systemfunctions.stable.out.int128
--- a/sql/test/Tests/systemfunctions.stable.out.int128
+++ b/sql/test/Tests/systemfunctions.stable.out.int128
@@ -4912,7 +4912,7 @@ Ready.
[ "sys", "stddev_samp", 1, "hugeint", "" ]
[ "sys", "stop", 0, "int", "create procedure sys.stop(tag
int)\nexternal name sql.sysmon_stop;" ]
[ "sys", "stop", 0, "bigint", "create procedure sys.stop(tag
bigint)\nexternal name sql.sysmon_stop;" ]
-[ "sys", "storage", 0, "clob", "create function
sys.\"storage\"()\nreturns table (\n \"schema\" string,\n \"table\" string,\n
\"column\" string,\n \"type\" string,\n \"mode\" string,\n location string,\n
\"count\" bigint,\n typewidth int,\n columnsize bigint,\n heapsize bigint,\n
hashes bigint,\n phash boolean,\n imprints bigint,\n sorted boolean,\n orderidx
bigint\n)\nexternal name sql.\"storage\";" ]
+[ "sys", "storage", 0, "clob", "create function
sys.\"storage\"()\nreturns table (\n \"schema\" string,\n \"table\" string,\n
\"column\" string,\n \"type\" string,\n \"mode\" string,\n location string,\n
\"count\" bigint,\n typewidth int,\n columnsize bigint,\n heapsize bigint,\n
hashes bigint,\n phash boolean,\n \"imprints\" bigint,\n sorted boolean,\n
orderidx bigint\n)\nexternal name sql.\"storage\";" ]
[ "sys", "storage", 1, "clob", "" ]
[ "sys", "storage", 2, "clob", "" ]
[ "sys", "storage", 3, "clob", "" ]
@@ -4927,7 +4927,7 @@ Ready.
[ "sys", "storage", 12, "bigint", "" ]
[ "sys", "storage", 13, "boolean", "" ]
[ "sys", "storage", 14, "bigint", "" ]
-[ "sys", "storage", 0, "clob", "create function
sys.\"storage\"( sname string)\nreturns table (\n \"schema\" string,\n
\"table\" string,\n \"column\" string,\n \"type\" string,\n \"mode\" string,\n
location string,\n \"count\" bigint,\n typewidth int,\n columnsize bigint,\n
heapsize bigint,\n hashes bigint,\n phash boolean,\n imprints bigint,\n sorted
boolean,\n orderidx bigint\n)\nexternal name sql.\"storage\";" ]
+[ "sys", "storage", 0, "clob", "create function
sys.\"storage\"( sname string)\nreturns table (\n \"schema\" string,\n
\"table\" string,\n \"column\" string,\n \"type\" string,\n \"mode\" string,\n
location string,\n \"count\" bigint,\n typewidth int,\n columnsize bigint,\n
heapsize bigint,\n hashes bigint,\n phash boolean,\n \"imprints\" bigint,\n
sorted boolean,\n orderidx bigint\n)\nexternal name sql.\"storage\";" ]
[ "sys", "storage", 1, "clob", "" ]
[ "sys", "storage", 2, "clob", "" ]
[ "sys", "storage", 3, "clob", "" ]
@@ -4943,7 +4943,7 @@ Ready.
[ "sys", "storage", 13, "boolean", "" ]
[ "sys", "storage", 14, "bigint", "" ]
[ "sys", "storage", 15, "clob", "" ]
-[ "sys", "storage", 0, "clob", "create function
sys.\"storage\"( sname string, tname string)\nreturns table (\n \"schema\"
string,\n \"table\" string,\n \"column\" string,\n \"type\" string,\n \"mode\"
string,\n location string,\n \"count\" bigint,\n typewidth int,\n columnsize
bigint,\n heapsize bigint,\n hashes bigint,\n phash boolean,\n imprints
bigint,\n sorted boolean,\n orderidx bigint\n)\nexternal name sql.\"storage\";"
]
+[ "sys", "storage", 0, "clob", "create function
sys.\"storage\"( sname string, tname string)\nreturns table (\n \"schema\"
string,\n \"table\" string,\n \"column\" string,\n \"type\" string,\n \"mode\"
string,\n location string,\n \"count\" bigint,\n typewidth int,\n columnsize
bigint,\n heapsize bigint,\n hashes bigint,\n phash boolean,\n \"imprints\"
bigint,\n sorted boolean,\n orderidx bigint\n)\nexternal name sql.\"storage\";"
]
[ "sys", "storage", 1, "clob", "" ]
[ "sys", "storage", 2, "clob", "" ]
[ "sys", "storage", 3, "clob", "" ]
@@ -4960,7 +4960,7 @@ Ready.
[ "sys", "storage", 14, "bigint", "" ]
[ "sys", "storage", 15, "clob", "" ]
[ "sys", "storage", 16, "clob", "" ]
-[ "sys", "storage", 0, "clob", "create function
sys.\"storage\"( sname string, tname string, cname string)\nreturns table (\n
\"schema\" string,\n \"table\" string,\n \"column\" string,\n \"type\"
string,\n \"mode\" string,\n location string,\n \"count\" bigint,\n typewidth
int,\n columnsize bigint,\n heapsize bigint,\n hashes bigint,\n phash
boolean,\n imprints bigint,\n sorted boolean,\n orderidx bigint\n)\nexternal
name sql.\"storage\";" ]
+[ "sys", "storage", 0, "clob", "create function
sys.\"storage\"( sname string, tname string, cname string)\nreturns table (\n
\"schema\" string,\n \"table\" string,\n \"column\" string,\n \"type\"
string,\n \"mode\" string,\n location string,\n \"count\" bigint,\n typewidth
int,\n columnsize bigint,\n heapsize bigint,\n hashes bigint,\n phash
boolean,\n \"imprints\" bigint,\n sorted boolean,\n orderidx
bigint\n)\nexternal name sql.\"storage\";" ]
[ "sys", "storage", 1, "clob", "" ]
[ "sys", "storage", 2, "clob", "" ]
[ "sys", "storage", 3, "clob", "" ]
@@ -4978,7 +4978,7 @@ Ready.
[ "sys", "storage", 15, "clob", "" ]
[ "sys", "storage", 16, "clob", "" ]
[ "sys", "storage", 17, "clob", "" ]
-[ "sys", "storagemodel", 0, "clob", "create function
sys.storagemodel()\nreturns table (\n \"schema\" string,\n \"table\" string,\n
\"column\" string,\n \"type\" string,\n \"count\" bigint,\n columnsize
bigint,\n heapsize bigint,\n hashes bigint,\n imprints bigint,\n sorted
boolean,\n orderidx bigint)\nbegin\n return select i.\"schema\", i.\"table\",
i.\"column\", i.\"type\", i.\"count\",\n columnsize(i.\"type\", i.count,
i.\"distinct\"),\n heapsize(i.\"type\", i.\"distinct\", i.\"atomwidth\"),\n
hashsize(i.\"reference\", i.\"count\"),\n
imprintsize(i.\"count\",i.\"type\"),\n i.sorted, i.orderidx\n from
sys.storagemodelinput i;\nend;" ]
+[ "sys", "storagemodel", 0, "clob", "create function
sys.storagemodel()\nreturns table (\n \"schema\" string,\n \"table\" string,\n
\"column\" string,\n \"type\" string,\n \"count\" bigint,\n columnsize
bigint,\n heapsize bigint,\n hashes bigint,\n \"imprints\" bigint,\n sorted
boolean,\n orderidx bigint)\nbegin\n return select i.\"schema\", i.\"table\",
i.\"column\", i.\"type\", i.\"count\",\n columnsize(i.\"type\", i.count,
i.\"distinct\"),\n heapsize(i.\"type\", i.\"distinct\", i.\"atomwidth\"),\n
hashsize(i.\"reference\", i.\"count\"),\n
imprintsize(i.\"count\",i.\"type\"),\n i.sorted, i.orderidx\n from
sys.storagemodelinput i;\nend;" ]
[ "sys", "storagemodel", 1, "clob", "" ]
[ "sys", "storagemodel", 2, "clob", "" ]
[ "sys", "storagemodel", 3, "clob", "" ]
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list