Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Add explain function to output dotfile of cascading workflow. #133

merged 1 commit into from

2 participants


Cascading allows you to output dotfile from flows easily. This is a great help for debugging complex queries.

This was recently documented here:

Why not make it easier and just export an explain function?

@Quantisan Quantisan merged commit 0de9b1a into from


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 17 additions and 0 deletions.
  1. +17 −0 cascalog-core/src/clj/cascalog/api.clj
17 cascalog-core/src/clj/cascalog/api.clj
@@ -186,6 +186,23 @@
{"cascading.flow.job.pollinginterval" 100}))
(.connect flowdef))))
+(defn explain
+ "Explains a query (by outputting a DOT file).
+ outfile - String location for DOT file output.
+ sink-tap - Sink tap for query. Shows on query explanation. Defaults to stdout if omitted.
+ query - Query to be explained.
+ Syntax: (explain outfile query) or (explain outfile sink query)
+ Ex: (explain \"\" (<- [?a ?b] ([[1 2]] ?a ?b)))
+ "
+ ([^String outfile query]
+ (explain outfile (stdout) query))
+ ([^String outfile sink-tap query]
+ (let [^Flow flow (compile-flow sink-tap query)]
+ (w/write-dot flow outfile))))
(defn ?-
"Executes 1 or more queries and emits the results of each query to
the associated tap.
Something went wrong with that request. Please try again.