Changeset: d360aef01d4e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/d360aef01d4e
Modified Files:
clients/Tests/MAL-signatures-hge.test
clients/Tests/MAL-signatures.test
clients/Tests/exports.stable.out
gdk/gdk.h
gdk/gdk_bat.c
monetdb5/ChangeLog
monetdb5/modules/kernel/bat5.c
Branch: default
Log Message:
Removed function BATattach and its MAL interface bat.attach.
diffs (259 lines):
diff --git a/clients/Tests/MAL-signatures-hge.test
b/clients/Tests/MAL-signatures-hge.test
--- a/clients/Tests/MAL-signatures-hge.test
+++ b/clients/Tests/MAL-signatures-hge.test
@@ -3729,11 +3729,6 @@ pattern bat.appendBulk(X_0:bat[:any_1],
CMDBATappend_bulk;
append the arguments ins to i
bat
-attach
-command bat.attach(X_0:int, X_1:str):bat[:any_1]
-BKCattach;
-Returns a new BAT with dense head and tail of the given type and uses@the
given file to initialize the tail. The file will be owned by the@server.
-bat
delete
command bat.delete(X_0:bat[:any_1], X_1:oid):bat[:any_1]
BKCdelete;
diff --git a/clients/Tests/MAL-signatures.test
b/clients/Tests/MAL-signatures.test
--- a/clients/Tests/MAL-signatures.test
+++ b/clients/Tests/MAL-signatures.test
@@ -3164,11 +3164,6 @@ pattern bat.appendBulk(X_0:bat[:any_1],
CMDBATappend_bulk;
append the arguments ins to i
bat
-attach
-command bat.attach(X_0:int, X_1:str):bat[:any_1]
-BKCattach;
-Returns a new BAT with dense head and tail of the given type and uses@the
given file to initialize the tail. The file will be owned by the@server.
-bat
delete
command bat.delete(X_0:bat[:any_1], X_1:oid):bat[:any_1]
BKCdelete;
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
@@ -19,7 +19,6 @@ gdk_return BATappend(BAT *b, BAT *n, BAT
BAT *BATasciify(BAT *b, BAT *s);
void BATassertProps(BAT *b);
atomDesc BATatoms[MAXATOMS];
-BAT *BATattach(int tt, const char *heapfile, role_t role);
gdk_return BATbandjoin(BAT **r1p, BAT **r2p, BAT *l, BAT *r, BAT *sl, BAT *sr,
const void *c1, const void *c2, bool li, bool hi, BUN estimate)
__attribute__((__access__(write_only, 1)))
__attribute__((__access__(write_only, 2)))
__attribute__((__warn_unused_result__));
BAT *BATcalcabsolute(BAT *b, BAT *s);
BAT *BATcalcadd(BAT *b1, BAT *b2, BAT *s1, BAT *s2, int tp);
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -1905,7 +1905,6 @@ gdk_export bool BATcheckorderidx(BAT *b)
/* functions defined in gdk_bat.c */
gdk_export gdk_return void_inplace(BAT *b, oid id, const void *val, bool force)
__attribute__((__warn_unused_result__));
-gdk_export BAT *BATattach(int tt, const char *heapfile, role_t role);
#ifdef NATIVE_WIN32
#ifdef _MSC_VER
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -310,159 +310,6 @@ BATdense(oid hseq, oid tseq, BUN cnt)
return bn;
}
-BAT *
-BATattach(int tt, const char *heapfile, role_t role)
-{
- BAT *bn;
- char *p;
- size_t m;
- FILE *f;
-
- ERRORcheck(tt <= 0 , "bad tail type (<=0)\n", NULL);
- ERRORcheck(ATOMvarsized(tt) && ATOMstorage(tt) != TYPE_str, "bad tail
type (varsized and not str)\n", NULL);
- ERRORcheck(heapfile == NULL, "bad heapfile name\n", NULL);
-
- if ((f = MT_fopen(heapfile, "rb")) == NULL) {
- GDKsyserror("BATattach: cannot open %s\n", heapfile);
- return NULL;
- }
- if (ATOMstorage(tt) == TYPE_str) {
- size_t n;
- char *s;
- int c, u;
-
- if ((bn = COLnew(0, tt, 0, role)) == NULL) {
- fclose(f);
- return NULL;
- }
- m = 4096;
- n = 0;
- u = 0;
- s = p = GDKmalloc(m);
- if (p == NULL) {
- fclose(f);
- BBPreclaim(bn);
- return NULL;
- }
- while ((c = getc(f)) != EOF) {
- if (n == m) {
- m += 4096;
- s = GDKrealloc(p, m);
- if (s == NULL) {
- GDKfree(p);
- BBPreclaim(bn);
- fclose(f);
- return NULL;
- }
- p = s;
- s = p + n;
- }
- if (c == '\n' && n > 0 && s[-1] == '\r') {
- /* deal with CR-LF sequence */
- s[-1] = c;
- } else {
- *s++ = c;
- n++;
- }
- if (u) {
- if ((c & 0xC0) == 0x80)
- u--;
- else
- goto notutf8;
- } else if ((c & 0xF8) == 0xF0)
- u = 3;
- else if ((c & 0xF0) == 0xE0)
- u = 2;
- else if ((c & 0xE0) == 0xC0)
- u = 1;
- else if ((c & 0x80) == 0x80)
- goto notutf8;
- else if (c == 0) {
- if (BUNappend(bn, p, false) != GDK_SUCCEED) {
- BBPreclaim(bn);
- fclose(f);
- GDKfree(p);
- return NULL;
- }
- s = p;
- n = 0;
- }
- }
- fclose(f);
- GDKfree(p);
- if (n > 0) {
- BBPreclaim(bn);
- GDKerror("last string is not null-terminated\n");
- return NULL;
- }
- } else {
- struct stat st;
- int atomsize;
- BUN cap;
- lng n;
-
- if (fstat(fileno(f), &st) < 0) {
- GDKsyserror("BATattach: cannot stat %s\n", heapfile);
- fclose(f);
- return NULL;
- }
- atomsize = ATOMsize(tt);
- if (st.st_size % atomsize != 0) {
- fclose(f);
- GDKerror("heapfile size not integral number of
atoms\n");
- return NULL;
- }
- if (ATOMstorage(tt) == TYPE_msk ?
- (st.st_size > (off_t) (BUN_MAX / 8)) :
- ((size_t) (st.st_size / atomsize) > (size_t) BUN_MAX)) {
- fclose(f);
- GDKerror("heapfile too large\n");
- return NULL;
- }
- cap = (BUN) (ATOMstorage(tt) == TYPE_msk ?
- st.st_size * 8 :
- st.st_size / atomsize);
- bn = COLnew(0, tt, cap, role);
- if (bn == NULL) {
- fclose(f);
- return NULL;
- }
- p = Tloc(bn, 0);
- n = (lng) st.st_size;
- while (n > 0 && (m = fread(p, 1, (size_t) MIN(1024*1024, n),
f)) > 0) {
- p += m;
- n -= m;
- }
- fclose(f);
- if (n > 0) {
- GDKerror("couldn't read the complete file\n");
- BBPreclaim(bn);
- return NULL;
- }
- BATsetcount(bn, cap);
- bn->tnonil = cap == 0;
- bn->tnil = false;
- bn->tseqbase = oid_nil;
- if (cap > 1) {
- bn->tsorted = false;
- bn->trevsorted = false;
- bn->tkey = false;
- } else {
- bn->tsorted = ATOMlinear(tt);
- bn->trevsorted = ATOMlinear(tt);
- bn->tkey = true;
- }
- }
- return bn;
-
- notutf8:
- fclose(f);
- BBPreclaim(bn);
- GDKfree(p);
- GDKerror("input is not UTF-8\n");
- return NULL;
-}
-
/*
* If the BAT runs out of storage for BUNS it will reallocate space.
* For memory mapped BATs we simple extend the administration after
diff --git a/monetdb5/ChangeLog b/monetdb5/ChangeLog
--- a/monetdb5/ChangeLog
+++ b/monetdb5/ChangeLog
@@ -1,6 +1,9 @@
# ChangeLog file for MonetDB5
# This file is updated with Maddlog
+* Mon Jan 13 2025 Sjoerd Mullender <[email protected]>
+- Removed function bat.attach since it wasn't used.
+
* Fri Nov 22 2024 Sjoerd Mullender <[email protected]>
- Removed the MAL type "identifier" and supporting functions. There has
never been an SQL interface to this type.
diff --git a/monetdb5/modules/kernel/bat5.c b/monetdb5/modules/kernel/bat5.c
--- a/monetdb5/modules/kernel/bat5.c
+++ b/monetdb5/modules/kernel/bat5.c
@@ -73,19 +73,6 @@ BKCnewBAT(bat *res, const int *tt, const
}
static str
-BKCattach(bat *ret, const int *tt, const char *const *heapfile)
-{
- BAT *bn;
-
- bn = BATattach(*tt, *heapfile, TRANSIENT);
- if (bn == NULL)
- throw(MAL, "bat.attach", GDK_EXCEPTION);
- *ret = bn->batCacheid;
- BBPkeepref(bn);
- return MAL_SUCCEED;
-}
-
-static str
BKCdensebat(bat *ret, const lng *size)
{
BAT *bn;
@@ -1100,7 +1087,6 @@ mel_func bat5_init_funcs[] = {
command("bat", "append", BKCappend_cand_wrap, false, "append the content of u
with candidate list s to i", args(1,4,
batargany("",1),batargany("i",1),batargany("u",1),batarg("s",oid))),
command("bat", "append", BKCappend_cand_force_wrap, false, "append the
content of u with candidate list s to i", args(1,5,
batargany("",1),batargany("i",1),batargany("u",1),batarg("s",oid),arg("force",bit))),
command("bat", "append", BKCappend_val_force_wrap, false, "append the value u
to i", args(1,4,
batargany("",1),batargany("i",1),argany("u",1),arg("force",bit))),
- command("bat", "attach", BKCattach, false, "Returns a new BAT with dense head
and tail of the given type and uses\nthe given file to initialize the tail. The
file will be owned by the\nserver.", args(1,3,
batargany("",1),arg("tt",int),arg("heapfile",str))),
command("bat", "densebat", BKCdensebat, false, "Creates a new [void,void] BAT
of size 'sz'.", args(1,2, batarg("",oid),arg("sz",lng))),
command("bat", "info", BKCinfo, false, "Produce a table containing
information about a BAT in [attribute,value] format. \nIt contains all
properties of the BAT record. ", args(2,3,
batarg("",str),batarg("",str),batargany("b",1))),
command("bat", "getSize", BKCgetSize, false, "Calculate the actual size of
the BAT descriptor, heaps, hashes in bytes\nrounded to the memory page size
(see bbp.getPageSize()).", args(1,2, arg("",lng),batargany("b",1))),
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]