       (vec ck))))
 
 (defn flatten-key
+  "coerce to a vector and remove any partition-key nesting"
   [key]
-  (-> key v/coerce flatten))
+  (some-> key v/coerce flatten vec))
 
 (defn extract-key-value
   "extract a key value from some combination of explicit value

  "true if the record contains? keys for all the key components"
  [key record]
  (->> key
       flatten
       (map #(contains? record %))
       (every? identity)))

  "remove components from a [key key-value] pair, returning
   a new [key key-value] pair with the components removed"
  [key key-value remove-components]
  (let [kvs (map vector (flatten-key key) (flatten-key key-value))
        rcs (set (flatten-key remove-components))
        fkvs (filter (fn [[k v]] (not (contains? rcs k)))
                     kvs)]
    (when (> (count fkvs) 0)
      [(map first fkvs) (map second fkvs)])))

(defn key-equality-clause
  "return a Hayt when clause for key and key-value... if
   elements of key-value are lists then an :in clause will
   be used instead of :="
  [key key-value]
  (let [key (flatten-key key)
        key-value (v/coerce key-value)]
    (mapv (fn [k v]
            (if (sequential? v)
