 ;; (?2 [(ccount)(ccount)] all-whales)
 ;; (?2 [(union)(union)] all-whales)
 ;; (?2 [(ccount)(union)] all-whales)
+;; (?2 [(sum :weight)(union)] all-whales)
 ;; (?2 [(union)(ccount)] all-whales)
 ;; (?2 [(union)(split :type)] all-whales)
 ;; (?2 [(ccount)(split :type)] all-whales)


(?2 [(union "sum(weight)/ocean/type")(split :ocean nil [(pivot :type types (keyword (sum-value-key :weight)))(sum :weight)(split :type )])] all-whales)

;;(?2 [(split :ocean nil [(union)(split :type nil [(pivot :time years (keyword (count-value-key nil)))(ccount)(split :time (fn [time] (list (or (.lower years time) time))))])])] all-whales)

;;--------------------------------------------------------------------------------

;; create some whales...

(def num-whales 100000)

(def some-whales
     (pmap (fn [id] (whale id)) (range num-whales)))

(def some-whales2
     (let [#^Creator creator (.getCreator whale-metadata)]
       (map
	#(.create creator (into-array Object %))

	 ;; direct
	 (fn []
	     (let [[#^Model src-metamodel prefix #^Collection extra-pairs] (direct-fn)
		   dummy (println "PIVOT BEFORE" extra-pairs)
		   extra-pairs (remove #(= (first %) pivot-key) extra-pairs)
		   dummy (println "PIVOT AFTER " extra-pairs)
		   tgt-model (PivotModel. 
			      (str prefix tgt-name)
			      src-metadata
