Skip to content
This repository has been archived by the owner on Dec 15, 2018. It is now read-only.

results->maps? option in db-query throws #38

Closed
j-po opened this issue Feb 3, 2017 · 2 comments
Closed

results->maps? option in db-query throws #38

j-po opened this issue Feb 3, 2017 · 2 comments
Assignees

Comments

@j-po
Copy link

j-po commented Feb 3, 2017

journey.core=> (capacitor.core/db-query db/client "SHOW MEASUREMENTS" true)
IllegalArgumentException No method in multimethod 'fmap' for dispatch value: class java.lang.Integer  clojure.lang.MultiFn.getFn (MultiFn.java:156)
journey.core=> *e
#error {
 :cause "No method in multimethod 'fmap' for dispatch value: class java.lang.Integer"
 :via
 [{:type java.lang.IllegalArgumentException
   :message "No method in multimethod 'fmap' for dispatch value: class java.lang.Integer"
   :at [clojure.lang.MultiFn getFn "MultiFn.java" 156]}]
 :trace
 [[clojure.lang.MultiFn getFn "MultiFn.java" 156]
  [clojure.lang.MultiFn invoke "MultiFn.java" 233]
  [capacitor.http$fmap_func invokeStatic "http.clj" 16]
  [capacitor.http$fmap_func invoke "http.clj" 14]
  [capacitor.http$fmap_func$fn__16954 invoke "http.clj" 16]
  [clojure.algo.generic.functor$eval16891$fn__16892$iter__16893__16897$fn__16898 invoke "functor.clj" 35]
  [clojure.lang.LazySeq sval "LazySeq.java" 40]
  [clojure.lang.LazySeq seq "LazySeq.java" 49]
  [clojure.lang.RT seq "RT.java" 521]
  [clojure.core$seq__4357 invokeStatic "core.clj" 137]
  [clojure.core.protocols$seq_reduce invokeStatic "protocols.clj" 24]
  [clojure.core.protocols$fn__6738 invokeStatic "protocols.clj" 75]
  [clojure.core.protocols$fn__6738 invoke "protocols.clj" 75]
  [clojure.core.protocols$fn__6684$G__6679__6697 invoke "protocols.clj" 13]
  [clojure.core$reduce invokeStatic "core.clj" 6545]
  [clojure.core$into invokeStatic "core.clj" 6610]
  [clojure.core$into invoke "core.clj" 6604]
  [clojure.algo.generic.functor$eval16891$fn__16892 invoke "functor.clj" 35]
  [clojure.lang.MultiFn invoke "MultiFn.java" 233]
  [capacitor.http$fmap_func invokeStatic "http.clj" 16]
  [capacitor.http$fmap_func invoke "http.clj" 14]
  [capacitor.http$fmap_func$fn__16954 invoke "http.clj" 16]
  [clojure.core$map$fn__4785 invoke "core.clj" 2644]
  [clojure.lang.LazySeq sval "LazySeq.java" 40]
  [clojure.lang.LazySeq seq "LazySeq.java" 49]
  [clojure.lang.RT seq "RT.java" 521]
  [clojure.core$seq__4357 invokeStatic "core.clj" 137]
  [clojure.core.protocols$seq_reduce invokeStatic "protocols.clj" 24]
  [clojure.core.protocols$fn__6738 invokeStatic "protocols.clj" 75]
  [clojure.core.protocols$fn__6738 invoke "protocols.clj" 75]
  [clojure.core.protocols$fn__6684$G__6679__6697 invoke "protocols.clj" 13]
  [clojure.core$reduce invokeStatic "core.clj" 6545]
  [clojure.core$into invokeStatic "core.clj" 6610]
  [clojure.core$into invoke "core.clj" 6604]
  [clojure.algo.generic.functor$eval16887$fn__16888 invoke "functor.clj" 31]
  [clojure.lang.MultiFn invoke "MultiFn.java" 233]
  [capacitor.http$fmap_func invokeStatic "http.clj" 16]
  [capacitor.http$fmap_func invoke "http.clj" 14]
  [capacitor.http$fmap_func$fn__16954 invoke "http.clj" 16]
  [clojure.algo.generic.functor$eval16891$fn__16892$iter__16893__16897$fn__16898 invoke "functor.clj" 35]
  [clojure.lang.LazySeq sval "LazySeq.java" 40]
  [clojure.lang.LazySeq seq "LazySeq.java" 49]
  [clojure.lang.RT seq "RT.java" 521]
  [clojure.core$seq__4357 invokeStatic "core.clj" 137]
  [clojure.core.protocols$seq_reduce invokeStatic "protocols.clj" 24]
  [clojure.core.protocols$fn__6738 invokeStatic "protocols.clj" 75]
  [clojure.core.protocols$fn__6738 invoke "protocols.clj" 75]
  [clojure.core.protocols$fn__6684$G__6679__6697 invoke "protocols.clj" 13]
  [clojure.core$reduce invokeStatic "core.clj" 6545]
  [clojure.core$into invokeStatic "core.clj" 6610]
  [clojure.core$into invoke "core.clj" 6604]
  [clojure.algo.generic.functor$eval16891$fn__16892 invoke "functor.clj" 35]
  [clojure.lang.MultiFn invoke "MultiFn.java" 233]
  [capacitor.http$fmap_func invokeStatic "http.clj" 16]
  [capacitor.http$fmap_func invoke "http.clj" 14]
  [capacitor.http$results__GT_maps invokeStatic "http.clj" 20]
  [capacitor.http$results__GT_maps invoke "http.clj" 18]
  [capacitor.http$extract invokeStatic "http.clj" 24]
  [capacitor.http$extract doInvoke "http.clj" 22]
  [clojure.lang.RestFn invoke "RestFn.java" 423]
  [capacitor.query$db_query invokeStatic "query.clj" 10]
  [capacitor.query$db_query invoke "query.clj" 8]
  [capacitor.core$db_query invokeStatic "core.clj" 130]
  [capacitor.core$db_query doInvoke "core.clj" 127]
...

Also happens in less trivial queries (every query I've tried so far). Latest capacitor version, latest InfluxDB (1.2.0)

@olauzon olauzon self-assigned this Feb 13, 2017
@vspinu
Copy link

vspinu commented Jun 24, 2017

This is because the result map now includes :statement_id 0 field.

Including checks for seqable and map fixes the errors but I have only superficial understanding and cannot vouch for this solution:

(defn ->maps
  [s]
  (if (map? s)
    (assoc s :results (vec (map #(zipmap (:columns s) %) (:values s))))
    s))

(defn fmap-func
  [depth func data]
  (if (or (zero? depth)
          (not (instance? clojure.lang.Seqable data)))
    (func data)
    (fmap #(fmap-func (dec depth) func %) data)))

@olauzon
Copy link
Owner

olauzon commented Dec 14, 2018

Library is no longer maintained.

@olauzon olauzon closed this as completed Dec 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants