dosubot[bot] commented on issue #2935: URL: https://github.com/apache/incubator-hugegraph/issues/2935#issuecomment-3717806190
<!-- Answer --> This is a known HugeGraph 1.7.0 bug: top-level filter steps (like `has()` with `repeat()`) can throw exceptions such as `ArrayIndexOutOfBoundsException`, while equivalent queries using `match()` or nested traversals work as expected. The root cause is that HugeGraph's query planner pushes top-level filters into backend queries and expects certain label/property arrays to be non-empty; when they're empty (as in your query), the traversal engine (e.g., `NestedIterator` or `HugeTraverser`) tries to access an array index that doesn't exist, causing the exception. In contrast, filters inside `match()` are applied in-memory after data retrieval, bypassing this bug. Other graph databases like JanusGraph and TinkerPop do not have this inconsistency, so both query forms work there. There is no fix or official workaround in 1.7.0, but rewriting your query to use `match()` or nested traversals avoids the exception and returns the expected result. This pattern has been reported by other users for similar query forms and is a limitation of HugeGraph's current query planner and filter handling. [See related discussion and technical details](https://github.com/apache/incubator-hugegraph/issues/2932) <!-- 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/50ae1f5a-9afa-49f1-b6b5-8d588e9df93c?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/50ae1f5a-9afa-49f1-b6b5-8d588e9df93c?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/50ae1f5a-9afa-49f1-b6b5-8d588e9df93c?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/50ae1f5a-9afa-49f1-b6b5-8d588e9df93c?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/50ae1f5a-9afa-49f1-b6b5-8d588e9df93c?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/50ae1f5a-9afa-49f1-b6b5-8d588e9df93c?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/50ae1f5a-9afa-49f1-b6b5-8d588e9df93c?feedback_type=other)</sup> [](https://app.dosu.dev/e5e246fa-a522-4d8a-ab3c-e2588b5b501b/ask?utm_source=github) [](https://cursor.com/link/prompt?text=This%20is%20a%20known%20HugeGraph%201.7.0%20bug%3A%20top-level%20filter%20steps%20%28like%20%60has%28%29%60%20with%20%60repeat%28%29%60%29%20can%20throw%20exceptions%20such%20as%20%60ArrayIndexOutOfBoundsException%60%2C%20while%20equivalent%20queries%20using%20%60match%28%29%60%20or%20nested%20traversals%20work%20as%20expected.%20The%20root%20cause%20is%20that%20HugeGraph%27s%20query%20planner%20pushes%20top-level%20filters%20into%20backend%20queries%20and%20expects%20certain%20label/property%20arrays%20to%20be%20non-empty%3B%20when%20they%27re%20empty%20%28as%20in%20your%20query%29%2C%20the%20traversal%20engine%20%28e.g.%2C%20%60NestedIterator%60%20or%20%60HugeTraverser%60%29%20tries%20to%20access%20an%20array%20index%20that%20doesn%27t%20exist%2C %20causing%20the%20exception.%20In%20contrast%2C%20filters%20inside%20%60match%28%29%60%20are%20applied%20in-memory%20after%20data%20retrieval%2C%20bypassing%20this%20bug.%20Other%20graph%20databases%20like%20JanusGraph%20and%20TinkerPop%20do%20not%20have%20this%20inconsistency%2C%20so%20both%20query%20forms%20work%20there.%0A%0AThere%20is%20no%20fix%20or%20official%20workaround%20in%201.7.0%2C%20but%20rewriting%20your%20query%20to%20use%20%60match%28%29%60%20or%20nested%20traversals%20avoids%20the%20exception%20and%20returns%20the%20expected%20result.%20This%20pattern%20has%20been%20reported%20by%20other%20users%20for%20similar%20query%20forms%20and%20is%20a%20limitation%20of%20HugeGraph%27s%20current%20query%20planner%20and%20filter%20handling.%20%20%0A%5BSee%20related%20discussion%20and%20technical%20details%5D%28https%3A//github.com/apache/incubator-hugegraph/issues/2932%29) [](http s://go.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/2935) -- 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]
