Changeset: a0eaf13c59cf for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/a0eaf13c59cf
Modified Files:
sql/backends/monet5/sql.c
sql/common/sql_types.c
sql/test/SQLancer/Tests/sqlancer08.test
Branch: pushcands
Log Message:
cleanup of unused (test) functionality (index/strings)
diffs (truncated from 310 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
@@ -4103,236 +4103,6 @@ freeVariables(Client c, MalBlkPtr mb, Ma
mb->vid = oldvid;
}
-/* if at least (2*SIZEOF_BUN), also store length (heaps are then
- * incompatible) */
-#define EXTRALEN ((SIZEOF_BUN + GDK_VARALIGN - 1) & ~(GDK_VARALIGN - 1))
-
-str
-STRindex_int(int *i, const str *src, const bit *u)
-{
- (void)src; (void)u;
- *i = 0;
- return MAL_SUCCEED;
-}
-
-str
-BATSTRindex_int(bat *res, const bat *src, const bit *u)
-{
- BAT *s, *r;
-
- if ((s = BATdescriptor(*src)) == NULL)
- throw(SQL, "calc.index", SQLSTATE(HY005) "Cannot access column
descriptor");
-
- if (*u) {
- Heap *h = s->tvheap;
- size_t pad, pos;
- const size_t extralen = h->hashash ? EXTRALEN : 0;
- int v;
-
- r = COLnew(0, TYPE_int, 1024, TRANSIENT);
- if (r == NULL) {
- BBPunfix(s->batCacheid);
- throw(SQL, "calc.index", SQLSTATE(HY013)
MAL_MALLOC_FAIL);
- }
- pos = GDK_STRHASHSIZE;
- while (pos < h->free) {
- const char *p;
-
- pad = GDK_VARALIGN - (pos & (GDK_VARALIGN - 1));
- if (pad < sizeof(stridx_t))
- pad += GDK_VARALIGN;
- pos += pad + extralen;
- p = h->base + pos;
- v = (int) (pos - GDK_STRHASHSIZE);
- if (BUNappend(r, &v, false) != GDK_SUCCEED) {
- BBPreclaim(r);
- BBPunfix(s->batCacheid);
- throw(SQL, "calc.index", SQLSTATE(HY013)
MAL_MALLOC_FAIL);
- }
- pos += strLen(p);
- }
- } else {
- r = VIEWcreate(s->hseqbase, s);
- if (r == NULL) {
- BBPunfix(s->batCacheid);
- throw(SQL, "calc.index", SQLSTATE(HY013)
MAL_MALLOC_FAIL);
- }
- r->ttype = TYPE_int;
- r->tvarsized = false;
- HEAPdecref(r->tvheap, false);
- r->tvheap = NULL;
- }
- BBPunfix(s->batCacheid);
- BBPkeepref((*res = r->batCacheid));
- return MAL_SUCCEED;
-}
-
-str
-STRindex_sht(sht *i, const str *src, const bit *u)
-{
- (void)src; (void)u;
- *i = 0;
- return MAL_SUCCEED;
-}
-
-str
-BATSTRindex_sht(bat *res, const bat *src, const bit *u)
-{
- BAT *s, *r;
-
- if ((s = BATdescriptor(*src)) == NULL)
- throw(SQL, "calc.index", SQLSTATE(HY005) "Cannot access column
descriptor");
-
- if (*u) {
- Heap *h = s->tvheap;
- size_t pad, pos;
- const size_t extralen = h->hashash ? EXTRALEN : 0;
- sht v;
-
- r = COLnew(0, TYPE_sht, 1024, TRANSIENT);
- if (r == NULL) {
- BBPunfix(s->batCacheid);
- throw(SQL, "calc.index", SQLSTATE(HY013)
MAL_MALLOC_FAIL);
- }
- pos = GDK_STRHASHSIZE;
- while (pos < h->free) {
- const char *s;
-
- pad = GDK_VARALIGN - (pos & (GDK_VARALIGN - 1));
- if (pad < sizeof(stridx_t))
- pad += GDK_VARALIGN;
- pos += pad + extralen;
- s = h->base + pos;
- v = (sht) (pos - GDK_STRHASHSIZE);
- if (BUNappend(r, &v, false) != GDK_SUCCEED) {
- BBPreclaim(r);
- throw(SQL, "calc.index", SQLSTATE(HY013)
MAL_MALLOC_FAIL);
- }
- pos += strLen(s);
- }
- } else {
- r = VIEWcreate(s->hseqbase, s);
- if (r == NULL) {
- BBPunfix(s->batCacheid);
- throw(SQL, "calc.index", SQLSTATE(HY013)
MAL_MALLOC_FAIL);
- }
- r->ttype = TYPE_sht;
- r->tvarsized = false;
- HEAPdecref(r->tvheap, false);
- r->tvheap = NULL;
- }
- BBPunfix(s->batCacheid);
- BBPkeepref((*res = r->batCacheid));
- return MAL_SUCCEED;
-}
-
-str
-STRindex_bte(bte *i, const str *src, const bit *u)
-{
- (void)src; (void)u;
- *i = 0;
- return MAL_SUCCEED;
-}
-
-str
-BATSTRindex_bte(bat *res, const bat *src, const bit *u)
-{
- BAT *s, *r;
-
- if ((s = BATdescriptor(*src)) == NULL)
- throw(SQL, "calc.index", SQLSTATE(HY005) "Cannot access column
descriptor");
-
- if (*u) {
- Heap *h = s->tvheap;
- size_t pad, pos;
- const size_t extralen = h->hashash ? EXTRALEN : 0;
- bte v;
-
- r = COLnew(0, TYPE_bte, 64, TRANSIENT);
- if (r == NULL) {
- BBPunfix(s->batCacheid);
- throw(SQL, "calc.index", SQLSTATE(HY013)
MAL_MALLOC_FAIL);
- }
- pos = GDK_STRHASHSIZE;
- while (pos < h->free) {
- const char *p;
-
- pad = GDK_VARALIGN - (pos & (GDK_VARALIGN - 1));
- if (pad < sizeof(stridx_t))
- pad += GDK_VARALIGN;
- pos += pad + extralen;
- p = h->base + pos;
- v = (bte) (pos - GDK_STRHASHSIZE);
- if (BUNappend(r, &v, false) != GDK_SUCCEED) {
- BBPreclaim(r);
- BBPunfix(s->batCacheid);
- throw(SQL, "calc.index", SQLSTATE(HY013)
MAL_MALLOC_FAIL);
- }
- pos += strLen(p);
- }
- } else {
- r = VIEWcreate(s->hseqbase, s);
- if (r == NULL) {
- BBPunfix(s->batCacheid);
- throw(SQL, "calc.index", SQLSTATE(HY013)
MAL_MALLOC_FAIL);
- }
- r->ttype = TYPE_bte;
- r->tvarsized = false;
- HEAPdecref(r->tvheap, false);
- r->tvheap = NULL;
- }
- BBPunfix(s->batCacheid);
- BBPkeepref((*res = r->batCacheid));
- return MAL_SUCCEED;
-}
-
-str
-STRstrings(str *i, const str *src)
-{
- (void)src;
- *i = 0;
- return MAL_SUCCEED;
-}
-
-str
-BATSTRstrings(bat *res, const bat *src)
-{
- BAT *s, *r;
- Heap *h;
- size_t pad, pos;
- size_t extralen;
-
- if ((s = BATdescriptor(*src)) == NULL)
- throw(SQL, "calc.strings", SQLSTATE(HY005) "Cannot access
column descriptor");
-
- h = s->tvheap;
- extralen = h->hashash ? EXTRALEN : 0;
- r = COLnew(0, TYPE_str, 1024, TRANSIENT);
- if (r == NULL) {
- BBPunfix(s->batCacheid);
- throw(SQL, "calc.strings", SQLSTATE(HY013) MAL_MALLOC_FAIL);
- }
- pos = GDK_STRHASHSIZE;
- while (pos < h->free) {
- const char *p;
-
- pad = GDK_VARALIGN - (pos & (GDK_VARALIGN - 1));
- if (pad < sizeof(stridx_t))
- pad += GDK_VARALIGN;
- pos += pad + extralen;
- p = h->base + pos;
- if (BUNappend(r, p, false) != GDK_SUCCEED) {
- BBPreclaim(r);
- BBPunfix(s->batCacheid);
- throw(SQL, "calc.strings", SQLSTATE(HY013)
MAL_MALLOC_FAIL);
- }
- pos += strLen(p);
- }
- BBPunfix(s->batCacheid);
- BBPkeepref((*res = r->batCacheid));
- return MAL_SUCCEED;
-}
-
str
SQLresume_log_flushing(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
{
@@ -5144,14 +4914,6 @@ static mel_func sql_init_funcs[] = {
pattern("batcalc", "daytime", timestamp_2_daytime, false, "cast timestamp to
a daytime and check for overflow", args(1,4,
batarg("",daytime),batarg("v",timestamp),batarg("s",oid),arg("d",int))),
pattern("calc", "timestamp", date_2_timestamp, false, "cast date to a
timestamp and check for overflow", args(1,3,
arg("",timestamp),arg("v",date),arg("d",int))),
pattern("batcalc", "timestamp", date_2_timestamp, false, "cast date to a
timestamp and check for overflow", args(1,4,
batarg("",timestamp),batarg("v",date),batarg("s",oid),arg("d",int))),
- command("sql", "index", STRindex_bte, false, "Return the offsets as an index
bat", args(1,3, arg("",bte),arg("v",str),arg("u",bit))), /* TODO add candidate
list support? */
- command("batsql", "index", BATSTRindex_bte, false, "Return the offsets as an
index bat", args(1,3, batarg("",bte),batarg("v",str),arg("u",bit))),
- command("sql", "index", STRindex_sht, false, "Return the offsets as an index
bat", args(1,3, arg("",sht),arg("v",str),arg("u",bit))),
- command("batsql", "index", BATSTRindex_sht, false, "Return the offsets as an
index bat", args(1,3, batarg("",sht),batarg("v",str),arg("u",bit))),
- command("sql", "index", STRindex_int, false, "Return the offsets as an index
bat", args(1,3, arg("",int),arg("v",str),arg("u",bit))),
- command("batsql", "index", BATSTRindex_int, false, "Return the offsets as an
index bat", args(1,3, batarg("",int),batarg("v",str),arg("u",bit))),
- command("sql", "strings", STRstrings, false, "Return the strings", args(1,2,
arg("",str),arg("v",str))), /* TODO add candidate list support? */
- command("batsql", "strings", BATSTRstrings, false, "Return the strings",
args(1,2, batarg("",str),batarg("v",str))),
pattern("sql", "update_tables", SYSupdate_tables, true, "Procedure triggered
on update of the sys._tables table", args(1,1, arg("",void))),
pattern("sql", "update_schemas", SYSupdate_schemas, true, "Procedure
triggered on update of the sys.schemas table", args(1,1, arg("",void))),
pattern("sql", "unionfunc", SQLunionfunc, false, "", args(1,4,
varargany("",0),arg("mod",str),arg("fcn",str),varargany("",0))),
diff --git a/sql/common/sql_types.c b/sql/common/sql_types.c
--- a/sql/common/sql_types.c
+++ b/sql/common/sql_types.c
@@ -1454,11 +1454,6 @@ sqltypeinit( sql_allocator *sa)
sql_create_func(sa, "get_value_for", "sql", "get_value", TRUE,
FALSE, SCALE_NONE, 0, LNG, 2, *t, *t);
sql_create_func(sa, "restart", "sql", "restart", TRUE, TRUE,
SCALE_NONE, 0, LNG, 3, *t, *t, LNG);
- sql_create_func(sa, "index", "sql", "index", TRUE, FALSE,
SCALE_NONE, 0, BTE, 2, *t, BIT);
- sql_create_func(sa, "index", "sql", "index", TRUE, FALSE,
SCALE_NONE, 0, SHT, 2, *t, BIT);
- sql_create_func(sa, "index", "sql", "index", TRUE, FALSE,
SCALE_NONE, 0, INT, 2, *t, BIT);
- sql_create_func(sa, "strings", "sql", "strings", FALSE, FALSE,
SCALE_NONE, 0, *t, 1, *t);
-
sql_create_func(sa, "locate", "str", "locate", FALSE, FALSE,
SCALE_NONE, 0, INT, 2, *t, *t);
sql_create_func(sa, "locate", "str", "locate3", FALSE, FALSE,
SCALE_NONE, 0, INT, 3, *t, *t, INT);
sql_create_func(sa, "charindex", "str", "locate", FALSE, FALSE,
SCALE_NONE, 0, INT, 2, *t, *t);
diff --git a/sql/test/SQLancer/Tests/sqlancer08.test
b/sql/test/SQLancer/Tests/sqlancer08.test
--- a/sql/test/SQLancer/Tests/sqlancer08.test
+++ b/sql/test/SQLancer/Tests/sqlancer08.test
@@ -261,36 +261,6 @@ statement ok
START TRANSACTION
statement ok
-CREATE TABLE "sys"."salesmart"("city" VARCHAR(100))
-
-statement ok
-COPY 5 RECORDS INTO "sys"."salesmart" FROM stdin USING DELIMITERS
E'\t',E'\n','"'
-<COPY_INTO_DATA>
-"b~dEQ~"
-"77378079"
-"0.8200084709639743"
-""
-"\015"
-
-query I rowsort
-SELECT 1 FROM salesmart WHERE CAST(1 AS BOOLEAN) OR "index"(salesmart.city,
true)
-----
-1
-1
-1
-1
-1
-
-statement ok
-DELETE FROM salesmart WHERE (((CAST(CAST(-1073480726 AS BOOLEAN) AS BOOLEAN))
= TRUE)OR(CAST("index"(substr(salesmart.city, 1058445329, 887361238),
(-528898388) IS NOT NULL) AS BOOLEAN)))
-
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list