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

Aperta
#3,446 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
groovy, java
Ambito
api, backend

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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
Lingua principale
Java
Stelle
3.2k
Fork
645
Merge medio
1g 2h
PR unite (30g)
123

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apache/hugegraph

Tutte le issue di apache/hugegraph

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.