This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-02-29
Channels
- # announcements (6)
- # babashka (7)
- # beginners (24)
- # calva (2)
- # cider (21)
- # clj-kondo (49)
- # cljdoc (29)
- # clojure (56)
- # clojure-dev (2)
- # clojure-europe (15)
- # clojure-nl (6)
- # clojure-norway (27)
- # clojure-uk (3)
- # clojuredesign-podcast (6)
- # clojurescript (1)
- # conjure (1)
- # core-async (8)
- # cryogen (2)
- # cursive (6)
- # data-science (1)
- # datomic (12)
- # events (1)
- # fulcro (16)
- # graalvm (28)
- # hyperfiddle (2)
- # lambdaisland (4)
- # leiningen (20)
- # observability (1)
- # off-topic (24)
- # pathom (5)
- # pedestal (10)
- # portal (7)
- # practicalli (1)
- # reitit (5)
- # rewrite-clj (20)
- # shadow-cljs (18)
- # vim (8)
- # xtdb (9)
Why, when I save an attribute as a set and then retrieve it in a q
with get-attr
, do I get a vector? (It's correctly a set when I get the whole document with entity
or pull
.)
I'm in a situation similar to https://clojurians.slack.com/archives/CG3AM2F7V/p1674074711432399?thread_ts=1674073775.368339&cid=CG3AM2F7V, in that I want in my :where
clause to do set operations with the attribute value. My current workaround is to create a second binding which is explicitly coerced back to a set in order to use contains?
on it.
Hey @U05092LD5 the AEV index and associated internal query code that uses it are simply not aware of the exact collection type of the value original submitted - instead, the query engine operating over that index just sees a sequence of ('decomposed'/'flattened') entries in the index and so a vector is assumed by default (this access path is in contrast to entity
/`pull` which really do just retrieve the set from the original document, and not AEV).
I think in theory the AEV index and get-attr
code here could be changed to be aware of the set-nature of the submitted value, but in practice that probably means a breaking change (or get-attr2
) and requires extending the index in some way to record the distinction.