Support [bool] list predicates and JSON arrays of booleans
I maintainer di solito rispondono entro 10 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 45/100
Direzione di ricerca
Start with the list-type check in schema/parse.go, which rejects [bool] alongside [password], and the []interface{} item switch in mapToNquads in chunker/json_parser.go, which must be checked in both ParseJSON and FastParseJSON. Done means p: [bool] . parses, a JSON array of booleans is accepted, and [password] is still refused. The author's test names (TestParseScalarListEveryStoreType, TestNquadsFromJsonBoolList) show what to cover, but the false-as-delete-all behaviour needs a maintainer decision first.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What happens. Two places refuse a list of booleans:
- The schema parser refuses
p: [bool] .withUnsupported type for list: [bool].
(schema/parse.go, theschema.Listcheck namesPasswordIDandBoolID). - The JSON mutation parser refuses a JSON array of booleans, whatever the schema:
{"set": {"uid": "_:a", "p": [true, false]}}givesgot unsupported type for list: p
(chunker/json_parser.go,mapToNquads: the[]interface{}branch acceptsstring,
float64,json.Numberandint64items, notbool), in bothParseJSONand
FastParseJSON.
Dgraph's GraphQL layer refuses [Boolean] with the comment "[Boolean] is not allowed as
dgraph schema doesn't support [bool] yet" (graphql/schema/rules.go:724), which reads as
a missing feature rather than a design decision.
Why it matters. A multi-valued boolean is ordinary in RDF and OWL data: OWL 2 lets a
data property that is not functional relate a subject to both true and false. A
schema generated from such a model has no way to store it in Dgraph except as a string or
int list, which loses the boolean type for comparison and output.
Proposed change (what our fork runs). Remove BoolID from the list check in
schema/parse.go (keep PasswordID), and add bool to the two item type cases of the
[]interface{} branch in chunker/json_parser.go. Nothing else was needed in our
testing: a list value's posting UID is the fingerprint of the value after conversion to the
schema type (posting/list.go fingerprintEdge), so "true", "1", "T" and true are
one stored value; count(), has(), eq() in a filter and with the bool index at the
root, deletes of one value, the admin JSON export (one record per value, schema line
<p>:[bool] @count), and dgraph live and dgraph bulk loading that export all behaved
as for other scalar lists. The admin RDF export was not tried. Sorting by a [bool] is refused like sorting by any
list.
Behaviour to be aware of. In a JSON delete, false is read as "every value"
(handleBasicType, as 0 and null), so {"delete": {"uid": X, "p": false}} on a
[bool] holding both values removes both. Deleting one value works with the string
"false" or RDF. We kept the convention and documented it; upstream may want to decide
whether false inside an array ("p": [false]) should be star.
Tests we added (can be offered with the change): schema/parse_test.go
TestParseScalarListEveryStoreType (string, int, float, bool, datetime lists parse;
[password] still refused); chunker/json_bool_list_test.go
(TestNquadsFromJsonBoolList, TestNquadsFromJsonBoolDeleteFalseIsStar).
Compatibility. No stored data changes. A store holding a [bool] predicate opened by
a binary without the change still reads it (the stored schema is not re-parsed), but that
binary refuses the schema text, so an Alter or export/restore round trip through it fails.
- Lingua principale
- Go
- Stelle
- 21.8k
- Fork
- 1.6k
- Merge medio
- 11g 7h
- PR unite (30g)
- 5
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di dgraph-io/dgraph
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
I maintainer di solito rispondono entro 10 giorni
-
Broken links in the docsAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 76/100
I maintainer di solito rispondono entro 10 giorni
-
Stale
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
dgraph-io/dgraph#9811 · 1 commento ·
I maintainer di solito rispondono entro 10 giorni
-
Stale
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
dgraph-io/dgraph#9810 · 1 commento ·
I maintainer di solito rispondono entro 10 giorni
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 10 giorni
Tutte le issue di dgraph-io/dgraph
Issue simili
-
【文档错误】创建镜像空间步骤中的截图标注与文字描述不一致Apertaenhancement
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 62/100
DaoCloud/DaoCloud-docs#7839 ·
I maintainer di solito rispondono entro 1 giorno
-
Type: Enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
projectdiscovery/urlfinder#167 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
peterstace/simplefeatures#726 ·
-
area: import bug go good first issue priority: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
fukubie/StockLlama#69 ·
-
enhancement help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
cloverworks-hq/rumpty-cli#95 ·
I maintainer di solito rispondono entro 1 giorno