Commit b3f17276 authored by Ole Voldsæter's avatar Ole Voldsæter
Browse files

fixed "pc" and "rank"

parent 193ba609
......@@ -9,8 +9,6 @@
; anycount
; anymatch
; anyvalue
; concat
; cut
; ends
; group
......@@ -168,18 +166,18 @@
(defn egen-expr [& [by-clause varname funcname expr filter options]]
(let [funcname (keyword funcname)]
(case funcname
:std (make-compute
varname
"std_val"
(let [m (get-var-length-option :mean 1 options)
s (get-var-length-option :std 1 options)
m (if m (get options m) {:values [0]})
s (if s (get options s) {:values [1]})]
[expr
{"$type" "NumericConstantExpression" :value (-> m :values first)}
{"$type" "NumericConstantExpression" :value (-> s :values first)}]
)
filter)
:std (make-compute
varname
"std_val"
(let [m (get-var-length-option :mean 1 options)
s (get-var-length-option :std 1 options)
m (if m (get options m) {:values [0]})
s (if s (get options s) {:values [1]})]
[expr
{"$type" "NumericConstantExpression" :value (-> m :values first)}
{"$type" "NumericConstantExpression" :value (-> s :values first)}]
)
filter)
:pctile (make-aggregate
by-clause
varname
......@@ -187,10 +185,26 @@
[expr
{"$type" "NumericConstantExpression" :value (-> (:p options {:values [50]}) :values first)}]
filter)
;;;----- weird ones -------------
:rank (unsupported-func funcname)
:pc (unsupported-func funcname)
:pc (make-aggregate
by-clause
varname
(get aggregate-funcs (keyword funcname))
[expr
(-> options :prop nil? not)]
filter)
:rank (make-aggregate
by-clause
varname
(get aggregate-funcs (keyword funcname))
[expr
{"$type" "StringConstantExpression"
:value (cond
(get-var-length-option :field 1 options) "field"
(get-var-length-option :track 1 options) "track"
(get-var-length-option :unique 1 options) "unique"
:else "default"
)}]
filter)
;;; default
(make-aggregate
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment