Fork me on GitHub
#xtdb
<
2024-02-29
>
daveliepmann11:02:42

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&amp;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.

refset18:02:20

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.

daveliepmann08:03:04

Aha...I see. Thank you.

👌 1
daveliepmann08:03:12

I think I would use such a get-attr2

📝 1
👍 1
kokonut14:02:54

A quick question, please. How can I query for documents that don't have a certain field?

henrik14:02:51

(not [?entity :field _])

henrik14:02:55

Should do it

kokonut14:02:40

Awesome! thanks3

👍 1
1