Skip to content

#3738 fix: seal JavaCC SQL parser escape hatches — ANTLR is always used now - #3756

Merged
robfrank merged 20 commits into
mainfrom
fix/seal-javacc-escape-hatches
Mar 31, 2026
Merged

robfrank merged 20 commits into
mainfrom
fix/seal-javacc-escape-hatches

Conversation

@robfrank

Copy link
Copy Markdown
Collaborator

Summary

  • Removes all live call sites of SqlParser (JavaCC) from production code and tests — grep -r "new SqlParser(" returns zero results
  • StatementCache now always calls SQLAntlrParser, parseWithJavaCC() removed
  • SQLScriptQueryEngine.parseScript() JavaCC branch removed
  • GlobalConfiguration.SQL_PARSER_IMPLEMENTATION marked deprecated (no effect — ANTLR is always used)
  • AbstractProperty.getDefaultValue() and SQLFunctionEval.execute() migrated to SQLAntlrParser
  • All 11 parser test files migrated from SqlParser to SQLAntlrParser (via AbstractParserTest refactor)
  • Multiple ANTLR grammar/AST gaps fixed that were previously hidden by JavaCC-based tests:
    • matchFilterItemKey restricted to valid keys only
    • Named parameter :from (reserved keyword) now supported
    • CREATE INDEX grammar for named vs unnamed forms
    • UNWIND with multiple items, TIMEOUT with EXCEPTION/RETURN
    • Array selectors: range, IN, NOT IN
    • RID_STRING as base expression
    • UpdatePutItem, InCondition, Timeout, UpdateOperations, UpdateIncrementItem, CreateIndexStatement AST fixes

Test plan

  • grep -r "new SqlParser(" engine/src/main/java/ engine/src/test/java/ → zero results
  • mvn test -Dtest="*ParserTest*,*StatementTest*,*ScriptTest*" → 272 tests, 0 failures
  • Full engine test suite passes

🤖 Generated with Claude Code

@claude

claude Bot commented Mar 29, 2026

Copy link
Copy Markdown

Code Review

This is a solid, well-scoped cleanup that resolves the concrete bug from #3738 (parser tests silently testing the wrong parser). The core migration is correct and the grammar/AST fixes are legitimate gap-fills. A few items worth discussing:


Issues to address before merging

1. Overly broad exception catch in AbstractProperty.getDefaultValue()

// Before (precise)
} catch (ParseException e) {
  // IGNORE IT

// After (too broad)
} catch (Exception e) {
  // IGNORE IT

catch (Exception e) swallows everything including NullPointerException, ClassCastException, etc. — bugs that should be visible. Consider catch (CommandSQLParsingException e) (what ANTLR throws) instead. If you want to also guard against unexpected runtime errors, at minimum log at DEBUG level.


2. UpdatePutItem access widening: protected → public

-  protected Identifier left;
-  protected Expression key;
-  protected Expression value;
+  public Identifier left;
+  public Expression key;
+  public Expression value;

Widening access modifiers is a red flag — it enlarges the public API surface. If the ANTLR AST builder needs to set these, a package-private accessor or a constructor that accepts the fields would be preferable. What's the motivation for making them public?


3. Duplicate createIndexBody grammar alternatives

| identifier (IF NOT EXISTS)? indexType
  (METADATA json)?
  (ENGINE identifier)?
| identifier (IF NOT EXISTS)? indexType
  (ENGINE identifier)?
  (METADATA json)?

These two alternatives exist only to allow ENGINE and METADATA in either order. ANTLR supports optional clauses in any combinator — consider something like:

| identifier (IF NOT EXISTS)? indexType
  ( (METADATA json) | (ENGINE identifier) )*

The duplicate alternatives will cause ambiguity warnings and are harder to maintain.


4. SQL_PARSER_IMPLEMENTATION silently ignored at runtime

Users who have arcadedb.sql.parserImplementation=javacc in their config will get no feedback that the setting has no effect. A one-time LogManager.instance().log(...) warning when a non-default value is detected (in GlobalConfiguration or StatementCache) would help operators discover the dead setting.


Minor observations

5. Plan files committed to docs/plans/

docs/plans/2026-03-28-seal-javacc-escape-hatches.md (624 lines) is an internal implementation plan — it even contains a local machine path (/Users/frank/projects/arcade/worktrees/...). The design document (-design.md) is fine as a record of the architectural decision, but the task-by-task execution plan is more of a working note than repository documentation worth preserving.

6. Unused import added to SQLASTBuilder.java

+import org.antlr.v4.runtime.ParserRuleContext;

This import was added but ParserRuleContext does not appear to be used in the shown diff. Confirm it's actually referenced, or remove it.


What's good

  • The InCondition.toString() fix (not ? " NOT IN " : " IN ") is a genuine serialization bug — good catch.
  • The checkRightSyntax roundtrip (parse → toString() → re-parse) in AbstractParserTest is a smart regression guard, and the SubqueryExpression/StatementExpression toString() overrides are necessary to make it work.
  • Restricting matchFilterItemKey to an explicit keyword list (removing the open identifier fallback) is the right call — the old rule accepted any identifier as a filter key, hiding typos silently.
  • The commitStatement grammar fix properly handles the ELSE-branch structure.
  • Removing throwParsingException(TokenMgrError, ...) is correct — TokenMgrError is JavaCC-specific dead code now.
  • SQLScriptQueryEngine.parseScript() simplification is clean.

Overall this is good work. The catch (Exception e) in AbstractProperty and the UpdatePutItem access widening are the two items I'd want resolved before merging.

🤖 Generated with Claude Code

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements the plan to "Seal JavaCC SQL Parser Escape Hatches" by removing the ability to invoke the legacy JavaCC parser. Key changes include deprecating the SQL_PARSER_IMPLEMENTATION configuration, migrating production code paths in AbstractProperty and SQLFunctionEval to SQLAntlrParser, and updating the ANTLR grammar and SQLASTBuilder to address syntax gaps. Additionally, numerous test files were refactored to extend AbstractParserTest. Feedback suggests adding the @deprecated tag to the configuration description for consistency and using protected fields with setters in UpdatePutItem to improve encapsulation.

SQL parser implementation to use. 'antlr' (default) uses the new ANTLR4-based parser with improved error messages. \
'javacc' uses the legacy JavaCC-based parser for backward compatibility.""",
String.class, "antlr", Set.of("antlr", "javacc")),
"Deprecated, has no effect. The ANTLR4-based SQL parser is always used.",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency with Javadoc conventions and the implementation plan, the deprecation message should start with @Deprecated.

Suggested change
"Deprecated, has no effect. The ANTLR4-based SQL parser is always used.",
"@Deprecated, has no effect. The ANTLR4-based SQL parser is always used.",

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The description string is a user-facing runtime value, not a Javadoc comment — adding @Deprecated as literal text in the string does nothing for Java's deprecation mechanism. The codebase already shows the correct pattern: GREMLIN_COMMAND_TIMEOUT uses the actual @Deprecated Java annotation on the enum constant. Adding @Deprecated as a text prefix here would be misleading and inconsistent.

Comment on lines +27 to +29
public Identifier left;
public Expression key;
public Expression value;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better encapsulation and consistency with other AST nodes like UpdateIncrementItem, it's preferable to keep these fields protected and provide public fluent setters instead of making them public.

You could add setters like this to UpdatePutItem:

public UpdatePutItem setLeft(Identifier left) {
  this.left = left;
  return this;
}

public UpdatePutItem setKey(Expression key) {
  this.key = key;
  return this;
}

public UpdatePutItem setValue(Expression value) {
  this.value = value;
  return this;
}

Then, SQLASTBuilder.visitUpdatePutItem() can be updated to use these setters.

Suggested change
public Identifier left;
public Expression key;
public Expression value;
protected Identifier left;
protected Expression key;
protected Expression value;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Reverted fields to protected and added fluent setters matching the UpdateIncrementItem pattern. Updated SQLASTBuilder.visitUpdatePutItem() to use them.

@robfrank
robfrank force-pushed the fix/seal-javacc-escape-hatches branch from 62205ce to 29c3c5a Compare March 29, 2026 12:51
@claude

claude Bot commented Mar 29, 2026

Copy link
Copy Markdown

PR Review: Seal JavaCC SQL Parser Escape Hatches

Good overall goal — removing the JavaCC escape hatches is an important correctness fix after #3738. The core migration in StatementCache, SQLScriptQueryEngine, AbstractProperty, and SQLFunctionEval is clean and correct. The grammar bug-fixes bundled here are a nice bonus.

That said, I have several concerns worth addressing before merge.


🔴 Potential Breaking Change: matchProperties now required on --> / <--

File: SQLParser.g4, lines ~248–264

- | DECR GT matchProperties?    // -->{as:x} anonymous outgoing
+ | DECR GT matchProperties     // -->{as:x} anonymous outgoing (properties required)
- | ARROW_LEFT MINUS matchProperties?  // <--{as:x}
+ | ARROW_LEFT MINUS matchProperties  // <--{as:x}

The grammar for matchMethod and nestedMatchMethod now requires a matchProperties block after --> and <--. Since matchNode and matchProperties have the same structure (LBRACE matchFilter? RBRACE), this creates a risk: ANTLR4 will now greedily consume the next {...} block as the edge's matchProperties rather than the next node's matchNode.

For example, MATCH {as:a}-->{as:b} — previously ANTLR resolved {as:b} as the next matchNode; now it may be consumed as matchProperties, leaving matchPath without the required trailing matchNode. This is a potential regression for all MATCH queries using bare -->.

Please add an explicit test covering MATCH {as:a}-->{as:b} and MATCH {as:a}<--{as:b} to the MatchStatementTest. If these are indeed broken, the optional ? should be restored.


🔴 fromIdentifier alias removed silently

File: SQLParser.g4, line ~1036; SQLASTBuilder.java

-    | identifier (modifier)* (AS? identifier)?    # fromIdentifier
+    | identifier (modifier)*                       # fromIdentifier
- // Handle alias (second identifier after AS)
- if (ctx.identifier().size() > 1) {
-   fromItem.alias = (Identifier) visit(ctx.identifier(1));
- }

This removes alias support from the bare-identifier form of FROM. Was this intentional? Queries like SELECT FROM Person AS p WHERE p.name = 'x' could be affected. If the alias in fromSubquery (the LPAREN statement RPAREN ... (AS? identifier)? alternative) covers the needed cases, please add a comment explaining why the fromIdentifier alias is intentionally dropped — and a regression test.


🟡 UpdatePutItem visibility widened to public without justification

File: UpdatePutItem.java

-  protected Identifier left;
-  protected Expression key;
-  protected Expression value;
+  public Identifier left;
+  public Expression key;
+  public Expression value;

Changing protected → public widens the API surface unnecessarily. The visitUpdatePutItem handler in SQLASTBuilder could use setters or just set the fields directly (it's in the same package hierarchy). Please either revert to protected or add proper setters like the pattern used for UpdateIncrementItem.


🟡 AbstractProperty.getDefaultValue() swallows all exceptions

File: AbstractProperty.java

- } catch (ParseException e) {
+ } catch (Exception e) {
    // IGNORE IT

Catching bare Exception silently suppresses NullPointerException, ClassCastException, OutOfMemoryError (via RuntimeException), etc. This can hide real bugs. Please narrow to CommandSQLParsingException (what ANTLR throws) or at worst RuntimeException.


🟡 UNWIND AS-alias handling dropped from visitor

File: SQLASTBuilder.java (visitUnwind)

The grammar retains UNWIND expression (AS? identifier)? but the new visitor completely ignores ctx.identifier() — any AS alias is silently discarded. Either:

  • Remove the AS? identifier alternative from the grammar (if UNWIND aliases aren't supported), or
  • Restore the alias-handling code in the visitor

As-is, this is a quiet behaviour difference between old and new parser.


🟡 commitStatement grammar now requires AND before FAIL/CONTINUE

File: SQLParser.g4

- : COMMIT (RETRY INTEGER_LITERAL (ELSE (LBRACE (scriptStatement SEMICOLON?)* RBRACE)? (AND? (FAIL | CONTINUE))?)?)?
+ : COMMIT (RETRY INTEGER_LITERAL (ELSE (LBRACE (scriptStatement SEMICOLON?)+ RBRACE AND (FAIL | CONTINUE) | (FAIL | CONTINUE)))?)?

AND is now mandatory between the brace block and FAIL/CONTINUE (previously AND?). Also * → + means the brace block must be non-empty. Please confirm that COMMIT RETRY 3 ELSE FAIL and COMMIT RETRY 3 ELSE { stmt1; } FAIL (without AND) are still tested and pass.


🟢 Minor: Plan documents in docs/plans/ contain machine-local paths

Files: docs/plans/2026-03-28-seal-javacc-escape-hatches.md, docs/plans/2026-03-28-seal-javacc-escape-hatches-design.md

These AI-generated planning documents reference an absolute local path (/Users/frank/projects/arcade/worktrees/worktrees/seal-javacc) and are not useful reference documentation for other contributors. They're fine as ephemeral design notes but probably don't belong committed to main. Consider removing them or moving to a CONTRIBUTING-style internal wiki.


✅ What looks good

  • StatementCache.parse() and SQLScriptQueryEngine.parseScript() simplifications are clean
  • SQLFunctionEval.execute() migration is correct — removing the ByteArrayInputStream wrapper is a nice cleanup
  • GlobalConfiguration.SQL_PARSER_IMPLEMENTATION deprecation is handled correctly (no more validation set, description updated)
  • InCondition.toString() — correctly emits NOT IN when not == true
  • matchFilterItemKey restricted to the documented valid keys (removes the open-ended identifier fallback that hid the parser divergence)
  • StatementExpression and SubqueryExpression now implement toString() — good fix
  • visitInputParameter now handles :from (reserved keyword as named param) correctly
  • NearOperator/WithinOperator added to mapComparisonOperator — good fix

@codecov

codecov Bot commented Mar 29, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 69.62025% with 48 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.89%. Comparing base (60257e1) to head (d104fe4).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...va/com/arcadedb/query/sql/antlr/SQLASTBuilder.java 69.78% 16 Missing and 26 partials ⚠️
...om/arcadedb/function/sql/math/SQLFunctionEval.java 25.00% 3 Missing ⚠️
.../arcadedb/query/sql/antlr/StatementExpression.java 66.66% 1 Missing and 1 partial ⚠️
...ain/java/com/arcadedb/schema/AbstractProperty.java 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3756      +/-   ##
==========================================
+ Coverage   64.59%   64.89%   +0.29%     
==========================================
  Files        1580     1580              
  Lines      115534   115631      +97     
  Branches    24452    24480      +28     
==========================================
+ Hits        74629    75036     +407     
+ Misses      30735    30435     -300     
+ Partials    10170    10160      -10     

☔ View full report in Codecov by Sentry.
📢 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.

@claude

claude Bot commented Mar 30, 2026

Copy link
Copy Markdown

Code Review (supplemental)

Good cleanup overall — the core goal of sealing JavaCC escape hatches is achieved cleanly. These are additional items not covered in the prior review.


Issues to address before merging

1. truncateRecordBody grammar change is a breaking API change

The comma-separated form TRUNCATE RECORD #1:1, #2:2 is gone — replaced by TRUNCATE RECORD [#1:1, #2:2]. This is a backwards-incompatible change with no mention in the PR description. Either restore the old form as a parallel alternative, or document this as a deliberate breaking change.


2. matchMethod/nestedMatchMethod: making --> and <-- require matchProperties breaks existing MATCH queries

- | DECR GT matchProperties?   // -->{as:x} anonymous outgoing
+ | DECR GT matchProperties    // -->{as:x} anonymous outgoing (properties required)

Any MATCH query using bare --> or <-- without {...} will now fail to parse. For example:

MATCH {class:Person, as:a} --> {class:Address, as:b} RETURN a, b

The --> here has no {...} block of its own — the {class:Address, as:b} is the destination node's properties, not the edge's. The bidirectional -- form kept ?, making the asymmetry surprising. If there is a parser ambiguity reason for this change, it needs a comment and a regression test. If unintentional, revert to matchProperties?.


3. PARALLEL keyword added to grammar but not handled in the AST builder or SelectStatement.toString()

SQLParser.g4 now accepts PARALLEL at the end of selectStatement and a new PARALLEL token is in the lexer. But there is no corresponding visitor in SQLASTBuilder.java and SelectStatement.toString() does not emit PARALLEL. The round-trip check in AbstractParserTest.checkRightSyntax() (parse -> toString -> re-parse) will silently drop PARALLEL from any query. Either wire it through to the AST and add a round-trip test, or remove it from this PR.


4. GlobalConfiguration.SQL_PARSER_IMPLEMENTATION is missing the Java @Deprecated annotation

The description text says "Deprecated" but there is no @Deprecated annotation on the enum constant. Without it, IDEs and tools will not flag usages at compile time. Add @Deprecated to the constant itself.


5. DROP PROPERTY ... FORCE added to grammar but needs AST handling

dropPropertyBody now accepts FORCE?, but there is no corresponding field, visitor update, or toString() change visible in this diff. If FORCE is not wired through to execution, it will be silently ignored. Please confirm this is handled (or add a tracking TODO).


Minor

6. select from Foo bar (alias) silently dropped

The tests flip select from Foo bar from wrong-syntax to right-syntax, and the comment in visitFromIdentifier says the alias "is ignored in execution". This means SELECT a.name FROM Person p WHERE p.age > 18 parses without error but the alias binding has no effect at runtime. At minimum, add a comment in the grammar so users are not surprised.


What looks good

  • StatementCache/SQLScriptQueryEngine simplifications are clean and correct
  • SQLFunctionEval migration is correct — removing the ByteArrayInputStream wrapper is a nice cleanup
  • InCondition.toString() correctly emits NOT IN when not == true (genuine bug fix)
  • StatementExpression/SubqueryExpression now implement toString() — good fix
  • matchFilterItemKey restricted to documented valid keys only — correct fix for the divergence that hid test failures
  • visitInputParameter now handles :from (reserved keyword as named param) correctly
  • AbstractParserTest refactor cleanly removes 40+ lines of duplicated boilerplate across 11 test files

@robfrank

Copy link
Copy Markdown
Collaborator Author

Review response

Comment 1 (rejected) — @Deprecated prefix in description string
The description is a user-facing runtime string, not a Javadoc comment. Adding @Deprecated as text in a string has no effect on Java's deprecation mechanism. The codebase already shows the correct pattern: GREMLIN_COMMAND_TIMEOUT uses the actual @Deprecated Java annotation on the enum constant. The description string text "Deprecated, has no effect..." is sufficient.

Comment 2 (implemented) — protected fields + fluent setters in UpdatePutItem
Valid. Reverted fields to protected and added setLeft(), setKey(), setValue() fluent setters matching the UpdateIncrementItem pattern. Updated SQLASTBuilder.visitUpdatePutItem() to use the setters.

@claude

claude Bot commented Mar 30, 2026

Copy link
Copy Markdown

Review Summary (follow-up): Three prior reviews have covered this PR thoroughly. Summarizing unresolved items after the author response.

ADDRESSED: UpdatePutItem setters added (confirmed). The @deprecated annotation should also be placed on the enum constant, not just the description string.

STILL UNRESOLVED:

  1. catch (Exception e) in AbstractProperty.getDefaultValue() - silently swallows NullPointerException, ClassCastException, etc. Please narrow to catch (CommandSQLParsingException e).

  2. matchProperties now required after --> and <-- - this is a breaking grammar change. MATCH {class:Person, as:a} --> {class:Address, as:b} may now fail because ANTLR will consume {class:Address, as:b} as the edge properties instead of the next node. Please add a MatchStatementTest covering this exact pattern.

  3. PARALLEL keyword not wired to AST - PARALLEL was added to grammar/lexer but there is no visitor in SQLASTBuilder and SelectStatement.toString() does not emit it. Wire it through or remove from this PR.

  4. TRUNCATE RECORD comma-separated form removed - replacing TRUNCATE RECORD rid1, rid2 with TRUNCATE RECORD [rid1, rid2] is an undocumented breaking change.

The core parser migration (JavaCC to ANTLR everywhere) is correct and well-executed. Items 2 and 3 need explicit confirmation before merge.

Generated with Claude Code

@lvca lvca left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if all the keywords added are not used, like PARALLEL in the query or FORCE in the drop statements.

@robfrank

Copy link
Copy Markdown
Collaborator Author

Investigated both keywords (re: review #3756 (review)):

PARALLEL — silently ignored in both parsers. Neither SelectStatement nor the original SqlParser.java has any parallel field or handling. It's accepted for OrientDB backward compatibility but has never had an implementation. No change needed.

FORCE in DROP PROPERTY — real bug confirmed. JavaCC sets stmt.force = true (SqlParser.java:14266), but visitDropPropertyStmt in SQLASTBuilder was never setting it. DropPropertyStatement.force controls whether dependent indexes are auto-dropped vs throwing an error. Fixed in b8a4922 with a regression test asserting the flag is correctly propagated.

@claude

claude Bot commented Mar 31, 2026

Copy link
Copy Markdown

Code Review (final pass)

Thank you for the detailed responses. Most concerns have been addressed. Here is a concise summary of what remains:


Still needs resolution before merge

1. catch (Exception e) in AbstractProperty.getDefaultValue() — still too broad

// Current (after this PR)
} catch (Exception e) {
  // IGNORE IT
}

CommandSQLParsingException is what SQLAntlrParser.parseExpression() throws on invalid input — that should be silenced. But a NullPointerException or ClassCastException here is a bug that will disappear silently. Please narrow to:

} catch (CommandSQLParsingException e) {
  // IGNORE IT
}

2. matchProperties now required after --> / <-- — confirm no regression

// Before
| DECR GT matchProperties?   // -->{as:x} anonymous outgoing (optional)
// After
| DECR GT matchProperties    // -->{as:x} anonymous outgoing (properties required)

The author's last response did not address this. The common MATCH pattern:

MATCH {class:Person, as:a} --> {class:Address, as:b} RETURN a, b

…has no {...} after --> — the {class:Address, as:b} belongs to the next node, not the edge. With matchProperties now required, this query may no longer parse or may parse incorrectly (consuming the destination node's block as edge properties).

Please add a MatchStatementTest covering this exact multi-hop pattern with anonymous --> and <-- edges to confirm there is no regression, and explain in a comment why requiring matchProperties here is safe.


3. TRUNCATE RECORD — comma-list form removed

// Before
: rid (COMMA rid)*
// After
: rid
| LBRACKET rid (COMMA rid)* RBRACKET

TRUNCATE RECORD #1:0, #1:1 was valid syntax; it is now rejected. This is an undocumented breaking change. If the old form was never actually implemented or tested, add a comment. If it was, add backward-compatible grammar and a test, or document the breakage in the PR description.


Acknowledged / resolved

  • UpdatePutItem fluent setters added, fields kept protected ✅
  • FORCE in DROP PROPERTY fixed and tested in b8a4922 ✅
  • PARALLEL intentionally silently ignored for OrientDB compat — acceptable ✅
  • InCondition.toString() NOT IN bug fix ✅
  • StatementExpression/SubqueryExpression toString() overrides ✅

The core parser migration is correct and well-executed. Items 1–3 above are the blockers.

Generated with Claude Code

@robfrank
robfrank requested a review from lvca March 31, 2026 09:48
robfrank and others added 16 commits March 31, 2026 13:23
…gaps

- AbstractParserTest now uses SQLAntlrParser instead of SqlParser
- SelectStatementTest.emptyCollection() migrated to use SQLAntlrParser directly
- Fix SQLParser.g4: matchFilterItemKey restricted to valid keys only (was accepting any identifier)
- Fix SQLParser.g4: named parameter :from now supported (FROM is a reserved keyword)
- Fix SQLParser.g4: CREATE INDEX grammar for named vs unnamed index forms
- Fix SQLParser.g4: UNWIND now supports multiple items separated by commas
- Fix SQLParser.g4: TIMEOUT clause now supports EXCEPTION/RETURN options
- Fix SQLParser.g4: array selectors improvements (range, IN, NOT IN)
- Fix SQLParser.g4: RID_STRING as base expression
- Fix SQLASTBuilder.java: UpdatePutItem, InCondition, Timeout, UpdateOperations,
  UpdateIncrementItem, CreateIndexStatement, StatementExpression, SubqueryExpression
- PatternTestParserTest updated to work with ANTLR semantics

This completes the JavaCC escape hatch sealing: grep for "new SqlParser" in
src/main/java and src/test/java returns zero call-site results.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
- AbstractParserTest now uses SQLAntlrParser (the production parser)
  instead of the legacy JavaCC parser, which was silently hiding gaps
- SQLParser.g4: make EXPORT DATABASE url optional; add FORCE to DROP
  PROPERTY; add INTEGER_LITERAL to DROP/TRUNCATE BUCKET; fix TRUNCATE
  RECORD to require brackets for multiple RIDs; fix COMMIT RETRY ELSE
  block to require AND and non-empty body; add STAR to ALTER BUCKET;
  add legacy quoted-name syntax to CREATE INDEX; add OVERWRITE as
  allowed identifier for use in WITH clause settings
- SQLASTBuilder: fix ClassCastException in ALTER PROPERTY/BUCKET NAME
  handling; fix DROP/TRUNCATE BUCKET integer ID; fix CREATE INDEX
  legacy syntax visitor
- SubqueryExpression, StatementExpression: add toString(Map,StringBuilder)
  override so LET subquery round-trips correctly
- ImportDatabaseStatement: fix settings key serialization in toString()
- ExportDatabaseStatementTestParserTest: add WITH clause test cases

Closes #3738

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
- Remove FROM from identifier rule (was causing SELECT FROM to parse
  'from' as a projection field); allow FROM only in inputParameter for
  :from named params
- Fix createIndexBody ON-clause to accept NULL_STRATEGY/METADATA/ENGINE
  in any order matching toString() output order; fix positional visitor
  to check NULL_STRATEGY before ENGINE
- Fix createVertexBody to accept BUCKET_IDENTIFIER/BUCKET_NUMBER_IDENTIFIER
  tokens (bucket:name syntax without a type name); fix visitCreateVertexStmt
  to handle both forms
- Make DECR GT and ARROW_LEFT MINUS require matchProperties in matchMethod
  and nestedMatchMethod, preventing consecutive arrows without node filter
- Add bucket value validation in visitMatchFilterItem to reject float
  literals (only integer ID or identifier name allowed)
- Fix tryExtractIntegerLiteral to throw on FloatingPoint/PNumber values,
  rejecting foo[1....5] range selectors with float endpoints
- Fix PInteger construction in BUCKET_NUMBER_IDENTIFIER handling (was
  passing value as node id; use setValue() instead)
- Add PARALLEL keyword to lexer and selectStatement as optional trailing
  hint for legacy OrientDB compatibility

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
robfrank and others added 4 commits March 31, 2026 13:23
- Add RID_STRING token for quoted "@Rid" form in lexer
- Allow RID_STRING in stringLiteral expression alternative
- Fix COMMIT RETRY ELSE block to not require trailing AND FAIL/CONTINUE

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
- Restore (AS? identifier)? in fromIdentifier grammar rule
- Fix visitFromIdentifier to use identifier(0) for the type name
- Update SelectStatementTest: bare aliases without AS are valid SQL

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Follow the same encapsulation pattern as UpdateIncrementItem: keep fields
protected and expose public fluent setters. Update SQLASTBuilder to use
the new setters instead of direct field assignment.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
SQLASTBuilder.visitDropPropertyStmt() was not setting stmt.force,
so DROP PROPERTY Foo.bar FORCE was silently ignoring the flag and
throwing an error when dependent indexes existed instead of dropping
them. Add assertion test to cover both force=true and force=false.

PARALLEL in SELECT has always been a no-op in both parsers (OrientDB
backward-compat keyword with no implementation), so no change needed.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@robfrank
robfrank force-pushed the fix/seal-javacc-escape-hatches branch from b8a4922 to d104fe4 Compare March 31, 2026 11:23
@codacy-production

codacy-production Bot commented Mar 31, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity

Metric Results
Complexity 0

View in Codacy

🟢 Coverage 86.71% diff coverage · -8.27% coverage variation

Metric Results
Coverage variation ✅ -8.27% coverage variation
Diff coverage ✅ 86.71% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (60257e1) 115534 84827 73.42%
Head commit (d104fe4) 146746 (+31212) 95613 (+10786) 65.16% (-8.27%)

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 (#3756) 158 137 86.71%

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%

TIP This summary will be updated as you push new changes. Give us feedback

@robfrank robfrank changed the title fix: seal JavaCC SQL parser escape hatches — ANTLR is always used now #3738 fix: seal JavaCC SQL parser escape hatches — ANTLR is always used now Mar 31, 2026
@robfrank
robfrank merged commit 11302c2 into main Mar 31, 2026
26 of 29 checks passed
@robfrank
robfrank deleted the fix/seal-javacc-escape-hatches branch March 31, 2026 17:00
@robfrank robfrank added this to the 26.4.1 milestone Apr 22, 2026
robfrank added a commit that referenced this pull request May 12, 2026
tae898 pushed a commit to humemai/arcadedb-embedded-python that referenced this pull request Jun 28, 2026
…[skip ci]

Bumps [org.mockito:mockito-core](https://github.com/mockito/mockito) from 5.20.0 to 5.21.0.
Release notes

*Sourced from [org.mockito:mockito-core's releases](https://github.com/mockito/mockito/releases).*

> v5.21.0
> -------
>
> *Changelog generated by [Shipkit Changelog Gradle Plugin](https://github.com/shipkit/shipkit-changelog)*
>
> #### 5.21.0
>
> * 2025-12-09 - [17 commit(s)](mockito/mockito@v5.20.0...v5.21.0) by Giulio Longfils, Joshua Selbo, Woongi9, Zylox, dependabot[bot]
> * Bump graalvm/setup-graalvm from 1.4.3 to 1.4.4 [([ArcadeData#3768](https://redirect.github.com/mockito/mockito/issues/3768))]([mockito/mockito#3768](https://redirect.github.com/mockito/mockito/pull/3768))
> * Bump graalvm/setup-graalvm from 1.4.2 to 1.4.3 [([ArcadeData#3767](https://redirect.github.com/mockito/mockito/issues/3767))]([mockito/mockito#3767](https://redirect.github.com/mockito/mockito/pull/3767))
> * Bump actions/checkout from 5 to 6 [([ArcadeData#3765](https://redirect.github.com/mockito/mockito/issues/3765))]([mockito/mockito#3765](https://redirect.github.com/mockito/mockito/pull/3765))
> * Adds output of matchers to potential mismatch; Fixes [ArcadeData#2468](https://redirect.github.com/mockito/mockito/issues/2468) [([ArcadeData#3760](https://redirect.github.com/mockito/mockito/issues/3760))]([mockito/mockito#3760](https://redirect.github.com/mockito/mockito/pull/3760))
> * Forbid mocking WeakReference with inline mock maker [([ArcadeData#3759](https://redirect.github.com/mockito/mockito/issues/3759))]([mockito/mockito#3759](https://redirect.github.com/mockito/mockito/pull/3759))
> * StackOverflowError when mocking WeakReference [([ArcadeData#3758](https://redirect.github.com/mockito/mockito/issues/3758))]([mockito/mockito#3758](https://redirect.github.com/mockito/mockito/issues/3758))
> * Bump actions/upload-artifact from 4 to 5 [([ArcadeData#3756](https://redirect.github.com/mockito/mockito/issues/3756))]([mockito/mockito#3756](https://redirect.github.com/mockito/mockito/pull/3756))
> * Bump graalvm/setup-graalvm from 1.4.1 to 1.4.2 [([ArcadeData#3755](https://redirect.github.com/mockito/mockito/issues/3755))]([mockito/mockito#3755](https://redirect.github.com/mockito/mockito/pull/3755))
> * Support primitives in GenericArrayReturnType. [([ArcadeData#3753](https://redirect.github.com/mockito/mockito/issues/3753))]([mockito/mockito#3753](https://redirect.github.com/mockito/mockito/pull/3753))
> * ClassNotFoundException when stubbing array of primitive type on Android [([ArcadeData#3752](https://redirect.github.com/mockito/mockito/issues/3752))]([mockito/mockito#3752](https://redirect.github.com/mockito/mockito/issues/3752))
> * Bump graalvm/setup-graalvm from 1.4.0 to 1.4.1 [([ArcadeData#3744](https://redirect.github.com/mockito/mockito/issues/3744))]([mockito/mockito#3744](https://redirect.github.com/mockito/mockito/pull/3744))
> * Bump gradle/actions from 4 to 5 [([ArcadeData#3743](https://redirect.github.com/mockito/mockito/issues/3743))]([mockito/mockito#3743](https://redirect.github.com/mockito/mockito/pull/3743))
> * Bump org.graalvm.buildtools.native from 0.11.0 to 0.11.1 [([ArcadeData#3738](https://redirect.github.com/mockito/mockito/issues/3738))]([mockito/mockito#3738](https://redirect.github.com/mockito/mockito/pull/3738))
> * Bump com.diffplug.spotless:spotless-plugin-gradle from 7.2.1 to 8.0.0 [([ArcadeData#3735](https://redirect.github.com/mockito/mockito/issues/3735))]([mockito/mockito#3735](https://redirect.github.com/mockito/mockito/pull/3735))
> * Bump graalvm/setup-graalvm from 1.3.7 to 1.4.0 [([ArcadeData#3734](https://redirect.github.com/mockito/mockito/issues/3734))]([mockito/mockito#3734](https://redirect.github.com/mockito/mockito/pull/3734))
> * Bump org.assertj:assertj-core from 3.27.5 to 3.27.6 [([ArcadeData#3733](https://redirect.github.com/mockito/mockito/issues/3733))]([mockito/mockito#3733](https://redirect.github.com/mockito/mockito/pull/3733))
> * Bump errorprone from 2.41.0 to 2.42.0 [([ArcadeData#3732](https://redirect.github.com/mockito/mockito/issues/3732))]([mockito/mockito#3732](https://redirect.github.com/mockito/mockito/pull/3732))
> * Feat: automatically detect class to mock in mockStatic and mockConstruction [([ArcadeData#3731](https://redirect.github.com/mockito/mockito/issues/3731))]([mockito/mockito#3731](https://redirect.github.com/mockito/mockito/pull/3731))
> * Return completed futures for unstubbed Future/CompletionStage in ReturnsEmptyValues [([ArcadeData#3727](https://redirect.github.com/mockito/mockito/issues/3727))]([mockito/mockito#3727](https://redirect.github.com/mockito/mockito/pull/3727))
> * automatically detect class to mock [([ArcadeData#2779](https://redirect.github.com/mockito/mockito/issues/2779))]([mockito/mockito#2779](https://redirect.github.com/mockito/mockito/pull/2779))
> * Incorrect "has following stubbing(s) with different arguments" message when using Argument Matchers [([ArcadeData#2468](https://redirect.github.com/mockito/mockito/issues/2468))]([mockito/mockito#2468](https://redirect.github.com/mockito/mockito/issues/2468))


Commits

* [`09d2230`](mockito/mockito@09d2230) Bump graalvm/setup-graalvm from 1.4.3 to 1.4.4 ([ArcadeData#3768](https://redirect.github.com/mockito/mockito/issues/3768))
* [`df3e0cc`](mockito/mockito@df3e0cc) Bump graalvm/setup-graalvm from 1.4.2 to 1.4.3 ([ArcadeData#3767](https://redirect.github.com/mockito/mockito/issues/3767))
* [`04a6e9f`](mockito/mockito@04a6e9f) Bump actions/checkout from 5 to 6 ([ArcadeData#3765](https://redirect.github.com/mockito/mockito/issues/3765))
* [`756a3cf`](mockito/mockito@756a3cf) Add description of matchers to potential mismatch ([ArcadeData#3760](https://redirect.github.com/mockito/mockito/issues/3760))
* [`58ba445`](mockito/mockito@58ba445) Forbid mocking WeakReference with inline mock maker ([ArcadeData#3759](https://redirect.github.com/mockito/mockito/issues/3759))
* [`966d600`](mockito/mockito@966d600) Bump actions/upload-artifact from 4 to 5 ([ArcadeData#3756](https://redirect.github.com/mockito/mockito/issues/3756))
* [`632bf7b`](mockito/mockito@632bf7b) Bump graalvm/setup-graalvm from 1.4.1 to 1.4.2 ([ArcadeData#3755](https://redirect.github.com/mockito/mockito/issues/3755))
* [`8564b43`](mockito/mockito@8564b43) Fix primitives support in GenericArrayReturnType for Android ([ArcadeData#3753](https://redirect.github.com/mockito/mockito/issues/3753))
* [`bf3a809`](mockito/mockito@bf3a809) Bump graalvm/setup-graalvm from 1.4.0 to 1.4.1 ([ArcadeData#3744](https://redirect.github.com/mockito/mockito/issues/3744))
* [`cffddd4`](mockito/mockito@cffddd4) Bump gradle/actions from 4 to 5 ([ArcadeData#3743](https://redirect.github.com/mockito/mockito/issues/3743))
* Additional commits viewable in [compare view](mockito/mockito@v5.20.0...v5.21.0)
  
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility\_score?dependency-name=org.mockito:mockito-core&package-manager=maven&previous-version=5.20.0&new-version=5.21.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
Dependabot commands and options
  
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show  ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
tae898 pushed a commit to humemai/arcadedb-embedded-python that referenced this pull request Jun 28, 2026
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.

fix: SQL parser tests were silently using legacy JavaCC parser, hiding grammar gaps

2 participants