Support [bool] list predicates and JSON arrays of booleans
Maintainer thường phản hồi trong vòng 10 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 45/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Go
- Star
- 21.8k
- Fork
- 1.6k
- Merge trung bình
- 11 ngày 7 giờ
- Pull request đã merge (30 ngày)
- 5
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của dgraph-io/dgraph
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 10 ngày
-
Broken links in the docsĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 10 ngày
-
Stale
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
dgraph-io/dgraph#9811 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 10 ngày
-
Stale
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
dgraph-io/dgraph#9810 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 10 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 10 ngày
Tất cả issue của dgraph-io/dgraph
Issue tương tự
-
【文档错误】创建镜像空间步骤中的截图标注与文字描述不一致Đang mởenhancement
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 62/100
DaoCloud/DaoCloud-docs#7839 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Support AlienVault OTX API keysĐang mởType: Enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
projectdiscovery/urlfinder#167 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
peterstace/simplefeatures#726 ·
-
area: import bug go good first issue priority: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
fukubie/StockLlama#69 ·
-
Add `rumpty firewall create|rm`Đang mởenhancement help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
cloverworks-hq/rumpty-cli#95 ·
Maintainer thường phản hồi trong vòng 1 ngày