imbajin commented on code in PR #561: URL: https://github.com/apache/hugegraph-doc/pull/561#discussion_r4492689072
########## content/en/docs/language/hugegraph-gremlin.md: ########## @@ -138,3 +138,29 @@ please refer to the [Apache TinkerPop 3.8.1 official documentation](https://tink | `V` | Traversal steps between vertices and edges: `V`, `E`, `out`, `in`, `both`, `outE`, `inE`, `bothE`, `outV`, `inV`, `bothV`, and `otherV` | [vertex steps](https://tinkerpop.apache.org/docs/3.8.1/reference/#vertex-steps) | | `where` | Filters traversal results. Supports `eq`, `neq`, `lt`, `lte`, `gt`, `gte`, and `between` operators. | [where step](https://tinkerpop.apache.org/docs/3.8.1/reference/#where-step) | {.wide .expand} + + +### Numeric Literal Type Matching in Gremlin-Groovy Predicates + +When evaluating property predicates via Gremlin-Groovy (HTTP `/gremlin` endpoint, HugeGraph-Console, or HugeGraph-Hubble), Groovy parses **unsuffixed decimal literals** (such as `1.0` or `1.5`) as `java.math.BigDecimal` rather than `java.lang.Double` or `java.lang.Float`. + +- **Comparison predicates (`P.eq`, `P.neq`, `P.lt`, `P.lte`, `P.gt`, `P.gte`, `P.between`):** TinkerPop's `Compare` predicate performs value-based numeric promotion across `Number` subclasses (`BigDecimal`, `Double`, `Float`, `Long`, `Integer`). Review Comment: ⚠️ HugeGraph converts comparison values to the property key type before constructing the query condition (`convCompare2UserpropRelation` → `validPropertyValue` → `DataType.valueToNumber`). For a `LONG` key, `has('timestamp', P.lt(1.5))` attempts `Long.valueOf("1.5")` and throws instead of comparing by numeric promotion. Please describe this conversion and its failure cases in both language versions. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
