 ;; (?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)

  (fn [[metadata-fn direct-fn]]
      (let [[src-metadata metaprefix extra-keys] (metadata-fn)
	    ;;dummy (println "PIVOT METADATA" pivot-key keys value-key)
	    tgt-metadata (pivot-metadata src-metadata (remove #(= % pivot-key) extra-keys) pivot-values value-key)
	    tgt-name (str ".pivot(" value-key "/" pivot-key")")]
	[ ;; metadata
	 (fn []

	 ;; 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
