You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] groupCount().by(missingProperty) creates an unserializable null map key #3446
我已经确认现有的 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 (问题点 / 边数据举例)
Setupandfailing traversal:
schema.vertexLabel('DocVertex').useCustomizeStringId().ifNotExist().create()g.addV('DocVertex').property(T.id,'v1').iterate()g.V('v1').groupCount().by('d1')Thevertexis equivalent to:
{"id": "v1","label": "DocVertex","properties": {}}
TinkerPop 3.5.1 documents that coalesce() selects the first child traversal that emits a value, and groupCount().by(...) uses that projection as the grouping key. For your example, this should produce {"__missing__":1} rather than a null-keyed map. Choose a sentinel that cannot collide with real property values. I haven't executed this against 1.7.0. [1]
The exception text also pinpoints the serialization boundary: HugeGraph's JsonUtil.toJson() calls Jackson's writeValueAsString() and wraps serialization failures as HugeException("Can't write json: ..."). This supports your distinction between constructing the traversal result and failing to encode it, though it does not establish where the null grouping key originates. [2]
Activity
dosubot commentedon Nov 1, 2026
A workaround to try is to give missing values an explicit, non-null bucket:
TinkerPop 3.5.1 documents that
coalesce()selects the first child traversal that emits a value, andgroupCount().by(...)uses that projection as the grouping key. For your example, this should produce{"__missing__":1}rather than a null-keyed map. Choose a sentinel that cannot collide with real property values. I haven't executed this against 1.7.0. [1]The exception text also pinpoints the serialization boundary: HugeGraph's
JsonUtil.toJson()calls Jackson'swriteValueAsString()and wraps serialization failures asHugeException("Can't write json: ..."). This supports your distinction between constructing the traversal result and failing to encode it, though it does not establish where the null grouping key originates. [2]To reply, just mention @dosu.
Docs are dead. Just use Dosu.