Support [bool] list predicates and JSON arrays of booleans
Los mantenedores suelen responder en 10 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 45/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Go
- Estrellas
- 21.8k
- Forks
- 1.6k
- Merge medio
- 11 d 7 h
- PR fusionados (30 d)
- 5
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de dgraph-io/dgraph
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
Los mantenedores suelen responder en 10 días
-
Broken links in the docsAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 76/100
Los mantenedores suelen responder en 10 días
-
Stale
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
dgraph-io/dgraph#9811 · 1 comentario ·
Los mantenedores suelen responder en 10 días
-
Stale
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
dgraph-io/dgraph#9810 · 1 comentario ·
Los mantenedores suelen responder en 10 días
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 10 días
Todos los issues de dgraph-io/dgraph
Issues similares
-
【文档错误】创建镜像空间步骤中的截图标注与文字描述不一致Abiertoenhancement
Dificultad 1/5 Menos de una hora Aptitud para principiantes 62/100
DaoCloud/DaoCloud-docs#7839 ·
Los mantenedores suelen responder en 1 día
-
Support AlienVault OTX API keysAbiertoType: Enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
projectdiscovery/urlfinder#167 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
peterstace/simplefeatures#726 ·
-
area: import bug go good first issue priority: low
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
fukubie/StockLlama#69 ·
-
Add `rumpty firewall create|rm`Abiertoenhancement help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
cloverworks-hq/rumpty-cli#95 ·
Los mantenedores suelen responder en 1 día