[Bug] groupCount().by(missingProperty) creates an unserializable null map key

Đang mở
#3,446 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 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
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
groovy, java
Lĩnh vực
api, backend

Hướng nghiên cứu

Reproduce by creating a vertex with no d1 property on the memory backend, then sending g.V('v1').groupCount().by('d1') to the Gremlin REST endpoint. The failure is in JSON serialization of a HashMap with a null key, so start from where the server converts the traversal result for the response. Done when the request either returns valid JSON or fails with a stable validation error, and a test covers the missing-property case.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug
Bug Type (问题类型)

other exception / error (其他异常报错)

Before submit
  • 我已经确认现有的 Issues 与 FAQ 中没有相同 / 重复问题 (I have confirmed and searched that there are no similar problems in the historical issue and documents)
Environment (环境信息)
  • Server Version: Apache HugeGraph 1.7.0
  • Gremlin Version: 3.5.1
  • Backend: memory
  • Data Size: 1 vertex and 0 edges
Expected & Actual behavior (期望与实际表现)

Create a vertex without property d1, then execute a grouping traversal
through the Gremlin REST endpoint:

g.V('v1').groupCount().by('d1')

Expected: the endpoint should return a valid traversal result or a stable
validation error explaining that the grouping property is absent.

Actual: response serialization fails with:

org.apache.hugegraph.HugeException: Can't write json: Null key for a Map not allowed in JSON

The error identifies a HashMap["null"] in the response value. The server
therefore constructs an intermediate result that its REST serializer cannot
encode.

Vertex/Edge example (问题点 / 边数据举例)
Setup and failing traversal:


schema.vertexLabel('DocVertex').useCustomizeStringId().ifNotExist().create()
g.addV('DocVertex').property(T.id, 'v1').iterate()
g.V('v1').groupCount().by('d1')


The vertex is equivalent to:


{
  "id": "v1",
  "label": "DocVertex",
  "properties": {}
}
Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)
{
  "vertex_label": {
    "name": "DocVertex",
    "id_strategy": "CUSTOMIZE_STRING",
    "properties": []
  },
  "edge_labels": [],
  "index_labels": []
}


Reference behavior:

https://hugegraph.apache.org/docs/clients/restful-api/gremlin/

https://tinkerpop.apache.org/docs/3.5.1/reference/#groupcount-step
Ngôn ngữ chính
Java
Star
3.2k
Fork
645
Merge trung bình
1 ngày 2 giờ
Pull request đã merge (30 ngày)
123

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của apache/hugegraph

Tất cả issue của apache/hugegraph

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.