     (when udfs
       (.userDefinedFunctions builder udfs))
     (when destination-table
-      (.destinationTable builder (TableId/of project-id dataset-id table-id)))
+      (let [{:keys [project-id dataset-id table-id]} destination-table]
+        (.destinationTable builder (TableId/of project-id dataset-id table-id))))
     (when-not (nil? dry-run?)
       (.dryRun builder dry-run?))
     (let [query-config (.build builder)]

(defn job [service {:keys [project-id job-id] :as job}]
  (to-clojure (.getJob service (JobId/of project-id job-id) (into-array BigQuery$JobOption []))))

(defn completed? [job]
  (and (= :done (get-in job [:status :state]))
       (empty? (get-in job [:status :errors]))))

(def create-dispositions {:needed JobInfo$CreateDisposition/CREATE_IF_NEEDED
                          :never  JobInfo$CreateDisposition/CREATE_NEVER})

(defn- coerce-result
  [schema]
  (let [coercions (map cell-coercions (map :type schema))
        names     (map :name schema)]
    (fn [row]
      (->> (for [[name coerce value] (partition 3 (interleave names coercions row))]
             [name (coerce value)])
           (into {})))))

(defn query-results-seq
  "Takes a query result and coerces the results from being raw sequences
