Changeset: 1707e3f19790 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1707e3f19790
Modified Files:
clients/Tests/exports.stable.out
monetdb5/mal/mal_listing.c
monetdb5/mal/mal_profiler.c
monetdb5/modules/kernel/algebra.c
monetdb5/modules/kernel/algebra.h
monetdb5/modules/kernel/algebra.mal
monetdb5/optimizer/Tests/CMexample.stable.out
monetdb5/optimizer/Tests/inlineCst.stable.out
monetdb5/optimizer/Tests/inlineIfthen.stable.out
monetdb5/optimizer/opt_coercion.c
monetdb5/tests/BugTracker/Tests/algebra_project.Bug-3045.mal
monetdb5/tests/BugTracker/Tests/algebra_project.Bug-3045.stable.out
Branch: default
Log Message:
Merge with default
diffs (283 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
@@ -757,8 +757,6 @@ str ALGmaxany(ptr result, const bat *bid
str ALGminany(ptr result, const bat *bid);
str ALGouterjoin(bat *result, const bat *lid, const bat *rid);
str ALGouterjoinestimate(bat *result, const bat *lid, const bat *rid, const
lng *estimate);
-str ALGprojectNIL(bat *ret, const bat *bid);
-str ALGprojecthead(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
str ALGprojecttail(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
str ALGrangejoin(bat *result, const bat *lid, const bat *rlid, const bat
*rhid, const bit *li, const bit *hi);
str ALGrangejoin2(bat *l, bat *r, const bat *lid, const bat *rlid, const bat
*rhid, const bit *li, const bit *hi);
diff --git a/monetdb5/mal/mal_listing.c b/monetdb5/mal/mal_listing.c
--- a/monetdb5/mal/mal_listing.c
+++ b/monetdb5/mal/mal_listing.c
@@ -119,7 +119,7 @@ renderTerm(MalBlkPtr mb, MalStkPtr stk,
}
// show the properties when required
- if (flg & LIST_MAL_PROPS){
+ if ( (flg & LIST_MAL_PROPS) && (idx < p->retc || getInstrPtr(mb,0) ==
p)) {
pstring = varGetPropStr(mb,varid);
if( pstring)
snprintf(buf+len,maxlen-len,"%s",pstring);
diff --git a/monetdb5/mal/mal_profiler.c b/monetdb5/mal/mal_profiler.c
--- a/monetdb5/mal/mal_profiler.c
+++ b/monetdb5/mal/mal_profiler.c
@@ -231,7 +231,7 @@ offlineProfilerEvent(MalBlkPtr mb, MalSt
// TODO Obfusate instructions unless administrator calls for it.
/* generate actual call statement */
- stmt = instruction2str(mb, stk, pci, LIST_MAL_CALL);
+ stmt = instruction2str(mb, stk, pci, LIST_MAL_ALL);
c = stmt;
while (c && *c && isspace((int)*c))
@@ -702,7 +702,7 @@ cachedProfilerEvent(MalBlkPtr mb, MalStk
snprintf(ctm + 19, 6, ".%03d", (int)(clock.tv_usec / 1000));
/* generate actual call statement */
- stmt = instruction2str(mb, stk, pci, LIST_MAL_CALL);
+ stmt = instruction2str(mb, stk, pci, LIST_MAL_ALL);
c = stmt;
while (c && *c && (isspace((int)*c) || *c == '!'))
diff --git a/monetdb5/modules/kernel/algebra.c
b/monetdb5/modules/kernel/algebra.c
--- a/monetdb5/modules/kernel/algebra.c
+++ b/monetdb5/modules/kernel/algebra.c
@@ -1792,55 +1792,6 @@ ALGfind(oid *ret, const bat *bid, ptr va
return msg;
}
-str
-ALGprojectNIL(bat *ret, const bat *bid)
-{
- BAT *b, *bn;
-
- if ((b = BATdescriptor(*bid)) == NULL) {
- throw(MAL, "algebra.project", RUNTIME_OBJECT_MISSING);
- }
-
- bn = BATconst(b, TYPE_void, (ptr) &oid_nil, TRANSIENT);
- if (bn) {
- *ret = bn->batCacheid;
- BBPkeepref(bn->batCacheid);
- BBPunfix(b->batCacheid);
- return MAL_SUCCEED;
- }
- BBPunfix(b->batCacheid);
- throw(MAL, "algebra.project", MAL_MALLOC_FAIL);
-}
-
-/*
- * The constant versions are typed by the parser
- */
-str
-ALGprojecthead(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
-{
- bat *ret = getArgReference_bat(stk, pci, 0);
- const ValRecord *v = &stk->stk[getArg(pci, 1)];
- bat bid = * getArgReference_bat(stk, pci, 2);
- BAT *b, *bn;
-
- (void) cntxt;
- (void) mb;
- if ((b = BATdescriptor(bid)) == NULL)
- throw(MAL, "algebra.project", RUNTIME_OBJECT_MISSING);
- b = BATmirror(b);
- bn = BATconst(b, v->vtype, VALptr(v), TRANSIENT);
- if (bn == NULL) {
- *ret = bat_nil;
- throw(MAL, "algebra.project", MAL_MALLOC_FAIL);
- }
- bn = BATmirror(bn);
- if (!(bn->batDirty&2))
- BATsetaccess(bn, BAT_READ);
- *ret= bn->batCacheid;
- BBPkeepref(bn->batCacheid);
- BBPunfix(b->batCacheid);
- return MAL_SUCCEED;
-}
str
ALGprojecttail(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
@@ -1852,6 +1803,8 @@ ALGprojecttail(Client cntxt, MalBlkPtr m
(void) cntxt;
(void) mb;
+ if( isaBatType(getArgType(mb,pci,2)) )
+ throw(MAL,"algebra.project","Scalar value expected");
if ((b = BATdescriptor(bid)) == NULL)
throw(MAL, "algebra.project", RUNTIME_OBJECT_MISSING);
bn = BATconst(b, v->vtype, VALptr(v), TRANSIENT);
diff --git a/monetdb5/modules/kernel/algebra.h
b/monetdb5/modules/kernel/algebra.h
--- a/monetdb5/modules/kernel/algebra.h
+++ b/monetdb5/modules/kernel/algebra.h
@@ -115,11 +115,7 @@ algebra_export str ALGsubslice_wrd(bat *
algebra_export str ALGfetchoid(ptr ret, const bat *bid, const oid *pos);
algebra_export str ALGexist(bit *ret, const bat *bid, const void *val);
algebra_export str ALGfind(oid *ret, const bat *bid, ptr val);
-algebra_export str ALGprojectNIL(bat *ret, const bat *bid);
algebra_export str ALGselectNotNil(bat *result, const bat *bid);
-
-algebra_export str ALGprojecthead(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
InstrPtr pci);
algebra_export str ALGprojecttail(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
InstrPtr pci);
-
algebra_export str ALGreuse(bat *ret, const bat *bid);
#endif
diff --git a/monetdb5/modules/kernel/algebra.mal
b/monetdb5/modules/kernel/algebra.mal
--- a/monetdb5/modules/kernel/algebra.mal
+++ b/monetdb5/modules/kernel/algebra.mal
@@ -297,16 +297,9 @@ address ALGsubrangejoin
comment "Range join: values in l and r1/r2 match if r1 <[=] l <[=] r2";
# @+ Projection operations
-command project(b:bat[:any_1,:any_2]) :bat[:any_1,:void]
-address ALGprojectNIL
-comment "Extract the head of a BAT.";
-
-pattern project(v:any_3,b:bat[:any_2,:any_1]) :bat[:any_3,:any_1]
-address ALGprojecthead
-comment "Fill the head with a constant, e.g. [0~b]";
-pattern project(b:bat[:any_2,:any_1],v:any_3) :bat[:any_2,:any_3]
+pattern project(b:bat[:oid,:any_1],v:any_3) :bat[:oid,:any_3]
address ALGprojecttail
-comment "Fill the tail with a constant, e.g. [0~b]";
+comment "Fill the tail with a constant";
pattern firstn(b:bat[:oid,:any], n:wrd, asc:bit, distinct:bit) :bat[:oid,:oid]
address ALGfirstn
diff --git a/monetdb5/optimizer/Tests/CMexample.stable.out
b/monetdb5/optimizer/Tests/CMexample.stable.out
--- a/monetdb5/optimizer/Tests/CMexample.stable.out
+++ b/monetdb5/optimizer/Tests/CMexample.stable.out
@@ -36,8 +36,8 @@ function user.q():void;
r:bat[:oid,:int]{rows=100} := bat.new(:oid,:int); # CMDBATnew
s:bat[:oid,:int]{rows=1000} := bat.new(:oid,:int); # CMDBATnew
x:bat[:oid,:oid]{rows=300} := bat.new(:oid,:oid); # CMDBATnew
- rs:bat[:oid,:oid]{rows=151} :=
algebra.subselect(s:bat[:oid,:int]{rows=1000},x:bat[:oid,:oid]{rows=300},1:int,1:int,true:bit,true:bit,false:bit);
# ALGsubselect2
- j:bat[:oid,:int]{rows=100} :=
algebra.leftfetchjoin(rs:bat[:oid,:oid]{rows=151},r:bat[:oid,:int]{rows=100});
# ALGleftfetchjoin
+ rs:bat[:oid,:oid]{rows=151} :=
algebra.subselect(s:bat[:oid,:int],x:bat[:oid,:oid],1:int,1:int,true:bit,true:bit,false:bit);
# ALGsubselect2
+ j:bat[:oid,:int]{rows=100} :=
algebra.leftfetchjoin(rs:bat[:oid,:oid],r:bat[:oid,:int]); # ALGleftfetchjoin
end user.q; #
# 08:55:26 >
diff --git a/monetdb5/optimizer/Tests/inlineCst.stable.out
b/monetdb5/optimizer/Tests/inlineCst.stable.out
--- a/monetdb5/optimizer/Tests/inlineCst.stable.out
+++ b/monetdb5/optimizer/Tests/inlineCst.stable.out
@@ -41,7 +41,7 @@ function user.qry():void;
bat.append(b:bat[:oid,:int],20:int); # BKCappend_val_wrap
X_16:int := 213:int; #
r:bat[:oid,:int]{inline} := algebra.project(b:bat[:oid,:int],X_16:int);
# ALGprojecttail
- io.print(r:bat[:oid,:int]{inline}); # IOprint_val
+ io.print(r:bat[:oid,:int]); # IOprint_val
end user.qry; #
# 20:07:33 >
diff --git a/monetdb5/optimizer/Tests/inlineIfthen.stable.out
b/monetdb5/optimizer/Tests/inlineIfthen.stable.out
--- a/monetdb5/optimizer/Tests/inlineIfthen.stable.out
+++ b/monetdb5/optimizer/Tests/inlineIfthen.stable.out
@@ -35,7 +35,7 @@ function user.qry():void;
bat.append(b:bat[:oid,:int],10:int); # BKCappend_val_wrap
bat.append(b:bat[:oid,:int],20:int); # BKCappend_val_wrap
r:bat[:oid,:int]{inline} :=
mal.multiplex("user":str,"foo":str,b:bat[:oid,:int]); # MANIFOLDremapMultiplex
- io.print(r:bat[:oid,:int]{inline}); # IOprint_val
+ io.print(r:bat[:oid,:int]); # IOprint_val
end user.qry; #
# 11:53:01 >
diff --git a/monetdb5/optimizer/opt_coercion.c
b/monetdb5/optimizer/opt_coercion.c
--- a/monetdb5/optimizer/opt_coercion.c
+++ b/monetdb5/optimizer/opt_coercion.c
@@ -70,18 +70,18 @@ coercionOptimizerCalcStep(Client cntxt,
if ( a == r && coerce[varid].src && coerce[varid].fromtype < r )
{
#ifdef _DEBUG_COERCION_
- mnstr_printf(cntxt->fdout,"#remove upcast on first argument
%d\n", getArg(p,1));
+ mnstr_printf(cntxt->fdout,"#remove upcast on first argument
%d\n", varid);
printInstruction(cntxt->fdout, mb, 0, p, LIST_MAL_ALL);
#endif
getArg(p,1) = coerce[varid].src;
if ( chkInstruction(NULL, cntxt->nspace, mb, p) || p->typechk
== TYPE_UNKNOWN)
- getArg(p,1)= varid;
+ getArg(p,1) = varid;
}
varid = getArg(p,2);
if ( b == r && coerce[varid].src && coerce[varid].fromtype < r )
{
#ifdef _DEBUG_COERCION_
- mnstr_printf(cntxt->fdout,"#remove upcast on second argument
%d\n", getArg(p,2));
+ mnstr_printf(cntxt->fdout,"#remove upcast on second argument
%d\n", varid);
printInstruction(cntxt->fdout, mb, 0, p, LIST_MAL_ALL);
#endif
getArg(p,2) = coerce[varid].src;
@@ -110,7 +110,7 @@ coercionOptimizerAggrStep(Client cntxt,
r = getColumnType(getVarType(mb, getArg(p,0)));
k = getArg(p,1);
if( r == TYPE_dbl && coerce[k].src ){
- getArg(p,1) = coerce[getArg(p,1)].src;
+ getArg(p,1) = coerce[k].src;
if ( chkInstruction(NULL, cntxt->nspace, mb, p) || p->typechk
== TYPE_UNKNOWN)
getArg(p,1)= k;
}
diff --git a/monetdb5/tests/BugTracker/Tests/algebra_project.Bug-3045.mal
b/monetdb5/tests/BugTracker/Tests/algebra_project.Bug-3045.mal
--- a/monetdb5/tests/BugTracker/Tests/algebra_project.Bug-3045.mal
+++ b/monetdb5/tests/BugTracker/Tests/algebra_project.Bug-3045.mal
@@ -5,8 +5,5 @@ b := bat.append(b, 100:bte);
b := bat.append(b, 105:bte);
b := bat.append(b, 115:bte);
io.print(b);
-c := algebra.project(0@0,b);
-io.print(c);
-d := bat.reverse(b);
-e := algebra.project(d,0@0);
+e := algebra.project(b,0@0);
io.print(e);
diff --git
a/monetdb5/tests/BugTracker/Tests/algebra_project.Bug-3045.stable.out
b/monetdb5/tests/BugTracker/Tests/algebra_project.Bug-3045.stable.out
--- a/monetdb5/tests/BugTracker/Tests/algebra_project.Bug-3045.stable.out
+++ b/monetdb5/tests/BugTracker/Tests/algebra_project.Bug-3045.stable.out
@@ -24,10 +24,7 @@ function user.main():void;
b := bat.append(b,105:bte);
b := bat.append(b,115:bte);
io.print(b);
- c := algebra.project(0@0,b);
- io.print(c);
- d := bat.reverse(b);
- e := algebra.project(d,0@0);
+ e := algebra.project(b,0@0);
io.print(e);
end user.main;
#--------------------------#
@@ -39,24 +36,15 @@ end user.main;
[ 2@0, 100 ]
[ 3@0, 105 ]
[ 4@0, 115 ]
-#-----------------#
-# t h # name
-# oid bte # type
-#-----------------#
-[ 0@0, 100 ]
-[ 0@0, 105 ]
-[ 0@0, 100 ]
-[ 0@0, 105 ]
-[ 0@0, 115 ]
-#-----------------#
+#--------------------------#
# h t # name
-# bte oid # type
-#-----------------#
-[ 100, 0@0 ]
-[ 105, 0@0 ]
-[ 100, 0@0 ]
-[ 105, 0@0 ]
-[ 115, 0@0 ]
+# void oid # type
+#--------------------------#
+[ 0@0, 0@0 ]
+[ 1@0, 0@0 ]
+[ 2@0, 0@0 ]
+[ 3@0, 0@0 ]
+[ 4@0, 0@0 ]
# 13:21:49 >
# 13:21:49 > "Done."
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list