Changeset: a95e6261ca78 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a95e6261ca78
Modified Files:
monetdb5/modules/kernel/Makefile.ag
monetdb5/modules/kernel/colcalc.mx
monetdb5/modules/kernel/colcast.mx
monetdb5/modules/kernel/colcolore.mx
monetdb5/modules/kernel/colifthen.mx
monetdb5/modules/kernel/colmmath.mx
monetdb5/modules/kernel/colmtime.mx
monetdb5/modules/kernel/colstr.mx
monetdb5/modules/kernel/column.mx
Branch: headless
Log Message:
Renaming of the files only
diffs (truncated from 8823 to 300 lines):
diff --git a/monetdb5/modules/kernel/Makefile.ag
b/monetdb5/modules/kernel/Makefile.ag
--- a/monetdb5/modules/kernel/Makefile.ag
+++ b/monetdb5/modules/kernel/Makefile.ag
@@ -41,14 +41,14 @@
alarm.mx \
algebra.mx \
array.mx \
- bat5.mx \
- batcalc.mx \
- batcast.mx \
- batcolor.mx \
- batifthen.mx \
- batmmath.mx \
- batmtime.mx \
- batstr.mx \
+ column.mx \
+ colcalc.mx \
+ colcast.mx \
+ colcolor.mx \
+ colifthen.mx \
+ colmmath.mx \
+ colmtime.mx \
+ colstr.mx \
calc.mx \
counters.mx \
group.mx \
@@ -64,9 +64,9 @@
headers_mal = {
HEADERS = mal
DIR = libdir/monetdb5
- SOURCES = calc.mx bat5.mx algebra.mx status.mx unix.mx \
- mmath.mx lock.mx sema.mx alarm.mx batstr.mx batmtime.mx \
- batcolor.mx batifthen.mx batcast.mx batcalc.mx batmmath.mx \
+ SOURCES = calc.mx column.mx algebra.mx status.mx unix.mx \
+ mmath.mx lock.mx sema.mx alarm.mx colstr.mx colmtime.mx \
+ colcolor.mx colifthen.mx colcast.mx colcalc.mx colmmath.mx \
group.mx aggr.mx array.mx \
counters.mx logger.mx microbenchmark.mx
}
diff --git a/monetdb5/modules/kernel/colcalc.mx
b/monetdb5/modules/kernel/colcalc.mx
new file mode 100644
--- /dev/null
+++ b/monetdb5/modules/kernel/colcalc.mx
@@ -0,0 +1,1835 @@
+@/
+The contents of this file are subject to the MonetDB Public License
+Version 1.1 (the "License"); you may not use this file except in
+compliance with the License. You may obtain a copy of the License at
+http://monetdb.cwi.nl/Legal/MonetDBLicense-1.1.html
+
+Software distributed under the License is distributed on an "AS IS"
+basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+License for the specific language governing rights and limitations
+under the License.
+
+The Original Code is the MonetDB Database System.
+
+The Initial Developer of the Original Code is CWI.
+Portions created by CWI are Copyright (C) 1997-July 2008 CWI.
+Copyright August 2008-2011 MonetDB B.V.
+All Rights Reserved.
+@
+
+@f batcalc
+@a M.L. Kersten
+@+ BAT calculator
+Many applications require extension of the basic calculator and
+mathematic functions to work on BAT arguments. Although the
+MAL multiplex optimizer contains a command ('optimizer.multiplex')
+to generate the necessary code, it is often much more efficient to
+use one of the dedidacted batcalc functions introduced below.
+
+The operators supported are limited to the built-in fixed length
+atoms, because they permit ease of storage of the operation result.
+Variable sized atoms, especially user defined, may require more
+administrative activities.
+Furthermore, the operands involved are assumed to be aligned
+to assure the fastest possible join evaluation.
+
+Optimal processing performance is further obtained when the operators
+can work as 'accumulators', for then we do not pay the price
+of space allocation for a new intermediate. It may imply a BATcopy
+before the accummulator function is being called.
+A new BAT is of course created when the result of a function does not fit
+the accumulator.
+
+The implementation does not take into account possible overflows
+caused by the operators. However, the operators respect the NIL
+semantics and division by zero produces a NIL.
+
+In addition to arithmetic and comparison operators, casting and
+mathematical functions are directly supported.
+
+@+ NULL semantics
+The batcalc arithmetic is already constraint to BATs of equal size.
+Another improvement is obtained when we do not have to check
+for NULLs in each and every basic operation +,-,/,* and comparisons.
+A problem is to propagate the general 'nonil' property, because
+this depends on the semantics of the operator. Checking the result
+for a nil value depleats most of the expected gain.
+
+Currently only set for the NOT operation and comparisons operators when
+neither argument has nils.
+@{
+@mal
+module batcalc;
+
+@+ Basic arithmetic
+The first group of functions provide abstractions over the
+binary operators +,/,-,*, and %. Both on (BAT,BAT) and (BAT,CST)
+operands. We also support the type enlargement and auto coercions,
+because they avoid expensive BAT copying.
+
+The accumulator versions modifies the first argument,
+provided it is a temporary BAT and not a view.
+@= calcGrp1
+ command @1(b:bat[:oid,:@3], cst:@4) :bat[:oid,:@5]
+ address CMDbat@2cst_@3_@4_@5;
+
+ command @1(cst:@3, b:bat[:oid,:@4]) :bat[:oid,:@5]
+ address CMDcst@2bat_@3_@4_@5;
+
+ command @1(b:bat[:oid,:@3], c:bat[:oid,:@4]) :bat[:oid,:@5]
+ address CMDbat@2_@3_@4_@5
+ comment "Binary BAT calculator function with new BAT result";
+@-
+@= calcGrp2
+
+ command @1(b:bat[:oid,:@3], c:bat[:oid,:@4], aflag:bit,
bflag:bit):bat[:oid,:@5]
+ address CMDbataccum@2_@3_@4_@5
+ comment "Binary BAT calculator function which may re-use store of
arguments ";
+
+ command @1(cst:@3, b:bat[:oid,:@4], cflag:bit, bflag:bit):bat[:oid,:@5]
+ address CMDbataccum@2cst2_@3_@4_@5
+ comment "(BAT,Constant) calculator function which may re-use store of
BAT argument";
+
+ command @1(b:bat[:oid,:@3], cst:@4, bflag:bit, cflag:bit) :bat[:oid,:@5]
+ address CMDbataccum@2cst_@3_@4_@5
+ comment "(BAT,Constant) calculator function which may re-use store of
BAT argument";
+@-
+@= calcGrp3
+ @:calcGrp1(@1,@2,@3,@4,@5)@
+ @:calcGrp2(@1,@2,@3,@4,@5)@
+
+@-
+We need instantiations for the accumulator code,
+but should limit modulo functions to integer-based types.
+The calc group contains the operator, the desired result typ, its
+C qualifier and the operands
+@mal
+ @:calcGrp3(%,MOD,bte,bte,bte)@
+ @:calcGrp3(%,MOD,sht,sht,sht)@
+ @:calcGrp3(%,MOD,int,int,int)@
+ @:calcGrp3(%,MOD,wrd,wrd,wrd)@
+ @:calcGrp3(%,MOD,lng,lng,lng)@
+
+ @:calcGrp3(xor,XOR,oid,oid,oid)@
+ @:calcGrp3(xor,XOR,bte,bte,bte)@
+ @:calcGrp3(xor,XOR,sht,sht,sht)@
+ @:calcGrp3(xor,XOR,int,int,int)@
+ @:calcGrp3(xor,XOR,wrd,wrd,wrd)@
+ @:calcGrp3(xor,XOR,lng,lng,lng)@
+
+ @:calcGrp3(and,AND,oid,oid,oid)@
+ @:calcGrp3(and,AND,bte,bte,bte)@
+ @:calcGrp3(and,AND,sht,sht,sht)@
+ @:calcGrp3(and,AND,int,int,int)@
+ @:calcGrp3(and,AND,wrd,wrd,wrd)@
+ @:calcGrp3(and,AND,lng,lng,lng)@
+
+ @:calcGrp3(or,OR,oid,oid,oid)@
+ @:calcGrp3(or,OR,bte,bte,bte)@
+ @:calcGrp3(or,OR,sht,sht,sht)@
+ @:calcGrp3(or,OR,int,int,int)@
+ @:calcGrp3(or,OR,wrd,wrd,wrd)@
+ @:calcGrp3(or,OR,lng,lng,lng)@
+
+ @:calcGrp3(<<,LSH,oid,int,oid)@
+ @:calcGrp3(<<,LSH,bte,int,bte)@
+ @:calcGrp3(<<,LSH,sht,int,sht)@
+ @:calcGrp3(<<,LSH,int,int,int)@
+ @:calcGrp3(<<,LSH,wrd,int,wrd)@
+ @:calcGrp3(<<,LSH,lng,int,lng)@
+
+ @:calcGrp3(>>,RSH,oid,int,oid)@
+ @:calcGrp3(>>,RSH,bte,int,bte)@
+ @:calcGrp3(>>,RSH,sht,int,sht)@
+ @:calcGrp3(>>,RSH,int,int,int)@
+ @:calcGrp3(>>,RSH,wrd,int,wrd)@
+ @:calcGrp3(>>,RSH,lng,int,lng)@
+
+@= coerceGrp
+ @:calcGrp1(@1,@2,bte,bte,lng)@
+ @:calcGrp1(@1,@2,bte,sht,lng)@
+ @:calcGrp1(@1,@2,bte,int,lng)@
+ @:calcGrp1(@1,@2,bte,wrd,lng)@
+ @:calcGrp3(@1,@2,bte,lng,lng)@
+ @:calcGrp1(@1,@2,sht,bte,lng)@
+ @:calcGrp1(@1,@2,sht,sht,lng)@
+ @:calcGrp1(@1,@2,sht,int,lng)@
+ @:calcGrp1(@1,@2,sht,wrd,lng)@
+ @:calcGrp3(@1,@2,sht,lng,lng)@
+ @:calcGrp1(@1,@2,int,bte,lng)@
+ @:calcGrp1(@1,@2,int,sht,lng)@
+ @:calcGrp1(@1,@2,int,int,lng)@
+ @:calcGrp1(@1,@2,int,wrd,lng)@
+ @:calcGrp3(@1,@2,int,lng,lng)@
+ @:calcGrp1(@1,@2,wrd,bte,lng)@
+ @:calcGrp1(@1,@2,wrd,sht,lng)@
+ @:calcGrp1(@1,@2,wrd,int,lng)@
+ @:calcGrp1(@1,@2,wrd,wrd,lng)@
+ @:calcGrp3(@1,@2,wrd,lng,lng)@
+ @:calcGrp3(@1,@2,lng,bte,lng)@
+ @:calcGrp3(@1,@2,lng,sht,lng)@
+ @:calcGrp3(@1,@2,lng,int,lng)@
+ @:calcGrp3(@1,@2,lng,wrd,lng)@
+ @:calcGrp3(@1,@2,lng,lng,lng)@
+
+ @:calcGrp1(@1,@2,bte,bte,wrd)@
+ @:calcGrp1(@1,@2,bte,sht,wrd)@
+ @:calcGrp1(@1,@2,bte,int,wrd)@
+ @:calcGrp3(@1,@2,bte,wrd,wrd)@
+ @:calcGrp1(@1,@2,sht,bte,wrd)@
+ @:calcGrp1(@1,@2,sht,sht,wrd)@
+ @:calcGrp1(@1,@2,sht,int,wrd)@
+ @:calcGrp3(@1,@2,sht,wrd,wrd)@
+ @:calcGrp1(@1,@2,int,bte,wrd)@
+ @:calcGrp1(@1,@2,int,sht,wrd)@
+ @:calcGrp1(@1,@2,int,int,wrd)@
+ @:calcGrp3(@1,@2,int,wrd,wrd)@
+ @:calcGrp3(@1,@2,wrd,bte,wrd)@
+ @:calcGrp3(@1,@2,wrd,sht,wrd)@
+ @:calcGrp3(@1,@2,wrd,int,wrd)@
+ @:calcGrp3(@1,@2,wrd,wrd,wrd)@
+
+ @:calcGrp1(@1,@2,bte,bte,int)@
+ @:calcGrp1(@1,@2,bte,sht,int)@
+ @:calcGrp3(@1,@2,bte,int,int)@
+ @:calcGrp1(@1,@2,sht,bte,int)@
+ @:calcGrp1(@1,@2,sht,sht,int)@
+ @:calcGrp3(@1,@2,sht,int,int)@
+ @:calcGrp3(@1,@2,int,bte,int)@
+ @:calcGrp3(@1,@2,int,sht,int)@
+ @:calcGrp3(@1,@2,int,int,int)@
+
+ @:calcGrp1(@1,@2,bte,bte,sht)@
+ @:calcGrp3(@1,@2,bte,sht,sht)@
+ @:calcGrp3(@1,@2,sht,bte,sht)@
+ @:calcGrp3(@1,@2,sht,sht,sht)@
+
+ @:calcGrp3(@1,@2,bte,bte,bte)@
+
+ @:calcGrp1(@1,@2,flt,flt,dbl)@
+ @:calcGrp3(@1,@2,flt,dbl,dbl)@
+ @:calcGrp3(@1,@2,dbl,flt,dbl)@
+ @:calcGrp3(@1,@2,dbl,dbl,dbl)@
+
+ @:calcGrp3(@1,@2,flt,flt,flt)@
+
+@-
+@mal
+ @:coerceGrp(/,DIV)@
+ @:coerceGrp(*,MUL)@
+ @:coerceGrp(-,SUB)@
+ @:coerceGrp(+,ADD)@
+@-
+@= unary
+ command -(b:bat[:any_1,:@1]):bat[:any_1,:@1]
+ address CMDunaryMIN
+ comment "Unary minus over the tail of the bat";
+
+ command --(b:bat[:any_1,:@1]):bat[:any_1,:@1]
+ address CMDunaryMINMIN
+ comment "Unary minus over the tail of the bat";
+
+ command ++(b:bat[:any_1,:@1]):bat[:any_1,:@1]
+ address CMDunaryPLUSPLUS
+ comment "Unary minus over the tail of the bat";
+
+ command abs(b:bat[:any_1,:@1]):bat[:any_1,:@1]
+ address CMDunaryABS
+ comment "Unary abs over the tail of the bat";
+@-
+@mal
+@:unary(bte)@
+@:unary(sht)@
+@:unary(int)@
+@:unary(wrd)@
+@:unary(lng)@
+@:unary(flt)@
+@:unary(dbl)@
+@-
+@= unaryISNIL
+ command isnil(b:bat[:any_1,:@1]):bat[:any_1,:bit]
+ address CMDunaryISNIL
+ comment "Unary check for nil over the tail of the bat";
+@-
+@mal
+@:unaryISNIL(bit)@
+@:unaryISNIL(chr)@
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list