Changeset: 2d00bda483f5 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2d00bda483f5 Modified Files: sql/backends/monet5/BDCC/bdcc.mal Branch: BDCC Log Message:
Added following functions to bdcc.mal: split(s:str, by:str):bat[:oid,:str]; ints(b:bat[:oid, :str]):bat[:oid, :int]; Not sure if they already exist elsewhere. Changed remapjoin to have its masks given as comma-separated strings intead of BATs of strings. This was done to accommodate the current filter function syntax. diffs (67 lines): diff --git a/sql/backends/monet5/BDCC/bdcc.mal b/sql/backends/monet5/BDCC/bdcc.mal --- a/sql/backends/monet5/BDCC/bdcc.mal +++ b/sql/backends/monet5/BDCC/bdcc.mal @@ -3,10 +3,61 @@ module bdcc; command remap(b:bat[:oid,:int], oldMasks:bat[:oid,:int], newMasks:bat[:oid,:int]):bat[:oid,:int] address BDCCremap; -function remapjoin(x:bat[:oid,:int], xOldMasks:bat[:oid,:int], xNewMasks:bat[:oid,:int], - y:bat[:oid,:int], yOldMasks:bat[:oid,:int], yNewMasks:bat[:oid,:int]) (l:bat[:oid,:oid],r:bat[:oid,:oid]); +function split(s:str, by:str):bat[:oid,:str]; + res := bat.new(:oid,:str); + sLen := str.length(s); + + s := str.trim(s, by); + + barrier nEmpty := sLen > 0; + pos := str.search(s, by); + + barrier if := pos == -1; + bat.append(res, s); + leave nEmpty; + exit if; + + part := str.string(s, 0, pos); + bat.append(res, part); + + after := pos + 1; + s := str.string(s, after); + + redo nEmpty; + exit nEmpty; + + return res; +end split; + +function ints(b:bat[:oid, :str]):bat[:oid, :int]; + res := bat.new(:oid,:int); + + barrier (h, t) := iterator.new(b); + r := calc.int(t); + bat.append(res, r); + redo (h, t) := iterator.next(b); + exit (h, t); + + return res; +end ints; + +function remapjoin(x:bat[:oid,:int], xOldMasksStr:str, xNewMasksStr:str, + y:bat[:oid,:int], yOldMasksStr:str, yNewMasksStr:str) (l:bat[:oid,:oid],r:bat[:oid,:oid]); + xOldMasksStrs := split(xOldMasksStr, ","); + xNewMasksStrs := split(xNewMasksStr, ","); + + yOldMasksStrs := split(yOldMasksStr, ","); + yNewMasksStrs := split(yNewMasksStr, ","); + + xOldMasks := ints(xOldMasksStrs); + xNewMasks := ints(xNewMasksStrs); + + yOldMasks := ints(yOldMasksStrs); + yNewMasks := ints(yNewMasksStrs); + xRemap := remap(x, xOldMasks, xNewMasks); yRemap := remap(y, yOldMasks, yNewMasks); + (l, r) := algebra.join(xRemap, yRemap); return (l, r); end remapjoin; _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list