Changeset: 2e8e6e47935c for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2e8e6e47935c
Added Files:
        monetdb5/modules/kernel/aggr.mal.sh
Modified Files:
        monetdb5/modules/kernel/aggr.mal
Branch: default
Log Message:

Generate aggr.mal file from shell script.  Some diffs in which functions.
grouped aggr.sum can result in dbl, no aggr.sum of lng into wrd.


diffs (truncated from 398 to 300 lines):

diff --git a/monetdb5/modules/kernel/aggr.mal b/monetdb5/modules/kernel/aggr.mal
--- a/monetdb5/modules/kernel/aggr.mal
+++ b/monetdb5/modules/kernel/aggr.mal
@@ -15,6 +15,8 @@
 # Copyright August 2008-2012 MonetDB B.V.
 # All Rights Reserved.
 
+# This file was generated by using the script aggr.mal.sh.
+
 module aggr;
 
 command sum(b:bat[:oid,:bte], e:bat[:oid,:any_1]) :bat[:oid,:bte]
@@ -187,6 +189,15 @@ command subprod(b:bat[:oid,:bte],g:bat[:
 address AGGRsubprodcand_lng
 comment "Grouped product aggregate with candidates list";
 
+command sum(b:bat[:oid,:bte], e:bat[:oid,:any_1]) :bat[:oid,:dbl]
+address AGGRsum2_dbl
+comment "Sum over grouped tail sum on bte";
+
+command sum(b:bat[:oid,:bte],g:bat[:oid,:oid],e:bat[:oid,:any_1])
+               :bat[:oid,:dbl]
+address AGGRsum3_dbl
+comment "Grouped tail sum on bte";
+
 command sum(b:bat[:oid,:sht], e:bat[:oid,:any_1]) :bat[:oid,:sht]
 address AGGRsum2_sht
 comment "Sum over grouped tail sum on sht";
@@ -323,6 +334,15 @@ command subprod(b:bat[:oid,:sht],g:bat[:
 address AGGRsubprodcand_lng
 comment "Grouped product aggregate with candidates list";
 
+command sum(b:bat[:oid,:sht], e:bat[:oid,:any_1]) :bat[:oid,:dbl]
+address AGGRsum2_dbl
+comment "Sum over grouped tail sum on sht";
+
+command sum(b:bat[:oid,:sht],g:bat[:oid,:oid],e:bat[:oid,:any_1])
+               :bat[:oid,:dbl]
+address AGGRsum3_dbl
+comment "Grouped tail sum on sht";
+
 command sum(b:bat[:oid,:int], e:bat[:oid,:any_1]) :bat[:oid,:int]
 address AGGRsum2_int
 comment "Sum over grouped tail sum on int";
@@ -425,6 +445,15 @@ command subprod(b:bat[:oid,:int],g:bat[:
 address AGGRsubprodcand_lng
 comment "Grouped product aggregate with candidates list";
 
+command sum(b:bat[:oid,:int], e:bat[:oid,:any_1]) :bat[:oid,:dbl]
+address AGGRsum2_dbl
+comment "Sum over grouped tail sum on int";
+
+command sum(b:bat[:oid,:int],g:bat[:oid,:oid],e:bat[:oid,:any_1])
+               :bat[:oid,:dbl]
+address AGGRsum3_dbl
+comment "Grouped tail sum on int";
+
 command sum(b:bat[:oid,:wrd], e:bat[:oid,:any_1]) :bat[:oid,:wrd]
 address AGGRsum2_wrd
 comment "Sum over grouped tail sum on wrd";
@@ -493,39 +522,14 @@ command subprod(b:bat[:oid,:wrd],g:bat[:
 address AGGRsubprodcand_lng
 comment "Grouped product aggregate with candidates list";
 
-command sum(b:bat[:oid,:lng], e:bat[:oid,:any_1]) :bat[:oid,:wrd]
-address AGGRsum2_wrd
-comment "Sum over grouped tail sum on lng";
+command sum(b:bat[:oid,:wrd], e:bat[:oid,:any_1]) :bat[:oid,:dbl]
+address AGGRsum2_dbl
+comment "Sum over grouped tail sum on wrd";
 
-command sum(b:bat[:oid,:lng],g:bat[:oid,:oid],e:bat[:oid,:any_1])
-               :bat[:oid,:wrd]
-address AGGRsum3_wrd
-comment "Grouped tail sum on lng";
-
-command 
subsum(b:bat[:oid,:lng],g:bat[:oid,:oid],e:bat[:oid,:any_1],skip_nils:int,abort_on_error:int)
 :bat[:oid,:wrd]
-address AGGRsubsum_wrd
-comment "Grouped sum aggregate";
-
-command 
subsum(b:bat[:oid,:lng],g:bat[:oid,:oid],e:bat[:oid,:any_1],s:bat[:oid,:oid],skip_nils:int,abort_on_error:int)
 :bat[:oid,:wrd]
-address AGGRsubsumcand_wrd
-comment "Grouped sum aggregate with candidates list";
-
-command product(b:bat[:oid,:lng], e:bat[:oid,:any_1]) :bat[:oid,:wrd]
-address AGGRprod2_wrd
-comment "Product over grouped tail product on lng";
-
-command product(b:bat[:oid,:lng],g:bat[:oid,:oid],e:bat[:oid,:any_1])
-               :bat[:oid,:wrd]
-address AGGRprod3_wrd
-comment "Grouped tail product on lng";
-
-command 
subprod(b:bat[:oid,:lng],g:bat[:oid,:oid],e:bat[:oid,:any_1],skip_nils:int,abort_on_error:int)
 :bat[:oid,:wrd]
-address AGGRsubprod_wrd
-comment "Grouped product aggregate";
-
-command 
subprod(b:bat[:oid,:lng],g:bat[:oid,:oid],e:bat[:oid,:any_1],s:bat[:oid,:oid],skip_nils:int,abort_on_error:int)
 :bat[:oid,:wrd]
-address AGGRsubprodcand_wrd
-comment "Grouped product aggregate with candidates list";
+command sum(b:bat[:oid,:wrd],g:bat[:oid,:oid],e:bat[:oid,:any_1])
+               :bat[:oid,:dbl]
+address AGGRsum3_dbl
+comment "Grouped tail sum on wrd";
 
 command sum(b:bat[:oid,:lng], e:bat[:oid,:any_1]) :bat[:oid,:lng]
 address AGGRsum2_lng
@@ -561,6 +565,15 @@ command subprod(b:bat[:oid,:lng],g:bat[:
 address AGGRsubprodcand_lng
 comment "Grouped product aggregate with candidates list";
 
+command sum(b:bat[:oid,:lng], e:bat[:oid,:any_1]) :bat[:oid,:dbl]
+address AGGRsum2_dbl
+comment "Sum over grouped tail sum on lng";
+
+command sum(b:bat[:oid,:lng],g:bat[:oid,:oid],e:bat[:oid,:any_1])
+               :bat[:oid,:dbl]
+address AGGRsum3_dbl
+comment "Grouped tail sum on lng";
+
 command sum(b:bat[:oid,:flt], e:bat[:oid,:any_1]) :bat[:oid,:flt]
 address AGGRsum2_flt
 comment "Sum over grouped tail sum on flt";
@@ -663,7 +676,6 @@ command subprod(b:bat[:oid,:dbl],g:bat[:
 address AGGRsubprodcand_dbl
 comment "Grouped product aggregate with candidates list";
 
-# We may have to extend the signatures to all possible {void,oid} combos
 command avg(b:bat[:oid,:bte], e:bat[:oid,:any_1]) :bat[:oid,:dbl]
 address AGGRavg2_dbl
 comment "Grouped tail average on bte";
@@ -776,7 +788,6 @@ command subavg(b:bat[:oid,:dbl],g:bat[:o
 address AGGRsubavgcand_dbl
 comment "Grouped avg aggregate with candidates list";
 
-
 command min(b:bat[:oid,:any_1], e:bat[:oid,:any_2]) :bat[:oid,:any_1]
 address AGGRmin2;
 
diff --git a/monetdb5/modules/kernel/aggr.mal.sh 
b/monetdb5/modules/kernel/aggr.mal.sh
new file mode 100644
--- /dev/null
+++ b/monetdb5/modules/kernel/aggr.mal.sh
@@ -0,0 +1,254 @@
+# 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://www.monetdb.org/Legal/MonetDBLicense
+#
+# 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-2012 MonetDB B.V.
+# All Rights Reserved.
+
+cat <<EOF
+# 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://www.monetdb.org/Legal/MonetDBLicense
+#
+# 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-2012 MonetDB B.V.
+# All Rights Reserved.
+
+# This file was generated by using the script ${0##*/}.
+
+module aggr;
+
+EOF
+
+integer="bte sht int wrd lng"  # all integer types
+numeric="$integer flt dbl"     # all numeric types
+fixtypes="bit $numeric oid"
+alltypes="$fixtypes str"
+
+for tp1 in 1:bte 2:sht 4:int 8:wrd 8:lng; do
+    for tp2 in 1:bte 2:sht 4:int 4:wrd 8:lng 8:dbl; do
+       if [ ${tp1%:*} -le ${tp2%:*} -o ${tp1#*:} = ${tp2#*:} ]; then
+           tp1=${tp1#*:}
+           tp2=${tp2#*:}
+           cat <<EOF
+command sum(b:bat[:oid,:${tp1}], e:bat[:oid,:any_1]) :bat[:oid,:${tp2}]
+address AGGRsum2_${tp2}
+comment "Sum over grouped tail sum on ${tp1}";
+
+command sum(b:bat[:oid,:${tp1}],g:bat[:oid,:oid],e:bat[:oid,:any_1])
+               :bat[:oid,:${tp2}]
+address AGGRsum3_${tp2}
+comment "Grouped tail sum on ${tp1}";
+
+EOF
+           if [ $tp2 = dbl ]; then
+               continue
+           fi
+           cat <<EOF
+command 
subsum(b:bat[:oid,:${tp1}],g:bat[:oid,:oid],e:bat[:oid,:any_1],skip_nils:int,abort_on_error:int)
 :bat[:oid,:${tp2}]
+address AGGRsubsum_${tp2}
+comment "Grouped sum aggregate";
+
+command 
subsum(b:bat[:oid,:${tp1}],g:bat[:oid,:oid],e:bat[:oid,:any_1],s:bat[:oid,:oid],skip_nils:int,abort_on_error:int)
 :bat[:oid,:${tp2}]
+address AGGRsubsumcand_${tp2}
+comment "Grouped sum aggregate with candidates list";
+
+command product(b:bat[:oid,:${tp1}], e:bat[:oid,:any_1]) :bat[:oid,:${tp2}]
+address AGGRprod2_${tp2}
+comment "Product over grouped tail product on ${tp1}";
+
+command product(b:bat[:oid,:${tp1}],g:bat[:oid,:oid],e:bat[:oid,:any_1])
+               :bat[:oid,:${tp2}]
+address AGGRprod3_${tp2}
+comment "Grouped tail product on ${tp1}";
+
+command 
subprod(b:bat[:oid,:${tp1}],g:bat[:oid,:oid],e:bat[:oid,:any_1],skip_nils:int,abort_on_error:int)
 :bat[:oid,:${tp2}]
+address AGGRsubprod_${tp2}
+comment "Grouped product aggregate";
+
+command 
subprod(b:bat[:oid,:${tp1}],g:bat[:oid,:oid],e:bat[:oid,:any_1],s:bat[:oid,:oid],skip_nils:int,abort_on_error:int)
 :bat[:oid,:${tp2}]
+address AGGRsubprodcand_${tp2}
+comment "Grouped product aggregate with candidates list";
+
+EOF
+       fi
+    done
+done
+
+for tp1 in 4:flt 8:dbl; do
+    for tp2 in 4:flt 8:dbl; do
+       if [ ${tp1%:*} -le ${tp2%:*} ]; then
+           tp1=${tp1#*:}
+           tp2=${tp2#*:}
+           cat <<EOF
+command sum(b:bat[:oid,:${tp1}], e:bat[:oid,:any_1]) :bat[:oid,:${tp2}]
+address AGGRsum2_${tp2}
+comment "Sum over grouped tail sum on ${tp1}";
+
+command sum(b:bat[:oid,:${tp1}],g:bat[:oid,:oid],e:bat[:oid,:any_1])
+               :bat[:oid,:${tp2}]
+address AGGRsum3_${tp2}
+comment "Grouped tail sum on ${tp1}";
+
+command 
subsum(b:bat[:oid,:${tp1}],g:bat[:oid,:oid],e:bat[:oid,:any_1],skip_nils:int,abort_on_error:int)
 :bat[:oid,:${tp2}]
+address AGGRsubsum_${tp2}
+comment "Grouped sum aggregate";
+
+command 
subsum(b:bat[:oid,:${tp1}],g:bat[:oid,:oid],e:bat[:oid,:any_1],s:bat[:oid,:oid],skip_nils:int,abort_on_error:int)
 :bat[:oid,:${tp2}]
+address AGGRsubsumcand_${tp2}
+comment "Grouped sum aggregate with candidates list";
+
+command product(b:bat[:oid,:${tp1}], e:bat[:oid,:any_1]) :bat[:oid,:${tp2}]
+address AGGRprod2_${tp2}
+comment "Product over grouped tail product on ${tp1}";
+
+command product(b:bat[:oid,:${tp1}],g:bat[:oid,:oid],e:bat[:oid,:any_1])
+               :bat[:oid,:${tp2}]
+address AGGRprod3_${tp2}
+comment "Grouped tail product on ${tp1}";
+
+command 
subprod(b:bat[:oid,:${tp1}],g:bat[:oid,:oid],e:bat[:oid,:any_1],skip_nils:int,abort_on_error:int)
 :bat[:oid,:${tp2}]
+address AGGRsubprod_${tp2}
+comment "Grouped product aggregate";
+
+command 
subprod(b:bat[:oid,:${tp1}],g:bat[:oid,:oid],e:bat[:oid,:any_1],s:bat[:oid,:oid],skip_nils:int,abort_on_error:int)
 :bat[:oid,:${tp2}]
+address AGGRsubprodcand_${tp2}
+comment "Grouped product aggregate with candidates list";
+
+EOF
+       fi
+    done
+done
+
+# We may have to extend the signatures to all possible {void,oid} combos
+for tp in bte sht int wrd lng flt dbl; do
+    cat <<EOF
+command avg(b:bat[:oid,:${tp}], e:bat[:oid,:any_1]) :bat[:oid,:dbl]
+address AGGRavg2_dbl
+comment "Grouped tail average on ${tp}";
+
+command avg(b:bat[:oid,:${tp}], g:bat[:oid,:oid], 
e:bat[:oid,:any_1]):bat[:oid,:dbl]
+address AGGRavg3_dbl
+comment "Grouped tail average on ${tp}";
+
+command 
subavg(b:bat[:oid,:${tp}],g:bat[:oid,:oid],e:bat[:oid,:any_1],skip_nils:int,abort_on_error:int)
 :bat[:oid,:dbl]
+address AGGRsubavg_dbl
+comment "Grouped avg aggregate";
+
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to