Repository navigation
fix(#10710, #10753, #10721, #10758): SQL min/max and grouping follow "=", GraphQL where is one operand, positional values are counted, CONTAINSALL reads BINARY as one value - #10798
Conversation
…the order and equality of "=", a GraphQL where predicate is one operand, positional values are counted, CONTAINSALL reads a BINARY operand as one value - #10710 (#10697, #10696): SQL min()/max() order with BinaryComparator.compareTo (BINARY by unsigned bytes, MAP by entries, two representations of one instant by that instant) instead of a raw Comparable cast that threw over two rows; values of different kinds and embedded documents are still refused with a message naming the type. An ARRAY_OF_* argument is the set of its elements, as a LIST is. ORDER BY orders ARRAY_OF_* values element by element. DISTINCT, GROUP BY and count(DISTINCT) key a temporal as "=" and openCypher's grouping read it. - #10753: the GraphQL where predicate must parse as a complete SQL condition and every term of the generated clause is a parenthesised operand of the AND, so an OR inside it no longer drops the other arguments. - #10721: positional values are counted against the placeholders of the statement (a script across its statements) and a surplus or missing value is refused before it runs. A Java array bound to IN ? is read as its elements on the RID fetch and on a scan. - #10758: CONTAINSALL (and CONTAINS/CONTAINSANY through MultiValue.isSequenceArray) read a byte[] right-hand operand as one value; CONTAINS [x] compares x under "=".
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 9 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
|
Review of #10798: well-scoped fixes with strong regression tests (type census, reflective census of containment conditions, openCypher cross-check). No security hazards found; the GraphQL where change tightens an existing injection surface. No blockers. Notes:
Style and tests follow CLAUDE.md (assertThat, no wall-clock asserts, no hardcoded ports). Remaining gaps are the negative cases above. |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 44 |
🟢 Coverage 96.88% diff coverage
Metric Results Coverage variation Report missing for 491dfa91 Diff coverage ✅ 96.88% diff coverage Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (491dfa9) Report Missing Report Missing Report Missing Head commit (7df4cf5) 284025 233488 82.21% Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#10798) 64 62 96.88% Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%1 Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
ReviewOverall this is solid and well tested. The census-style tests (every Behaviour change to flag (#10721)
GraphQL where (#10753)
Comparison (#10697)
Style (CLAUDE.md)
Docs
Nothing blocking from my side beyond confirming the comment-injection test and a note about the stricter parameter count. |
|
Review of #10798. I read the diff and did not run the build or tests. Nothing here looks like a security hazard, so I did not add the label. What looks good
Points to check
Overall this looks solid, pending point 1 and the |
ReviewI read the diff and did not build or run the tests. No security hazard found, so I did not add the label. What looks good
Points to consider
Overall this is solid work. The main thing to verify is the fallout from the stricter positional-parameter check. |
ReviewAuthor is a maintainer and I found no security hazards, so I'm not adding the label. I read the diff and did not run the build or tests here. What looks good
Points to consider
Overall this is well scoped and well tested. The points above are optional polish, apart from the upgrade note in point 1. |
…-10758 # Conflicts: # engine/src/main/java/com/arcadedb/query/sql/parser/ContainsAllCondition.java # engine/src/main/java/com/arcadedb/query/sql/parser/ContainsCondition.java # engine/src/main/java/com/arcadedb/serializer/BinaryComparator.java
ReviewWell-documented PR with extensive tests. I read the engine and GraphQL main-code changes; I did not run the build or tests. Points to check: Behaviour change (#10721, most important)
GraphQL
Comparators / keys (#10697, #10696)
Style
No security hazards found, so I did not add the do-not-merge label. Main ask: verify that the stricter parameter-count check does not break callers in other modules. |
…on and a nested sub-query is counted
ReviewI read the engine and GraphQL parts of the diff. The large test portion was cut off in my view, so I did not read it all. I found no security hazard. The PR is from a maintainer, and the GraphQL change tightens validation. Good
Points to consider
Overall the changes look correct and well documented. Point 1 is the one that deserves attention before merge. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #10798 +/- ##
============================================
+ Coverage 78.97% 78.98% +0.01%
- Complexity 4768 4770 +2
============================================
Files 2299 2299
Lines 251208 251324 +116
Branches 54790 54835 +45
============================================
+ Hits 198389 198508 +119
+ Misses 32597 32569 -28
- Partials 20222 20247 +25 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…al values (#109) The parameters section and two docstrings said the engine binds the first of two values for one ?, drops the second and binds null for a missing value. That held up to 26.10.x; ArcadeData/arcadedb#10798 (26.11.1) refuses both too many and too few values with an error naming both counts (verified on f8ae3a8e7f: ArcadeData/arcadedb#10721). The bindings' TypeError check stays: it fails earlier, names the fix and covers builds on an older engine. Closes #108 Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…"=", GraphQL where is one operand, positional values are counted, CONTAINSALL reads BINARY as one value (#10798) * fix(#10710, #10753, #10721, #10758): SQL min/max and grouping follow the order and equality of "=", a GraphQL where predicate is one operand, positional values are counted, CONTAINSALL reads a BINARY operand as one value - #10710 (#10697, #10696): SQL min()/max() order with BinaryComparator.compareTo (BINARY by unsigned bytes, MAP by entries, two representations of one instant by that instant) instead of a raw Comparable cast that threw over two rows; values of different kinds and embedded documents are still refused with a message naming the type. An ARRAY_OF_* argument is the set of its elements, as a LIST is. ORDER BY orders ARRAY_OF_* values element by element. DISTINCT, GROUP BY and count(DISTINCT) key a temporal as "=" and openCypher's grouping read it. - #10753: the GraphQL where predicate must parse as a complete SQL condition and every term of the generated clause is a parenthesised operand of the AND, so an OR inside it no longer drops the other arguments. - #10721: positional values are counted against the placeholders of the statement (a script across its statements) and a surplus or missing value is refused before it runs. A Java array bound to IN ? is read as its elements on the RID fetch and on a scan. - #10758: CONTAINSALL (and CONTAINS/CONTAINSANY through MultiValue.isSequenceArray) read a byte[] right-hand operand as one value; CONTAINS [x] compares x under "=". * review(#10710, #10753, #10721): min/max order a record against a RID by identity, a grouping key pays the temporal lookup only for the classes that need it, a GraphQL where predicate may end in a line comment, $N gap and refusal cases pinned * review(#10710, #10753, #10721): a sequence without random access is read once, the parameter count helper names its two kinds, literal-extraction and block-comment cases pinned * review(#10721, #10710): the parameter bounds are a record, an unreadable tree accepts any count, the kinds check names the comparator it follows * review(#10710): a String element of a grouping key skips the kind checks * test(#10721): a placeholder in a function argument, a LET, a projection and a nested sub-query is counted (cherry picked from commit f8ae3a8)
Fixes #10710 (with #10697, #10696), #10753, #10721, #10758.
#10710 - SQL min()/max(), DISTINCT and GROUP BY follow the order and the equality of
=SQLFunctionAbstract.compareValuesnow orders withBinaryComparator.compareTo, the comparator behind ORDER BY, the index keys and the comparison operators: a BINARY column orders by unsigned bytes, a MAP by its entries, two Java representations of one instant by that instant. Before, a rawComparablecast threwcannot compare a value of type byte[] with a value of type byte[]as soon as two rows reached the aggregate. Values of genuinely different kinds (max([1, 'a']), Several SQL collection/string/misc functions throw raw runtime exceptions on valid input (missing null-guards / unchecked casts) #6389) are still refused; an embedded document is refused with a message that names the type once.min()/max()keep their documented collection rule (a collection argument is the set of its elements) and now apply it toARRAY_OF_*as to LIST; abyte[]stays the BINARY scalar.BinaryComparator.compareToordersARRAY_OF_*values (and an array against a list) element by element, as openCypher does (openCypher DISTINCT, GROUP BY, min() and max() still key a BINARY or ARRAY_OF_* value by array identity, so two values the same statement reports equal land in two groups and min()/max() return the first row #10380): ORDER BY on such a column used to order by the text of the arrays' identity.Type.normalizeForKey(DISTINCT, GROUP BY, count(DISTINCT), streaming aggregation) keys a temporal throughTemporalUtil.distinctKey, the rule openCypher's grouping already uses (openCypher DISTINCT, GROUP BY and UNION key a temporal value by its Java representation, so a stored DATETIME and datetime() that '=' reports equal land in two groups #10526): a zone-less instant joins the ZonedDateTime of that instant in UTC, a zoned value keeps its zone. SQL now answers the same groups openCypher does on the seven-way probe of the report.set()keeps Java set semantics (it is a collection, not a grouping key), as it already does for numbers.#10753 - GraphQL
whereis one operand of the ANDEvery term of the generated clause is a parenthesised operand, so
books(name: "Target", where: "pages > 100 or pages < 10")answers only Target rows in either argument order. Better than the suggested bare wrap: parentheses alone can be balanced away by a predicate that closes and reopens them (a > 1) or (1 = 1), so the predicate must first parse as a complete SQL condition on its own (SQLAntlrParser.parseCondition,whereClause EOF), which also refuses a trailing ORDER BY / LIMIT smuggled into it.#10721 - positional values are counted
SQLQueryEngine.query/command(Object...)and thesqlscriptengine refuse, before the statement runs, a call whose positional values do not match the placeholders (CommandSQLParsingExceptionwith both counts). Each?and positionally-bound:nametakes exactly one value (null included); a script counts across its statements; a Postgres-style$Nmay leave lower positions unread, as Postgres does. The count is a one-time walk of the parsed tree memoized on the cachedStatement. Named (Map) bindings are not counted. HTTPparamsarrays and the remote client reach the same check.Found while testing it: a Java array bound to
IN ?(RID[],int[]) answered no row on the@rid IN ?fetch and threw a ClassCastException on a scan of a primitive array; both read it as its elements now. Two existing tests passed a value to statements with no placeholder and were corrected.#10758 - CONTAINSALL reads a BINARY operand as one value
All three containment conditions decide "sequence or one value" on the right-hand side through
MultiValue.isSequenceArray. Also fixed:vals CONTAINS [:binary](one-element list) missed whatvals CONTAINS :binaryfound, because the unwrapped item went throughCollection.contains(identity forbyte[],Integervs storedLong); it now falls back to=.Tests
Issue10710MinMaxAndGroupingKeyTest: census over everycom.arcadedb.schema.Type(min/max agree with ORDER BY ... LIMIT 1; a new type without a case fails the test), the report repros, the seven-way temporal probe compared with openCypher.Issue10753WherePrecedenceTest,Issue10721PositionalParameterCountTest,Issue10758ContainsBinaryOperandTest(census of the containment conditions enumerated from the parser package by reflection).Docs: arcadedb-docs commits d0b52999 and bc6052d6 (not pushed).
Release notes
?is dropped without a word and a missing value binds null (WHERE @rid IN ?withObject[]{a, b}returns one row) #10721): SQL calls with positional parameters (query/command("sql"|"sqlscript", text, Object...), HTTPparamsas a JSON array or a"0"-keyed object, the remote Java client) now fail withCommandSQLParsingException/ HTTP 400 when the number of values does not match the placeholders. Pass exactly one value per?(null included) and a list meant forIN ?as one value.min()/max()work on BINARY, MAP, and mixed temporal columns;ARRAY_OF_*arguments are read as their elements, as LIST is. SQL DISTINCT/GROUP BY treat one instant stored as DATETIME and as ZONED_DATETIME (UTC) as one group.whereis one operand of the generated AND and must be a complete SQL condition.CONTAINSALLwith a BINARY right operand matches it as one value.