Type difference of query result between local and ion

#1

Hi,

It seems there is a difference of the type of a query result between code executed locally in the repl and inside an ion.

The following code:

(defn test-datomic [_]
  (let [res (d/q '[:find ?ident
                   :where [_ :db/ident ?ident]]
                 (d/db (get-conn)))]
    (-> res type str)))

Returns:

  • “class clojure.lang.PersistentVector” locally
  • “class java.util.HashSet” when deployed as an ion
0 Likes

#2

The differences in types observed here are similar to those observed when using a transaction function in Datomic On-Prem with a local (mem) transactor vs. a deployed remote transactor.
Datomic doesn’t guarantee type equality between wire-serialized vs. local execution. If you need to ensure a specific type, I would recommend checking and/or coercion as appropriate.

0 Likes