Skip to content

Support Oracle database object DDL parsing - #39286

Merged
FlyingZC merged 4 commits into
apache:masterfrom
strongduanmu:dev-0731
Jul 31, 2026
Merged

Support Oracle database object DDL parsing#39286
FlyingZC merged 4 commits into
apache:masterfrom
strongduanmu:dev-0731

Conversation

@strongduanmu

@strongduanmu strongduanmu commented Jul 31, 2026

Copy link
Copy Markdown
Member

Fixes #N/A.

Changes proposed in this pull request:

  • Support Oracle database object DDL parsing for additional create function, create trigger, and create materialized view syntax.
  • Capture function and trigger inner SQL statements, procedure calls, body end names, and dynamic SQL expressions for downstream parser consumers.
  • Fix Oracle C call specification parsing for the AGENT IN (...) clause.

Requested labels: type: enhancement, in: SQL parse.


Before committing this PR, I'm sure that I have checked the following options:

  • My code follows the code of conduct of this project.
  • I have self-reviewed the commit code.
  • I have (or in comment I request) added corresponding labels for the pull request.
  • I have passed maven check locally : ./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e.
  • I have made corresponding changes to the documentation.
  • I have added corresponding unit tests for my changes.
  • I have updated the Release Notes of the current development version. For more details, see Update Release Note

Local checks passed:

  • ./mvnw -pl test/it/parser -Dtest=org.apache.shardingsphere.test.it.sql.parser.oracle.InternalOracleParserIT -Dsurefire.failIfNoSpecifiedTests=false -DskipITs -DskipNativeTest -DskipDockerTest -Dspotless.check.skip=true -Dcheckstyle.skip=true -Dmaven.javadoc.skip=true -Djacoco.skip=true -Dmaven.repo.local=/Users/duanzhengqiang/Downloads/tmp2 test
  • ./mvnw checkstyle:check -Pcheck -T1C -Dmaven.repo.local=/Users/duanzhengqiang/Downloads/tmp2

@strongduanmu
strongduanmu marked this pull request as ready for review July 31, 2026 05:47
@strongduanmu

Copy link
Copy Markdown
Member Author

• Review result: Mergeable

I reviewed PR #39286 against the latest head f98b2e7570db504de052e41b373ba58bee462fc4, focusing on Oracle database object DDL parsing correctness for CREATE FUNCTION, CREATE TRIGGER, and CREATE MATERIALIZED VIEW.

The two previously identified edge cases are excluded from this review per follow-up decision:

  • System trigger ENABLE / DISABLE / WHEN handling.
  • Trigger body CALL schema.package.procedure(...).

Within the remaining scope, I did not find additional blocking correctness issues.

Reviewed areas:

  • Oracle PL/SQL grammar changes for function, trigger, compound trigger, database trigger events, and call specifications.
  • Oracle DDL visitor changes for trigger metadata extraction, function inner SQL collection, procedure call capture, dynamic SQL expression capture, and materialized view select extraction.
  • Statement model changes for CreateFunctionStatement, CreateTriggerStatement, and CreateMaterializedViewStatement.
  • Parser IT additions and assertion wiring for trigger procedure-call metadata.
  • Oracle function cases for Java/C call specifications and aggregate function syntax.

Positive checks:

  • CREATE FUNCTION ... PARALLEL_ENABLE AGGREGATE USING ... is supported.
  • PIPELINED function forms with PARALLEL_ENABLE(PARTITION ... BY HASH/VALUE ...) and ORDER/CLUSTER BY streaming clauses parse successfully in the checked order.
  • Trigger body CALL DBMS_OUTPUT.PUT_LINE(...) is captured as a procedure call.
  • Trigger body local DML statements are collected into CreateTriggerStatement#getSqlStatements().
  • Trigger table extraction works for ordinary DML triggers.
  • The parser IT assertion path for CreateTriggerStatement is wired into standard DDL assertions.

Residual follow-up items:

  • Add parser IT coverage for system trigger ENABLE, DISABLE, and WHEN.
  • Add parser IT coverage for schema-qualified package routine calls in trigger body.
  • Consider extending trigger assertions beyond procedure-call names if downstream consumers rely on trigger inner SQL statements, dynamic SQL expressions, or body-end names.

@FlyingZC
FlyingZC merged commit 5b287c3 into apache:master Jul 31, 2026
76 checks passed
@strongduanmu
strongduanmu deleted the dev-0731 branch July 31, 2026 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants