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

Abierto
#3,446 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
45/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
groovy, java
Área
api, backend

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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
Lenguaje dominante
Java
Estrellas
3.2k
Forks
645
Merge medio
1 d 2 h
PR fusionados (30 d)
123

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de apache/hugegraph

Todos los issues de apache/hugegraph

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.