Changeset: 01a85e0aa2ee for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=01a85e0aa2ee
Modified Files:
monetdb5/modules/kernel/Makefile.ag
monetdb5/modules/kernel/aggr.mx
monetdb5/modules/kernel/alarm.mx
monetdb5/modules/kernel/algebra.mx
monetdb5/modules/kernel/algebra2.mx
monetdb5/modules/kernel/counters.mx
Branch: headless
Log Message:
A first sweep over algebra signatures
The algebra list should be looked upon in much more detail later.
diffs (truncated from 5641 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
@@ -68,7 +68,7 @@
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
+ mx logger.mx microbenchmark.mx
}
EXTRA_DIST = aggr_ri.mx kprelude.mx
diff --git a/monetdb5/modules/kernel/aggr.mx b/monetdb5/modules/kernel/aggr.mx
--- a/monetdb5/modules/kernel/aggr.mx
+++ b/monetdb5/modules/kernel/aggr.mx
@@ -45,17 +45,17 @@
@mal
module aggr;
@= sumprod_signatures
-command sum(b:bat[:oid,:@1], e:bat[:oid,:any_1]) :bat[:oid,:@2]
+command sum(b:col[:@1], e:col[:any_1]) :col[:@2]
address AX3aggrX3_sum_@1_@2
comment "Sum over grouped tail sum on @1";
-command sum(b:bat[:oid,:@1],g:bat[:oid,:oid],e:bat[:oid,:any_1])
- :bat[:oid,:@2]
+command sum(b:col[:@1],g:col[:oid],e:col[:any_1])
+ :col[:oid,:@2]
address AX3aggrX3_sum3_@1_@2
comment "Grouped tail sum on @1";
-command product(b:bat[:oid,:@1], g:bat[:oid,:oid], e:bat[:oid,:any_1])
- :bat[:oid,:@2]
+command product(b:col[:@1], g:col[:oid], e:col[:any_1])
+ :col[:oid,:@2]
address AX3aggrX3_prod3_@1_@2
comment "Product over grouped tail on @1";
@mal
@@ -80,11 +80,11 @@
@:sumprod_signatures(dbl,dbl)@
@= sum_avg_signatures
-command avg(b:bat[:oid,:@1], e:bat[:oid,:any_1]) :bat[:oid,:dbl]
+command avg(b:col[:@1], e:col[:any_1]) :col[:dbl]
address AX3aggrX3_avg_@1
comment "Grouped tail average on @1";
-command avg(b:bat[:oid,:@1], g:bat[:oid,:oid],
e:bat[:oid,:any_1]):bat[:oid,:dbl]
+command avg(b:col[:@1], g:col[:oid], e:col[:any_1]):col[:dbl]
address AX3aggrX3_avg3_@1
comment "Grouped tail average on @1";
@@ -99,48 +99,48 @@
@:sum_avg_signatures(flt)@
@:sum_avg_signatures(dbl)@
-command min(b:bat[:oid,:any_1], e:bat[:oid,:any_2]) :bat[:oid,:any_1]
+command min(b:col[:any_1], e:col[:any_2]) :col[:any_1]
address AX3aggrX3_min;
-command max(b:bat[:oid,:any_1], e:bat[:oid,:any_2]) :bat[:oid,:any_1]
+command max(b:col[:any_1], e:col[:any_2]) :col[:any_1]
address AX3aggrX3_max;
-command
min(b:bat[:oid,:any_1],g:bat[:oid,:oid],e:bat[:oid,:any_2]):bat[:oid,:any_1]
+command min(b:col[:any_1],g:col[:oid],e:col[:any_2]):col[:any_1]
address AX3aggrX3_min3;
-command max(b:bat[:oid,:any_1], g:bat[:oid,:oid], e:bat[:oid,:any_2])
- :bat[:oid,:any_1]
+command max(b:col[:any_1], g:col[:oid], e:col[:any_2])
+ :col[:oid,:any_1]
address AX3aggrX3_max3;
-command count(b:bat[:oid,:any_1], e:bat[:oid,:any_2], ignorenils:bit)
- :bat[:oid,:wrd]
+command count(b:col[:any_1], e:col[:any_2], ignorenils:bit)
+ :col[:oid,:wrd]
address AX3aggrX3_count
comment "Grouped count";
-command count(b:bat[:oid,:any_1], g:bat[:oid,:oid], e:bat[:oid,:any_2],
- nonils:bit) :bat[:void,:wrd]
+command count(b:col[:any_1], g:col[:oid], e:col[:any_2],
+ nonils:bit) :col[:wrd]
address AX3aggrX3_count3;
-command size(b:bat[:void,:bit], e:bat[:void,:any_1]) :bat[:void,:wrd]
+command size(b:col[:bit], e:col[:any_1]) :col[:wrd]
address AX3aggrX3_size
comment "Grouped count of true values";
-command count(b:bat[:void,:any_1], e:bat[:oid,:any_2]) :bat[:void,:wrd]
+command count(b:col[:any_1], e:col[:any_2]) :col[:wrd]
address AX3aggrX3_count2Nils
comment "Grouped count";
-command count(b:bat[:void,:any_1], e:bat[:void,:any_2]) :bat[:void,:wrd]
+command count(b:col[:any_1], e:col[:any_2]) :col[:wrd]
address AX3aggrX3_count2Nils;
-command count_no_nil(b:bat[:oid,:any_1],e:bat[:oid,:any_1]):bat[:oid,:wrd]
+command count_no_nil(b:col[:any_1],e:col[:any_1]):col[:wrd]
address AX3count_no_nil2;
-command count(b:bat[:oid,:any_1], g:bat[:oid,:oid], e:bat[:oid,:any_2])
- :bat[:oid,:wrd]
+command count(b:col[:any_1], g:col[:oid], e:col[:any_2])
+ :col[:oid,:wrd]
address AX3aggrX3_count3Nils
comment "Grouped count";
-command count_no_nil(b:bat[:oid,:any_1],g:bat[:oid,:oid],e:bat[:oid,:any_2])
- :bat[:oid,:wrd]
+command count_no_nil(b:col[:any_1],g:col[:oid],e:col[:any_2])
+ :col[:oid,:wrd]
address AX3count_no_nil3;
@+ Implementation
diff --git a/monetdb5/modules/kernel/alarm.mx b/monetdb5/modules/kernel/alarm.mx
--- a/monetdb5/modules/kernel/alarm.mx
+++ b/monetdb5/modules/kernel/alarm.mx
@@ -39,7 +39,7 @@
command alarm(secs:int, action:str):void
address ALARMsetalarm
comment "execute action in X secs";
-command timers{unsafe}() :bat[:str,:str]
+command timers{unsafe}() (:col[:str],:col[:str])
address ALARMtimers
comment "give a list of all active timers";
command usec{unsafe}() :lng
@@ -427,9 +427,10 @@
}
str
-ALARMtimers(int *res)
+ALARMtimers(int *res, int *res2)
{
(void) res; /* fool compiler */
+ (void) res2; /* fool compiler */
throw(MAL, "alarm.timers", PROGRAM_NYI);
}
diff --git a/monetdb5/modules/kernel/algebra.mx
b/monetdb5/modules/kernel/algebra.mx
--- a/monetdb5/modules/kernel/algebra.mx
+++ b/monetdb5/modules/kernel/algebra.mx
@@ -45,66 +45,42 @@
else @3 = *(str *)@3;
}}
-@
-We split between selections that return one value, and selections
-that return a BAT.
-@+ Value Selections
+@+ Selections
@mal
module algebra;
-command exist(b:bat[:any_1,:any_2], h:any_1):bit
+command exist(b:col[:any_1], v:any_1):bit
address ALGexist
-comment "Returns whether 'h' occurs as a head value in b.";
-
-command exist(b:bat[:any_1,:any_2], h:any_1, t:any_2):bit
-address ALGexistBUN
-comment "Returns true when 'h,t' occurs as a bun in b.";
-
-command find(b:bat[:any_1,:any_2], h:any_1):any_2
-address ALGfind
-comment "Returns the tail value 't' for which some [h,t] BUN
- exists in b. If no such BUN exists, an error occurs." ;
-
-command position(b:bat[:any_1,:any_2], v:any_1):wrd
+comment "Returns whether 'v' occurs as a value in column b.";
+
+command position(b:col[:any_1], v:any_1):wrd
address ALGposition
-comment "Returns BAT position [0.. b.count] of 'v' in the head
- column of b. It Return an error if 'v' does not exist.";
-
-command position(b:bat[:any_1,:any_2], val:any_1, tval:any_2) :wrd
-address ALGpositionBUN
-comment "Returns the position of the value pair It returns an
- error if 'val' does not exist.";
-
-command fetch(b:bat[:any_2,:any_1], x:oid) :any_1
-address ALGfetchoid;
-command fetch(b:bat[:any_2,:any_1], x:lng) :any_1
-address ALGfetch;
-command fetch(b:bat[:any_2,:any_1], x:int) :any_1
-address ALGfetchint
-comment "Returns the tail value of the BUN at x-th position
- with 0 <= x < b.count";
-
-@+ BAT Selections
-The operations are grouped by positional and range selections.
-A simple sampling operation is also provided.
-@- Positional selection
-@mal
-command fetch(b:bat[:any_1,:any_2], s:bat[:int,:any_3]) :bat[:any_1,:any_2]
-address ALGfetchbat;
-command fetch(b:bat[:any_1,:any_2], s:bat[:lng,:any_3] ) :bat[:any_1,:any_2]
-address ALGfetchbat;
-command fetch(b:bat[:any_1,:any_2], s:bat[:oid,:any_3]) :bat[:any_1,:any_2]
+comment "Returns column index position [0.. b.count] of 'v'.
+ It Return an error if 'v' does not exist.";
+
+command fetch(b:col[:any_1], x:oid) :any_1
+address ALGfetchoid
+comment "Returns the value at x-th position in the column with 0 <= x <
b.count";
+
+command fetch(b:col[:any_1], s:col[:oid]) :col[:any_1]
address ALGfetchbat
-comment "Returns a positional selection of b by the oid
- head values of s";
-
-@- Range selection
-The range selections are targeted at the tail of the BAT.
-@mal
-command select(b:bat[:any_1,:any_2], low:any_2, high:any_2)
- :bat[:any_1,:any_2]
-address ALGselect
-comment "Select all BUNs that have tail values: {v| low <= v <= high}.
+comment "Returns a positional selection of b by the oid values provided in s";
+
+command selectNotNil(b:col[:any_1]):col[:oid]
+address ALGselectNotNil
+comment "Select all not-nil values";
+
+command slice(b:col[:any_1], x:oid, y:oid) :col[:any_1]
+address ALGslice
+comment "Return the slice with the values at position x till y.";
+
+command topN( b:col[:any_1], top:lng ) :col[:any_1]
+address ALGtopN
+comment "Trim all but the top N tuples.";
+
+command uselect(b:col[:any_1], low:any_1, high:any_1, li:bit, hi:bit)
:col[:oid]
+address ALGuselectInclusive
+comment "Select all positions that have values: {v| low <= v <= high}.
NIL boundary values have a special meaning.
+ low == nil means: no lower bound
+ high == nil means: no upper bound.
@@ -114,234 +90,78 @@
ordered domain of values, tuples with 'nil'
values
are NEVER returned by the range select.";
-command thetaselect(b:bat[:any_1,:any_2], val:any_2, op:str)
:bat[:any_1,:any_2]
-address ALGthetaselect
-comment "The theta (<=,<,=,>,>=) select()";
-
-command select(b:bat[:any_1,:any_2], low:any_2,
- high:any_2, li:bit, hi:bit) :bat[:any_1,:any_2]
-address ALGselectInclusive
-comment "Select all BUNs that have tail values: {v| low <{=} v <{=} high}.
- Boundary inclusion is indicated separately.
- NIL boundary values have a special meaning.
- + low == nil means: no lower bound
- + high == nil means: no upper bound.";
-
-command select(b:bat[:any_1,:any_2],value:any_2) :bat[:any_1,:any_2]
-address ALGselect1
-comment "Select all BUNs of a BAT with a certain
- tail value. Selection on NIL is also
- possible (it should be properly casted,
- e.g.:int(nil)).";
-
-command selectNotNil(b:bat[:any_1,:any_2]):bat[:any_1,:any_2]
-address ALGselectNotNil
-comment "Select all not-nil values";
-@-
-The second group uses the head to perform the range selection.
-@mal
-command selectH(b:bat[:any_1,:any_2], low:any_1, high:any_1)
- :bat[:any_1,:any_2]
-address ALGselectHead;
-
-command selectH(b:bat[:any_1,:any_2], low:any_1,
- high:any_1, li:bit, hi:bit) :bat[:any_1,:any_2]
-address ALGselectInclusiveHead;
-
-command selectH(b:bat[:any_1,:any_2],value:any_1) :bat[:any_1,:any_2]
-address ALGselect1Head;
-@-
-A special case for this set are the void tailed bats.
-@mal
-command select(b:bat[:any_2,:void], low:any_2)
- :bat[:any_2,:void]
-address ALGselect1Head;
-
-command select(b:bat[:any_2,:void], low:any_2, high:any_2)
- :bat[:any_2,:void]
-address ALGselectHead;
-command select(b:bat[:any_2,:void], low:any_2, high:any_2,li:bit, hi:bit)
- :bat[:any_2,:void]
-address ALGselectInclusiveHead;
-
-@-
-The second group uses the head to perform the range selection
-@mal
-
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list