dosubot[bot] commented on issue #2934:
URL: 
https://github.com/apache/incubator-hugegraph/issues/2934#issuecomment-3717748680

   <!-- Answer -->
   This is a confirmed HugeGraph-specific bug: when you use a filter like 
`lt(true)` outside of a `match()` step, HugeGraph tries to convert the boolean 
`true` to a number (BigDecimal), which throws a `NumberFormatException` because 
`"true"` is not numeric. This happens due to HugeGraph's internal comparison 
logic for the `lt` predicate, which expects a numeric or date value and 
forcibly converts the operand to a number, unlike JanusGraph or TinkerPop, 
which allow boolean comparison via `Comparable.compareTo` without forced 
numeric conversion. That's why your query works in JanusGraph/TinkerPop and 
inside `match()`, but fails in HugeGraph outside of it. 
   
   There is currently no fix or workaround in HugeGraph except to avoid using 
boolean values with numeric predicates like `lt`, or to use the `match()` 
pattern, which is handled differently internally and does not trigger the 
conversion bug. No recent releases or pull requests address this issue yet. 
   
   Reference:  
   - [HugeGraph's comparison logic and forced numeric 
conversion](https://github.com/apache/incubator-hugegraph/blob/a53af864b31f803780a1db31cb20d3d94d5d34fc/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/Condition.java#L54-L824)
  
   - [NumericUtil and NumberFormatException root 
cause](https://github.com/apache/incubator-hugegraph/blob/a53af864b31f803780a1db31cb20d3d94d5d34fc/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/NumericUtil.java#L301-L360)
   
   
   <!-- 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/71599565-24d1-443f-ba61-22db0feea1b0?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/71599565-24d1-443f-ba61-22db0feea1b0?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/71599565-24d1-443f-ba61-22db0feea1b0?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/71599565-24d1-443f-ba61-22db0feea1b0?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/71599565-24d1-443f-ba61-22db0feea1b0?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/71599565-24d1-443f-ba61-22db0feea1b0?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/71599565-24d1-443f-ba61-22db0feea1b0?feedback_type=other)</sup>
   
   [![Chat with 
Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/e5e246fa-a522-4d8a-ab3c-e2588b5b501b/ask?utm_source=github)&nbsp;[![Open
 in 
Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=This%20is%20a%20confirmed%20HugeGraph-specific%20bug%3A%20when%20you%20use%20a%20filter%20like%20%60lt%28true%29%60%20outside%20of%20a%20%60match%28%29%60%20step%2C%20HugeGraph%20tries%20to%20convert%20the%20boolean%20%60true%60%20to%20a%20number%20%28BigDecimal%29%2C%20which%20throws%20a%20%60NumberFormatException%60%20because%20%60%22true%22%60%20is%20not%20numeric.%20This%20happens%20due%20to%20HugeGraph%27s%20internal%20comparison%20logic%20for%20the%20%60lt%60%20predicate%2C%20which%20expects%20a%20numeric%20or%20date%20value%20and%20forcibly%20converts%20the%20operand%20to%20a%20number%2C%20unlike%20JanusGraph%20or%20TinkerPop%2C%20which%20allow%20boolean%20comparison%20via%20%60Comparable.compareTo%60%20without%20forced%20numeric%20conversio
 
n.%20That%27s%20why%20your%20query%20works%20in%20JanusGraph/TinkerPop%20and%20inside%20%60match%28%29%60%2C%20but%20fails%20in%20HugeGraph%20outside%20of%20it.%20%0A%0AThere%20is%20currently%20no%20fix%20or%20workaround%20in%20HugeGraph%20except%20to%20avoid%20using%20boolean%20values%20with%20numeric%20predicates%20like%20%60lt%60%2C%20or%20to%20use%20the%20%60match%28%29%60%20pattern%2C%20which%20is%20handled%20differently%20internally%20and%20does%20not%20trigger%20the%20conversion%20bug.%20No%20recent%20releases%20or%20pull%20requests%20address%20this%20issue%20yet.%20%0A%0AReference%3A%20%20%0A-%20%5BHugeGraph%27s%20comparison%20logic%20and%20forced%20numeric%20conversion%5D%28https%3A//github.com/apache/incubator-hugegraph/blob/a53af864b31f803780a1db31cb20d3d94d5d34fc/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/Condition.java%23L54-L824%29%20%20%0A-%20%5BNumericUtil%20and%20NumberFormatException%20root%20cause%5D%28https%3A//github.com/apa
 
che/incubator-hugegraph/blob/a53af864b31f803780a1db31cb20d3d94d5d34fc/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/NumericUtil.java%23L301-L360%29)&nbsp;[![Join
 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share
 on 
X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/incubator-hugegraph/issues/2934)


-- 
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]

Reply via email to