Changeset: 404c6745ff0c for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=404c6745ff0c
Modified Files:
clients/Tests/MAL-signatures.stable.out
clients/Tests/MAL-signatures.stable.out.int128
gdk/gdk_value.c
monetdb5/extras/rapi/rapi.c
monetdb5/mal/mal_interpreter.c
monetdb5/modules/atoms/json.c
monetdb5/modules/mal/Tests/inspect00.stable.out
monetdb5/modules/mal/batcalc.c
monetdb5/modules/mal/mdb.mal
Branch: geo
Log Message:
Merge with default branch.
diffs (truncated from 360 to 300 lines):
diff --git a/clients/Tests/MAL-signatures.stable.out
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -39526,7 +39526,7 @@ pattern mdb.getDefinition():bat[:oid,:st
address MDBgetDefinition;
comment Returns a string representation of the current function with
typing information attached
-pattern mdb.getStackTrace() (X_1:bat[:oid,:str],X_2:bat[:oid,:str])
+pattern mdb.getStackTrace() (X_1:bat[:oid,:int],X_2:bat[:oid,:str])
address MDBStkTrace;
pattern mdb.getStackFrame() (X_1:bat[:oid,:str],X_2:bat[:oid,:str])
address MDBgetStackFrame;
diff --git a/clients/Tests/MAL-signatures.stable.out.int128
b/clients/Tests/MAL-signatures.stable.out.int128
--- a/clients/Tests/MAL-signatures.stable.out.int128
+++ b/clients/Tests/MAL-signatures.stable.out.int128
@@ -50453,7 +50453,7 @@ pattern mdb.getDefinition():bat[:oid,:st
address MDBgetDefinition;
comment Returns a string representation of the current function with
typing information attached
-pattern mdb.getStackTrace() (X_1:bat[:oid,:str],X_2:bat[:oid,:str])
+pattern mdb.getStackTrace() (X_1:bat[:oid,:int],X_2:bat[:oid,:str])
address MDBStkTrace;
pattern mdb.getStackFrame() (X_1:bat[:oid,:str],X_2:bat[:oid,:str])
address MDBgetStackFrame;
diff --git a/gdk/gdk_value.c b/gdk/gdk_value.c
--- a/gdk/gdk_value.c
+++ b/gdk/gdk_value.c
@@ -175,7 +175,7 @@ VALinit(ValPtr d, int tpe, const void *s
GDKerror("VALinit:unsupported init\n");
d->vtype = TYPE_int;
} else if (tpe >= TYPE_str && ATOMstorage(tpe) == TYPE_str) {
- d->vtype = TYPE_str;
+ d->vtype = tpe;
d->val.sval = GDKstrdup(s);
d->len = strLen(s);
} else {
diff --git a/monetdb5/extras/rapi/rapi.c b/monetdb5/extras/rapi/rapi.c
--- a/monetdb5/extras/rapi/rapi.c
+++ b/monetdb5/extras/rapi/rapi.c
@@ -645,7 +645,7 @@ str RAPIeval(Client cntxt, MalBlkPtr mb,
i,
rtypename(TYPEOF(ret_col)));
goto wrapup;
}
- SXP_TO_BAT(bte, LOGICAL_POINTER, *p==NA_LOGICAL);
+ SXP_TO_BAT(bit, LOGICAL_POINTER, *p==NA_LOGICAL);
break;
}
case TYPE_dbl: {
diff --git a/monetdb5/mal/mal_interpreter.c b/monetdb5/mal/mal_interpreter.c
--- a/monetdb5/mal/mal_interpreter.c
+++ b/monetdb5/mal/mal_interpreter.c
@@ -627,11 +627,52 @@ str runMALsequence(Client cntxt, MalBlkP
if (pci->fcn == NULL) {
ret = createScriptException(mb, stkpc,
MAL, NULL,
"address of pattern %s.%s
missing", pci->modname, pci->fcnname);
- } else
+ } else {
ret = (str)(*pci->fcn)(cntxt, mb, stk,
pci);
+#ifndef NDEBUG
+ /* check that the types of actual
results match
+ * expected results */
+ for (i = 0; i < pci->retc; i++) {
+ int a = getArg(pci, i);
+ int t = getArgType(mb, pci, i);
+
+ if (isaBatType(t)) {
+ bat bid =
stk->stk[a].val.bval;
+ t = getColumnType(t);
+
assert(stk->stk[a].vtype == TYPE_bat);
+ assert(bid == 0 ||
+ bid ==
bat_nil ||
+ t ==
TYPE_any ||
+
ATOMtype(BBP_cache(bid)->ttype) == ATOMtype(t));
+ } else {
+ assert(t ==
stk->stk[a].vtype);
+ }
+ }
+#endif
+ }
break;
case CMDcall:
ret =malCommandCall(stk, pci);
+#ifndef NDEBUG
+ /* check that the types of actual results match
+ * expected results */
+ for (i = 0; i < pci->retc; i++) {
+ int a = getArg(pci, i);
+ int t = getArgType(mb, pci, i);
+
+ if (isaBatType(t)) {
+ bat bid = stk->stk[a].val.bval;
+ t = getColumnType(t);
+ assert(stk->stk[a].vtype ==
TYPE_bat);
+ assert(bid == 0 ||
+ bid == bat_nil ||
+ t == TYPE_any ||
+
ATOMtype(BBP_cache(bid)->ttype) == ATOMtype(t));
+ } else {
+ assert(t == stk->stk[a].vtype);
+ }
+ }
+#endif
break;
case FACcall:
/*
diff --git a/monetdb5/modules/atoms/json.c b/monetdb5/modules/atoms/json.c
--- a/monetdb5/modules/atoms/json.c
+++ b/monetdb5/modules/atoms/json.c
@@ -115,8 +115,15 @@ JSONtoString(str *s, int *len, json src)
char *c, *dst;
if (GDK_STRNIL(src)) {
- *s = GDKstrdup("null");
- return 0;
+ if (*s == NULL || *len < 4) {
+ GDKfree(*s);
+ *len = 4;
+ *s = GDKmalloc(4);
+ if (*s == NULL)
+ return -1;
+ }
+ strncpy(*s, "nil", 4);
+ return 3;
}
/* count how much space we need for the output string */
cnt = 3; /* two times " plus \0 */
@@ -1287,7 +1294,7 @@ JSONvalueTable(bat *ret, json *js)
JSON *jt;
jt = JSONparse(*js, TRUE); // already validated
- bn = BATnew(TYPE_void, TYPE_str, 64, TRANSIENT);
+ bn = BATnew(TYPE_void, TYPE_json, 64, TRANSIENT);
if (bn == NULL)
throw(MAL, "json.values", MAL_MALLOC_FAIL);
BATseqbase(bn, 0);
diff --git a/monetdb5/modules/mal/Tests/inspect00.stable.out
b/monetdb5/modules/mal/Tests/inspect00.stable.out
--- a/monetdb5/modules/mal/Tests/inspect00.stable.out
+++ b/monetdb5/modules/mal/Tests/inspect00.stable.out
@@ -33,7 +33,7 @@ stack depth 2
# view stk stk # name
# void int str # type
#--------------------------#
-[ 0@0, 0, " (h=nil:bat[:oid,:str],t=nil:bat[:oid,:str]) :=
mdb.getStackTrace(); at user.tst[3]" ]
+[ 0@0, 0, " (h=nil:bat[:oid,:int],t=nil:bat[:oid,:str]) :=
mdb.getStackTrace(); at user.tst[3]" ]
[ 1@0, 1, " user.tst(); at user.main[2]" ]
#-------------------------------------------------#
# view stk stk # name
diff --git a/monetdb5/modules/mal/batcalc.c b/monetdb5/modules/mal/batcalc.c
--- a/monetdb5/modules/mal/batcalc.c
+++ b/monetdb5/modules/mal/batcalc.c
@@ -303,7 +303,7 @@ calcmodtype(int tp1, int tp2)
}
static str
-CMDbatBINARY2(MalStkPtr stk, InstrPtr pci,
+CMDbatBINARY2(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci,
BAT *(*batfunc)(BAT *, BAT *, BAT *, int, int),
BAT *(batfunc1)(BAT *, const ValRecord *, BAT *, int,
int),
BAT *(batfunc2)(const ValRecord *, BAT *, BAT *, int,
int),
@@ -312,10 +312,13 @@ CMDbatBINARY2(MalStkPtr stk, InstrPtr pc
{
bat *bid;
BAT *bn, *b, *s = NULL;
- int tp1, tp2;
+ int tp1, tp2, tp3;
tp1 = stk->stk[getArg(pci, 1)].vtype;
tp2 = stk->stk[getArg(pci, 2)].vtype;
+ tp3 = getArgType(mb, pci, 0);
+ assert(isaBatType(tp3));
+ tp3 = getColumnType(tp3);
if (pci->argc == 4) {
bat *sid = getArgReference_bat(stk, pci, 3);
if (*sid && (s = BATdescriptor(*sid)) == NULL)
@@ -344,12 +347,15 @@ CMDbatBINARY2(MalStkPtr stk, InstrPtr pc
assert(BAThdense(b2));
}
if (b2) {
- bn = (*batfunc)(b, b2, s, (*typefunc)(b->T->type,
b2->T->type),
- abort_on_error);
+ if (tp3 == TYPE_any)
+ tp3 = (*typefunc)(b->ttype, b2->ttype);
+ bn = (*batfunc)(b, b2, s, tp3, abort_on_error);
BBPunfix(b2->batCacheid);
} else {
+ if (tp3 == TYPE_any)
+ tp3 = (*typefunc)(b->T->type, tp2);
bn = (*batfunc1)(b, &stk->stk[getArg(pci, 2)], s,
-
(*typefunc)(b->T->type, tp2), abort_on_error);
+ tp3, abort_on_error);
}
} else {
assert(tp1 != TYPE_bat && !isaBatType(tp1));
@@ -362,8 +368,9 @@ CMDbatBINARY2(MalStkPtr stk, InstrPtr pc
throw(MAL, malfunc, RUNTIME_OBJECT_MISSING);
}
assert(BAThdense(b));
- bn = (*batfunc2)(&stk->stk[getArg(pci, 1)], b, s,
- (*typefunc)(tp1, b->T->type),
abort_on_error);
+ if (tp3 == TYPE_any)
+ tp3 = (*typefunc)(tp1, b->T->type);
+ bn = (*batfunc2)(&stk->stk[getArg(pci, 1)], b, s, tp3,
abort_on_error);
}
BBPunfix(b->batCacheid);
if (bn == NULL) {
@@ -572,9 +579,8 @@ str
CMDbatADD(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
{
(void) cntxt;
- (void) mb;
- return CMDbatBINARY2(stk, pci, BATcalcadd, BATcalcaddcst, BATcalccstadd,
+ return CMDbatBINARY2(mb, stk, pci, BATcalcadd, BATcalcaddcst,
BATcalccstadd,
calctype, 0,
"batcalc.add_noerror");
}
@@ -584,9 +590,8 @@ str
CMDbatADDsignal(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
{
(void) cntxt;
- (void) mb;
- return CMDbatBINARY2(stk, pci, BATcalcadd, BATcalcaddcst, BATcalccstadd,
+ return CMDbatBINARY2(mb, stk, pci, BATcalcadd, BATcalcaddcst,
BATcalccstadd,
calctype, 1, "batcalc.+");
}
@@ -596,9 +601,8 @@ str
CMDbatADDenlarge(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
{
(void) cntxt;
- (void) mb;
- return CMDbatBINARY2(stk, pci, BATcalcadd, BATcalcaddcst, BATcalccstadd,
+ return CMDbatBINARY2(mb, stk, pci, BATcalcadd, BATcalcaddcst,
BATcalccstadd,
calctypeenlarge, 1,
"batcalc.add_enlarge");
}
@@ -608,9 +612,8 @@ str
CMDbatSUB(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
{
(void) cntxt;
- (void) mb;
- return CMDbatBINARY2(stk, pci, BATcalcsub, BATcalcsubcst, BATcalccstsub,
+ return CMDbatBINARY2(mb, stk, pci, BATcalcsub, BATcalcsubcst,
BATcalccstsub,
calctype, 0,
"batcalc.sub_noerror");
}
@@ -620,9 +623,8 @@ str
CMDbatSUBsignal(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
{
(void) cntxt;
- (void) mb;
- return CMDbatBINARY2(stk, pci, BATcalcsub, BATcalcsubcst, BATcalccstsub,
+ return CMDbatBINARY2(mb, stk, pci, BATcalcsub, BATcalcsubcst,
BATcalccstsub,
calctype, 1, "batcalc.-");
}
@@ -632,9 +634,8 @@ str
CMDbatSUBenlarge(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
{
(void) cntxt;
- (void) mb;
- return CMDbatBINARY2(stk, pci, BATcalcsub, BATcalcsubcst, BATcalccstsub,
+ return CMDbatBINARY2(mb, stk, pci, BATcalcsub, BATcalcsubcst,
BATcalccstsub,
calctypeenlarge, 1,
"batcalc.sub_enlarge");
}
@@ -644,9 +645,8 @@ str
CMDbatMUL(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
{
(void) cntxt;
- (void) mb;
- return CMDbatBINARY2(stk, pci, BATcalcmul, BATcalcmulcst, BATcalccstmul,
+ return CMDbatBINARY2(mb, stk, pci, BATcalcmul, BATcalcmulcst,
BATcalccstmul,
calctype, 0,
"batcalc.mul_noerror");
}
@@ -656,9 +656,8 @@ str
CMDbatMULsignal(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
{
(void) cntxt;
- (void) mb;
- return CMDbatBINARY2(stk, pci, BATcalcmul, BATcalcmulcst, BATcalccstmul,
+ return CMDbatBINARY2(mb, stk, pci, BATcalcmul, BATcalcmulcst,
BATcalccstmul,
calctype, 1, "batcalc.*");
}
@@ -668,9 +667,8 @@ str
CMDbatMULenlarge(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
{
(void) cntxt;
- (void) mb;
- return CMDbatBINARY2(stk, pci, BATcalcmul, BATcalcmulcst, BATcalccstmul,
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list