Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

defreduceraggregator doesn't follow normal convention. #17

Open
d-t-w opened this issue Apr 12, 2015 · 0 comments
Open

defreduceraggregator doesn't follow normal convention. #17

d-t-w opened this issue Apr 12, 2015 · 0 comments

Comments

@d-t-w
Copy link
Contributor

d-t-w commented Apr 12, 2015

Most (all?) of the DSL macros follow a similar pattern:

(defn clojure-filter*
(defmacro clojure-filter
(defmacro filter [& body]
(defmacro deffilter

where (deffilter opts {:prepare true} is a shortcut which to (filter which is defined a couple of different ways depending on if you have also passed :params or not. (def or defn)

That's convenient, because you can use it like:

(trident/deftridentfn decode
  [tuple coll]
   ...)

or;

(trident/deftridentfn winnow-batch {:params [hosts] :prepare true}
  [conf context]
  (let [keep? (some-predicate hosts)]
    (trident/tridentfn
      (execute [tuple coll]
        ... do something with keep?))))

defreduceraggregator is different, it makes no internal call to reduceraggregator for you, so you are required to:

(trident/defreduceraggregator error-reducer
  (trident/reducer-aggregator
    (init []
      ...)
    (reduce [curr tuple]
      ...)))

where you should probably be able to follow the same convention as others and just supply:

(trident/defreduceraggregator error-reducer
    ([] (some-init))
    ([curr tuple] (some-reduce))

A minor nit, but unless i've missed something deliberate in this case I'm happy to raise a PR bringing it in line with the other macros.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant