dosubot[bot] commented on issue #2932: URL: https://github.com/apache/incubator-hugegraph/issues/2932#issuecomment-3717673077
<!-- Answer --> This exception is caused by HugeGraph's internal range validation logic, not by the gte() predicate itself. When you use `count().is(gte(-3))`, HugeGraph tries to construct a query range with `[0, -3]`, which fails validation because the end of the range is less than the start. The relevant code enforces that range queries must have `end >= start`, and throws `IllegalArgumentException` if not, resulting in the error you see ["Invalid range: [0, -3)"](https://github.com/apache/incubator-hugegraph/blob/a53af864b31f803780a1db31cb20d3d94d5d34fc/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/Query.java#L182-L348). This behavior is different from JanusGraph and Tinkerpop, which do not reject negative values in this context. In HugeGraph, you can avoid this error by not using negative values in range predicates like gte() when they are applied to steps that result in a count or range operation. Alternatively, restructuring the query (as in your second example) avoids triggering this range validation path. There are currently no merged fixes or workarounds in recent HugeGraph releases for this issue, so this is likely a bug or an unintended limitation in the query optimizer. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/97e4a84c-7e67-48c6-b116-3182fa967c7e?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/97e4a84c-7e67-48c6-b116-3182fa967c7e?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/97e4a84c-7e67-48c6-b116-3182fa967c7e?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/97e4a84c-7e67-48c6-b116-3182fa967c7e?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/97e4a84c-7e67-48c6-b116-3182fa967c7e?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/97e4a84c-7e67-48c6-b116-3182fa967c7e?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/97e4a84c-7e67-48c6-b116-3182fa967c7e?feedback_type=other)</sup> [](https://app.dosu.dev/e5e246fa-a522-4d8a-ab3c-e2588b5b501b/ask?utm_source=github) [](https://cursor.com/link/prompt?text=This%20exception%20is%20caused%20by%20HugeGraph%27s%20internal%20range%20validation%20logic%2C%20not%20by%20the%20gte%28%29%20predicate%20itself.%20When%20you%20use%20%60count%28%29.is%28gte%28-3%29%29%60%2C%20HugeGraph%20tries%20to%20construct%20a%20query%20range%20with%20%60%5B0%2C%20-3%5D%60%2C%20which%20fails%20validation%20because%20the%20end%20of%20the%20range%20is%20less%20than%20the%20start.%20The%20relevant%20code%20enforces%20that%20range%20queries%20must%20have%20%60end%20%3E%3D%20start%60%2C%20and%20throws%20%60IllegalArgumentException%60%20if%20not%2C%20resulting%20in%20the%20error%20you%20see%20%5B%22Invalid%20range%3A%20%5B0%2C%20-3%29%22%5D%28https%3A//github.com/apache/incubator-hugegraph/blob/a53af864b31f803780a1db31cb20d3d94d5d34 fc/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/Query.java%23L182-L348%29.%0A%0AThis%20behavior%20is%20different%20from%20JanusGraph%20and%20Tinkerpop%2C%20which%20do%20not%20reject%20negative%20values%20in%20this%20context.%20In%20HugeGraph%2C%20you%20can%20avoid%20this%20error%20by%20not%20using%20negative%20values%20in%20range%20predicates%20like%20gte%28%29%20when%20they%20are%20applied%20to%20steps%20that%20result%20in%20a%20count%20or%20range%20operation.%20Alternatively%2C%20restructuring%20the%20query%20%28as%20in%20your%20second%20example%29%20avoids%20triggering%20this%20range%20validation%20path.%0A%0AThere%20are%20currently%20no%20merged%20fixes%20or%20workarounds%20in%20recent%20HugeGraph%20releases%20for%20this%20issue%2C%20so%20this%20is%20likely%20a%20bug%20or%20an%20unintended%20limitation%20in%20the%20query%20optimizer.) [](https://g o.dosu.dev/discord-bot) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/incubator-hugegraph/issues/2932) -- 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]
