title | layout |
---|---|
Upgrading Your Project to Cascalog 2.0 |
article |
Cascalog 2.0 is a major improvement over 1.x. The underlying query parser remains the same but there are several notable breaking API changes. This is a guide to point out the major differences between 2.x and 1.x versions of Cascalog to help you make the upgrade.
- Most namespaces have been moved into either
cascalog.cascading.*
orcascalog.logic.*
cascalog.ops
→cascalog.logic.ops
cascalog.vars
→cascalog.logic.vars
- Higher-order functions using extra vector around a function name, like
(defmapop [times [x]] [y] (* x y))
is no longer supported in favour of using anonymous functions - Built-in ops use anonymous functions to set pameters. For example,
(c/limit [1] ...)
is now((c/limit 1) ...)
- Functions can be passed directly instead of as vars. For example,
(def src [1 2 3 4 5])
(defn square [x] (* x x))
(defn my-query [op]
(??<- [!x !y]
(src !x)
(op !x :> !y)))
(my-query #'square)
now becomes
(my-query square)
Cascalog operations are now just functions, so the def*op
names have been deprecated in favor of names that sound like functions, def*fn
. A few examples:
deffilterop
→deffilterfn
defbufferop
→defbufferfn
defmapop
→defmapfn