Repository navigation
Description
ArcadeDB version
- Image:
arcadedata/arcadedb:latest - Version:
26.11.1-SNAPSHOT - Build:
31930bb8bb9f295331db42c3d42ca61f7f4a65dc - Tested: 2026-10-09
- Query language: Cypher / OpenCypher
Description
ArcadeDB silently drops rows when a Boolean variable is enclosed in parentheses in a WHERE clause following WITH.
The query below should return one row because flag is bound to true. Instead, it returns an empty result.
Removing the parentheses restores the expected behavior.
The issue appears to be in Boolean predicate parsing rather than Boolean comparison or evaluation. A parenthesized variable appears to be interpreted as a single-node graph pattern instead of a Boolean expression.
Steps to reproduce
No graph setup is required.
WITH true AS flag
WHERE (flag)
RETURN flag;Expected result:
flag = true
Actual result:
[]
The query succeeds without an error or warning.
Control: Boolean comparison works without parentheses
The same behavior can be demonstrated using a comparison result stored in a variable.
WITH 3.14 AS lhs, 1 AS rhs
WITH lhs, rhs, lhs > rhs AS result
WHERE result
RETURN lhs, rhs;Actual result (correct):
lhs = 3.14
rhs = 1
Adding parentheses around the Boolean variable:
WITH 3.14 AS lhs, 1 AS rhs
WITH lhs, rhs, lhs > rhs AS result
WHERE (result)
RETURN lhs, rhs;Actual result (incorrect):
[]
The comparison itself also works:
RETURN 3.14 > 1 AS result;Actual:
result = true
These controls isolate the failure to the parenthesized Boolean variable in WHERE, not to numeric comparison.
Probable cause
In CypherASTBuilder.parseBooleanFromExpression7(), the parenthesized-expression handling checks whether the inner text is a bare identifier and excludes only the Boolean and null keywords.
See CypherASTBuilder.java, lines 1447–1464.
A parenthesized identifier such as (flag) therefore appears to enter the single-node-pattern branch, even when flag is a Boolean variable introduced by WITH.
The resulting PatternPredicateExpression returns false for a pattern containing no relationships.
See PatternPredicateExpression.java, lines 76–83.
This explains the observed silent row filtering. The precise execution path has not been instrumented, but the source behavior is consistent with the reproduction.
Relationship to #8994
This appears to be a remaining case from #8994, which reported that parenthesized Boolean literals such as WHERE (true) were incorrectly treated as node patterns.
PR #9158 fixed that issue by distinguishing the Boolean and null keywords from ordinary identifiers.
However, a Boolean variable such as (flag) still takes the problematic identifier path in the tested latest snapshot.
The earlier fix covers parenthesized literals, while this report demonstrates that parenthesized Boolean variables remain affected.
Impact
Queries using computed or aliased Boolean predicates can silently return no rows when a redundant pair of parentheses is added.
For example, a predicate computed by WITH can produce different results solely because it is written as WHERE (result) rather than WHERE result.
Since the query succeeds without an error, applications may interpret the empty result as a legitimate absence of matching data.
Workaround: Remove the parentheses around the Boolean variable in the WHERE clause.
Activity
review(#9542,#9573): labelled single node stays a pattern, comments o…
review(#9542): decode doubled backticks in a parenthesized variable name
review(#9542,#9573): id() null only for lightweight edges, single-tri…
Merge pull request #9588 from ArcadeData/worktree-arcadedb-9542-9573-…
lvca commentedon Oct 9, 2026
Fixed in #9588 (26.11.1).
WHERE (flag)was always read as a node pattern, so it dropped every row. A parenthesized variable is now treated as a value: a Boolean works likeWHERE flag, null is unknown, and anything that is not a Boolean (for example a node or a number) raises anInvalidArgumentTypeerror instead of silently returning nothing.❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.
fix(ArcadeData#9542,ArcadeData#9573): parenthesized Boolean variable …
fix(#9542,#9573): parenthesized Boolean variable in WHERE is not a no…
review(#9542,#9573): labelled single node stays a pattern, comments o…
review(#9542): decode doubled backticks in a parenthesized variable name
review(#9542,#9573): id() null only for lightweight edges, single-tri…