Skip to content

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

Merged
lvca merged 7 commits into
mainfrom
fix/10710-10753-10721-10758
Oct 27, 2026
Merged

lvca merged 7 commits into
mainfrom
fix/10710-10753-10721-10758

Conversation

@lvca

@lvca lvca commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Fixes #10710 (with #10697, #10696), #10753, #10721, #10758.

#10710 - SQL min()/max(), DISTINCT and GROUP BY follow the order and the equality of =

#10753 - GraphQL where is one operand of the AND

Every 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 the sqlscript engine refuse, before the statement runs, a call whose positional values do not match the placeholders (CommandSQLParsingException with both counts). Each ? and positionally-bound :name takes exactly one value (null included); a script counts across its statements; a Postgres-style $N may leave lower positions unread, as Postgres does. The count is a one-time walk of the parsed tree memoized on the cached Statement. Named (Map) bindings are not counted. HTTP params arrays 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 what vals CONTAINS :binary found, because the unwrapped item went through Collection.contains (identity for byte[], Integer vs stored Long); it now falls back to =.

Tests

  • Issue10710MinMaxAndGroupingKeyTest: census over every com.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).
  • Engine module suite (23944 tests), network, server, console, graphql, postgresw unit tests, HTTP parameter ITs.

Docs: arcadedb-docs commits d0b52999 and bc6052d6 (not pushed).

Release notes

…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 "=".
@lvca lvca added this to the 26.11.1 milestone Oct 27, 2026
@lvca lvca self-assigned this Oct 27, 2026
@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f469a3b8-05c4-4212-80e5-ae81c646d898
Commits

Reviewing files that changed from the base of the PR and between 491dfa9 and 7df4cf5.

Files selected for processing: 19
  • engine/src/main/java/com/arcadedb/function/sql/SQLFunctionAbstract.java
  • engine/src/main/java/com/arcadedb/function/sql/math/SQLFunctionMax.java
  • engine/src/main/java/com/arcadedb/function/sql/math/SQLFunctionMin.java
  • engine/src/main/java/com/arcadedb/query/sql/SQLQueryEngine.java
  • engine/src/main/java/com/arcadedb/query/sql/SQLScriptQueryEngine.java
  • engine/src/main/java/com/arcadedb/query/sql/executor/SelectExecutionPlanner.java
  • engine/src/main/java/com/arcadedb/query/sql/parser/ContainsAnyCondition.java
  • engine/src/main/java/com/arcadedb/query/sql/parser/ContainsCondition.java
  • engine/src/main/java/com/arcadedb/query/sql/parser/InCondition.java
  • engine/src/main/java/com/arcadedb/query/sql/parser/Statement.java
  • engine/src/main/java/com/arcadedb/schema/Type.java
  • engine/src/main/java/com/arcadedb/serializer/BinaryComparator.java
  • engine/src/test/java/com/arcadedb/index/fulltext/LSMTreeFullTextIndexTest.java
  • engine/src/test/java/com/arcadedb/query/Issue9021IntegralIndexInexactBoundTest.java
  • engine/src/test/java/com/arcadedb/query/sql/executor/Issue10710MinMaxAndGroupingKeyTest.java
  • engine/src/test/java/com/arcadedb/query/sql/executor/Issue10721PositionalParameterCountTest.java
  • engine/src/test/java/com/arcadedb/query/sql/parser/Issue10758ContainsBinaryOperandTest.java
  • graphql/src/main/java/com/arcadedb/graphql/schema/GraphQLSchema.java
  • graphql/src/test/java/com/arcadedb/graphql/Issue10753WherePrecedenceTest.java
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mergify

mergify Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

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.

@claude

claude Bot commented Oct 27, 2026

Copy link
Copy Markdown

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:

  1. GraphQL where (GraphQL interpolates the free-form where argument into the SQL clause without parentheses, so an or inside it cancels the other arguments: a query filtered on name returns rows with a different name #10753): a trailing '--' comment would swallow the wrapper's closing paren. That gives a parse error, not an injection, but a test would pin it.
  2. SQL: positional parameters are never counted, so a second value for one ? is dropped without a word and a missing value binds null (WHERE @rid IN ? with Object[]{a, b} returns one row) #10721 count check is a breaking change for embedders passing extra or missing positional values (two existing tests needed fixing). It deserves a release-notes line, plus a test that a $N statement with a gap is accepted and too few values are refused.
  3. positionalParameterBounds packs required<<32|accepted, which is safe only while both are non-negative. Integer.parseInt on a huge $N key could throw NumberFormatException (a 500); consider returning BOUNDS_UNKNOWN.
  4. isSameKind vs BinaryComparator must agree on what counts as one kind. Number and DateUtils.isDate are broad. If the comparator falls back to class-name order for a pair that passes the check, min/max silently order by class name instead of refusing. The census covers each Type but not mixed representations within one kind.
  5. compareSequences has fast paths only for int/long/short. double[]/float[] box each element. Confirm the NaN and -0.0 ordering of Arrays.compare vs Double.compareTo is intended. list.get(i) is O(n) on a LinkedList.
  6. Type.normalizeForKey now calls TemporalUtil.distinctKey for every non-collection value in DISTINCT/GROUP BY. Please confirm it short-circuits cheaply for String/Number/RID, or add an instanceof pre-check like needsTemporalKey.
  7. ContainsCondition.containsValue: the new scalar fallback runs QueryOperatorEquals.equals over the whole collection on every miss, so CONTAINS misses on large lists are now O(n). Probably acceptable, but it is a perf cost.

Style and tests follow CLAUDE.md (assertThat, no wall-clock asserts, no hardcoded ports). Remaining gaps are the negative cases above.

@codacy-production

codacy-production Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 44 complexity

Metric Results
Complexity 44

View in Codacy

🟢 Coverage 96.88% diff coverage

Metric Results
Coverage variation Report missing for 491dfa91
Diff coverage ✅ 96.88% diff coverage

View coverage diff in Codacy

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.

…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
@claude

claude Bot commented Oct 27, 2026

Copy link
Copy Markdown

Review

Overall this is solid and well tested. The census-style tests (every Type, every containment condition found by reflection) are a good pattern. I found no security hazard, so I'm not adding the do-not-merge label. Notes:

Behaviour change to flag (#10721)

  • checkPositionalParameterCount now throws on any mismatch, for both too few and too many values. This is the right fix, but it is a breaking change for callers who pass extra or missing parameters (two existing tests had to be corrected). It deserves a release-note line, and the HTTP params and remote client paths should be called out as affected.
  • The first branch of positionalParameterBounds reads paramNumber on PositionalParameter and NamedParameter. The comment says NamedParameter can be -1 for extracted literals. Please add a test showing that a cached or literal-extracted statement does not inflate the required count, for example the same query run twice with different literals.
  • The memo field is volatile and recomputed benignly on a race. That is fine since the tree is immutable.

GraphQL where (#10753)

  • Parsing the predicate as a full condition (whereClause EOF) and then wrapping it in parentheses is the right defence. Please confirm there is a test where the predicate contains a SQL comment (pages > 1 -- or /* ... */) and that it either fails to parse or is neutralised once wrapped. A trailing line comment could otherwise swallow the closing ) or the following and terms.
  • new SQLAntlrParser(database) is built per where argument. This is cheap enough, but it is on a request path, so it is worth confirming it does no schema work.

Comparison (#10697)

  • isSameKind runs on every aggregate row. DateUtils.isDate is a chain of instanceof checks, so it should be OK. The first check, left.getClass() == right.getClass(), short-circuits the common case.
  • In BinaryComparator.compareSequences, the Array.get reflection path boxes each element. It is only used for non-int, non-long, non-short arrays (float, double and so on), so it is acceptable. A double[] fast path would be easy to add if ORDER BY on those columns is hot.
  • In compareSequences, list.get(i) is O(n) on a LinkedList. Use an iterator if non-ArrayList lists can reach this path.

Style (CLAUDE.md)

  • SQLFunctionAbstract and Type follow the existing style. In Statement, the if/else if/else branch inside the lambda mixes the two parameter kinds in a way that is a little hard to follow. Consider extracting a small helper.

Docs

  • The PR says the docs commits are not pushed. Please make sure they land before or with this merge.

Nothing blocking from my side beyond confirming the comment-injection test and a note about the stricter parameter count.

…ead once, the parameter count helper names its two kinds, literal-extraction and block-comment cases pinned
@claude

claude Bot commented Oct 27, 2026

Copy link
Copy Markdown

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

  1. Behaviour change in checkPositionalParameterCount. It now throws CommandSQLParsingException when a caller passes more or fewer positional values than the statement has placeholders. This is the right fix for SQL: positional parameters are never counted, so a second value for one ? is dropped without a word and a missing value binds null (WHERE @rid IN ? with Object[]{a, b} returns one row) #10721. It will also break existing callers that pass extra or unused parameters, including HTTP/driver clients and the other wire protocol modules (postgresw, bolt, gremlin, graphql) that call query/command with positional arrays. Please run those modules' tests, not just engine. A release-note line would also help.
  2. Integer.parseInt in dollarParameterNumber. An identifier like $99999999999 would throw NumberFormatException in the planner path, assuming positionalParameterKey() does not already bound the digits. Please confirm it does, or catch the exception and return BOUNDS_UNKNOWN. A huge $N also makes accepted very large, which turns the upper bound check off.
  3. compareValues. isSameKind plus the Identifiable special case duplicates part of what BinaryComparator already knows about kinds. This is fine for now. If the comparator's kind rules change, the two will drift, so a short comment tying them together would help.
  4. Overlap with existing helpers. The 32-bit packing of required and accepted into one long works but is hard to read. A tiny record or two volatile ints would be clearer, and the cost is negligible.
  5. Tests. Issue9021IntegralIndexInexactBoundTest and LSMTreeFullTextIndexTest were modified. Please confirm that was only to adapt them to the stricter parameter count. If so, it is a sign that this check affects other callers (see point 1).

Overall this looks solid, pending point 1 and the NumberFormatException check in point 2.

…ble tree accepts any count, the kinds check names the comparator it follows
@claude

claude Bot commented Oct 27, 2026

Copy link
Copy Markdown

Review

I 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

  1. Behaviour change in SQL: positional parameters are never counted, so a second value for one ? is dropped without a word and a missing value binds null (WHERE @rid IN ? with Object[]{a, b} returns one row) #10721 (the largest risk):
    • checkPositionalParameterCount now throws CommandSQLParsingException for any call with extra or missing positional values. Code that passes surplus args, or relies on a missing arg binding to null, will start failing at runtime.
    • It reaches the HTTP params array and the remote client, so it is user-visible. I'd call it out in the release notes.
    • Please confirm the existing suites that pass positional args still pass: server HTTP tests, the postgresw $N tests, remote/JDBC-style callers, and the sqlscript tests.
    • A test for statement-cache literal extraction combined with positional params would also be worth having. The code handles paramNumber == -1, but a test would pin it down.
  2. Type.normalizeForKey (hot path for GROUP BY and DISTINCT):
    • needsTemporalKey runs up to 8 failed instanceof checks for every non-number value, including every String key.
    • Consider a cheap early exit for String and Boolean, or checking value instanceof Temporal || Date || Calendar || ... in order of likelihood.
    • holdsOnlyPlainValues now also calls it per element. This is minor, but CLAUDE.md asks for care on performance.
  3. compareSequences: the non-primitive path calls Array.get and compareTo per element, which boxes. That is fine for correctness. A mixed int[] vs long[] pair also goes through that boxed path. Is that intended?
  4. isSameKind: the Javadoc says it must be kept in step with BinaryComparator. That coupling is easy to break. A small test asserting that each kind BinaryComparator relates has a matching isSameKind arm would help.
  5. Style nit: SQLFunctionMax and SQLFunctionMin add the MultiValue import out of order, after CommandContext. This is cosmetic only.
  6. Scope: the PR bundles four unrelated fixes ([engine] SQL min()/max() and DISTINCT/GROUP BY must compare BINARY, array, map and temporal values the way = #10710, GraphQL interpolates the free-form where argument into the SQL clause without parentheses, so an or inside it cancels the other arguments: a query filtered on name returns rows with a different name #10753, SQL: positional parameters are never counted, so a second value for one ? is dropped without a word and a missing value binds null (WHERE @rid IN ? with Object[]{a, b} returns one row) #10721, CONTAINSALL expands a byte[] right-hand operand into its bytes, so a BINARY value is not found where CONTAINS and CONTAINSANY find it #10758) into one change. Separate PRs would be easier to review and to revert.

Overall this is solid work. The main thing to verify is the fallout from the stricter positional-parameter check.

@claude

claude Bot commented Oct 27, 2026

Copy link
Copy Markdown

Review

Author 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

  • The GraphQL where fix is sound. Each term is parenthesised, and the predicate must first parse as a complete condition (parseCondition, whereClause EOF). That closes the a > 1) or (1 = 1 balancing trick, and a trailing ORDER BY/LIMIT is refused. Putting the closing ) on its own line so a -- comment can't swallow it is a nice touch. The existing BOUND_PARAMETER_PREFIX guard is kept.
  • Using BinaryComparator.compareTo for min()/max() means one ordering across ORDER BY, indexes and aggregates. isSameKind keeps the "different kinds are refused" behaviour from Several SQL collection/string/misc functions throw raw runtime exceptions on valid input (missing null-guards / unchecked casts) #6389.
  • The positional-count check is memoized on the parsed Statement, so the hot path pays only an integer comparison. The UNKNOWN_BOUNDS fail-open is a sensible default.
  • The tests are broad: a census over every Type, reflection over the containment conditions, and the openCypher comparison probe.

Points to consider

  1. Behaviour change (SQL: positional parameters are never counted, so a second value for one ? is dropped without a word and a missing value binds null (WHERE @rid IN ? with Object[]{a, b} returns one row) #10721). Passing too many or too few positional values is now a hard error. It is documented in the release notes, but external callers that pass stray values will break on upgrade. Two existing tests needed edits for exactly this. It may deserve a prominent note in the changelog or upgrade guide.
  2. Performance in BinaryComparator.compareSequences. The generic path uses Array.get per element (boxing, reflective). The primitive fast paths cover only int[], long[] and short[]. double[] and float[] are the likely vector or embedding column types in ArcadeDB, and they take the slow path. Arrays.compare also exists for double[], float[] and byte[], but its NaN and -0.0 semantics differ from compareTo(Double, Double), so check that before adding them.
  3. Type.normalizeForKey. needsTemporalKey is evaluated per value on DISTINCT and GROUP BY paths. It is a chain of instanceof checks, which is cheap. A short note on its cost on the non-temporal path would still help future readers, since holdsOnlyPlainValues now gets a String shortcut for that reason.
  4. ContainsCondition.containsValue. The new scalar fallback runs QueryOperatorEquals.equals over every element when Collection.contains misses. That is O(n) with a non-trivial equals on each miss, for every CONTAINS on a large list. This is correct, but a cheap pre-filter (for example only when value is a byte[] or Number) would avoid the extra scan for strings, where contains is already exact.
  5. SQLFunctionAbstract.compareValues. isSameKind must stay in step with BinaryComparator.compareTo, and the comment says so. A test that enumerates the pairs compareTo orders by class name, and asserts isSameKind rejects them, would stop the two drifting apart.
  6. Style. Statement uses counts[0]/counts[1] array indexing inside the lambda. Two small named fields or a tiny holder record would read better. MultiValue and the other imports look fine and follow the fully-qualified-name rule.

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
@claude

claude Bot commented Oct 27, 2026

Copy link
Copy Markdown

Review

Well-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)

  • checkPositionalParameterCount now throws CommandSQLParsingException on any count mismatch for query/command and sqlscript. Callers that passed extra or too few values used to succeed silently. The PR already fixes a few existing tests (LSMTreeFullTextIndexTest, Issue9021...), so other callers may break. Please check the other modules (server HTTP handlers, remote client, console, importers, gremlin/postgresw/bolt/mongodbw paths forwarding params to SQL) and run their tests. It should be called out in the release notes as a breaking change.
  • The count relies on SqlAstInspector.allNodesMatch visiting every node. Is there a test with a placeholder inside a subquery, a function argument and a LET, so a missed node type would show up?

GraphQL where (#10753, security-relevant)

  • Parsing the predicate standalone and then wrapping it in parentheses is a good approach. Please add a test for a predicate ending in a line comment (if the grammar supports // or --), e.g. a > 1 //: it parses alone, but once wrapped the comment could swallow the closing ). Also test a block comment.

Comparators / keys (#10697, #10696)

  • BinaryComparator.compareSequences boxes via Array.get and repeats instanceof checks per element. Correct, but could be hoisted. Not a blocker.
  • isSameKind in SQLFunctionAbstract must be kept in step with BinaryComparator.compareTo by hand. A test over pair kinds would guard against drift.
  • Type.normalizeForKey now runs a chain of instanceof checks on every non-array value on the DISTINCT/GROUP BY path. Cheap, but a measurement would be reassuring.

Style

  • Follows the CLAUDE.md conventions. The new MultiValue import in SQLFunctionMax/Min is out of alphabetical order (minor).

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.

@claude

claude Bot commented Oct 27, 2026

Copy link
Copy Markdown

Review

I 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

  • The GraphQL where handling is sound. It parses the predicate as a complete condition first (whereClause EOF) and only then wraps it in parentheses. That closes the a > 1) or (1 = 1 balancing trick and the trailing ORDER BY / LIMIT smuggling. The $-prefixed bound-parameter reservation check still runs before the parse.
  • The positional-count check is memoized per cached Statement and falls back to UNKNOWN_BOUNDS when the tree is unreadable, so the cost is low.
  • normalizeForKey has a fast path: String and the other self-keyed types skip the temporal lookup.
  • compareSequences avoids boxing for int[], long[] and short[], and reads a LinkedList into an array once instead of indexing it.

Points to consider

  1. Positional-count check is a breaking change (SQL: positional parameters are never counted, so a second value for one ? is dropped without a word and a missing value binds null (WHERE @rid IN ? with Object[]{a, b} returns one row) #10721). Callers that pass extra positional values were silently tolerated before. Now they get CommandSQLParsingException, through the embedded API, HTTP params arrays and the remote client. You changed LSMTreeFullTextIndexTest and Issue9021IntegralIndexInexactBoundTest for this, which shows the pattern exists in the wild. I suggest a release-note entry, and a quick grep of the other modules (server, postgresw, bolt, grpcw, studio, e2e tests) for calls with surplus arguments. A full run of those modules would catch stragglers.
  2. Mixed ? and $N counting. accepted = max(counts[0], counts[1]) is a loose upper bound when both styles are mixed in one statement. That is fine as a tolerance, but a test for the mixed case would pin the behavior down.
  3. SQLFunctionAbstract.isSameKind is coupled to BinaryComparator.compareTo. The Javadoc says the two must stay in step, but nothing enforces it. A small test that walks the pairs isSameKind accepts and checks that the comparator does not fall to class-name ordering would guard against drift.
  4. SQLFunctionAbstract.compareValues catch block. It catches IllegalArgumentException from the comparator and rewraps it with a "type has no order" message. That can hide a genuine comparator bug, since the original is only kept as the cause. This is minor.
  5. Statement.sequentialParameterNumber. The comment says NamedParameter returns -1 for extracted literals, but the code returns parameter.paramNumber unconditionally. Please confirm that paramNumber is -1 in that case, since the count depends on it.
  6. Test conventions. Check that the new tests use assertThat(...) style, that the ones relying on a server use the fixture port helpers, and that nothing asserts on raw elapsed time.

Overall the changes look correct and well documented. Point 1 is the one that deserves attention before merge.

@codecov

codecov Bot commented Oct 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 67.18750% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.98%. Comparing base (d37fed8) to head (7df4cf5).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...java/com/arcadedb/serializer/BinaryComparator.java 57.14% 0 Missing and 9 partials ⚠️
...com/arcadedb/function/sql/SQLFunctionAbstract.java 63.63% 0 Missing and 4 partials ⚠️
engine/src/main/java/com/arcadedb/schema/Type.java 50.00% 0 Missing and 3 partials ⚠️
...a/com/arcadedb/query/sql/SQLScriptQueryEngine.java 0.00% 1 Missing and 1 partial ⚠️
...edb/query/sql/executor/SelectExecutionPlanner.java 60.00% 1 Missing and 1 partial ⚠️
...in/java/com/arcadedb/query/sql/SQLQueryEngine.java 50.00% 0 Missing and 1 partial ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@lvca
lvca merged commit f8ae3a8 into main Oct 27, 2026
33 of 36 checks passed
@lvca
lvca deleted the fix/10710-10753-10721-10758 branch October 27, 2026 20:10
tae898 added a commit to ArcadeData/arcadedb-python that referenced this pull request Oct 27, 2026
…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>
robfrank pushed a commit that referenced this pull request Nov 5, 2026
…"=", 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[engine] SQL min()/max() and DISTINCT/GROUP BY must compare BINARY, array, map and temporal values the way =

1 participant