Skip to content

Support Oracle Create TABLE sql statement parse#38667

Open
ClaireLytt wants to merge 3 commits into
apache:masterfrom
ClaireLytt:oranew
Open

Support Oracle Create TABLE sql statement parse#38667
ClaireLytt wants to merge 3 commits into
apache:masterfrom
ClaireLytt:oranew

Conversation

@ClaireLytt
Copy link
Copy Markdown
Contributor

Fixes #27101.

Changes proposed in this pull request:


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

@strongduanmu
Copy link
Copy Markdown
Member

• Decision

  • Merge Verdict: Not Mergeable
  • Reviewed Scope: PR Support Oracle Create TABLE sql statement parse #38667 latest head 15b9216; RELEASE-NOTES.md; Oracle DDLStatement.g4; parser IT SQL/case XML for create-table.
  • Not Reviewed Scope: full local Maven build and runtime JDBC/Proxy smoke were not run locally; GitHub workflow runs on the head commit were checked and are green.
  • Need Expert Review: Oracle SQL parser maintainer review is needed after the grammar placement is corrected.

Positive Feedback

The PR targets the right Oracle parser area and adds parser IT cases for the nested-table sample and Oracle PIVOT CTAS sample. CI workflows on the latest head are successful.

Major Issues

  1. Blocking: nestedTableColProperties is added at the wrong grammar layer

    In parser/sql/engine/dialect/oracle/src/main/antlr4/imports/oracle/DDLStatement.g4:288-290, the PR adds nestedTableColProperties* directly before tableProperties?. But columnProperty at lines 689-693 still does not include
    nestedTableColProperties.

    Oracle 19c documents nested_table_col_properties as one branch of repeated column_properties, and column_properties is part of table_properties. This means it can be combined with other column properties such as
    XMLType_column_properties or LOB_storage_clause.

    Current PR shape only covers the happy path where all NESTED TABLE ... STORE AS ... clauses appear before tableProperties. A valid adjacent ordering remains uncovered and likely unparseable, for example:

    CREATE TABLE t_nested_mix (doc XMLTYPE, phones_ntab phone_ntabtyp)
    XMLTYPE doc STORE AS CLOB
    NESTED TABLE phones_ntab STORE AS phone_store_ntab;

    Please move nestedTableColProperties into columnProperty and remove the standalone placement from createRelationalTableClause.

  2. Blocking: tests do not validate the ordering/counterexample path

    The new test at test/it/parser/src/main/resources/sql/supported/ddl/create-table.xml:161 only covers NESTED TABLE immediately after the column list. It does not cover the official column_properties repetition model or a mixed
    property ordering.

    Please add at least one counterexample/adjacent case where another column property appears before NESTED TABLE, such as XMLTYPE ... STORE AS ... or LOB (...) STORE AS ..., then NESTED TABLE ... STORE AS .... Also prefer using the
    issue’s original schema-qualified nested type form oe.phone_ntabtyp so the regression case maps one-to-one to Support parsing Oracle CREATE TABLE sql #27101.

Newly Introduced Issues

The grammar now models NESTED TABLE as a special clause between physicalProperties and tableProperties, which diverges from Oracle’s documented column_properties structure and creates an incomplete parser surface for valid Oracle CREATE
TABLE statements.

Next Steps

  • Update columnProperty to include nestedTableColProperties.
  • Remove nestedTableColProperties* from createRelationalTableClause.
  • Add parser IT cases for the original issue SQL and one mixed column_properties ordering case.
  • Re-run a scoped verification with dependencies, for example:
    ./mvnw -pl test/it/parser -am -DskipITs=false -Dit.test=org.apache.shardingsphere.test.it.sql.parser.oracle.InternalOracleParserIT verify

Evidence

@strongduanmu
Copy link
Copy Markdown
Member

@ClaireLytt Please modify this pr according to review suggestion.

@ClaireLytt
Copy link
Copy Markdown
Contributor Author

@ClaireLytt Please modify this pr according to review suggestion.

Done. Please review my new commit,thank you!

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.

Support parsing Oracle CREATE TABLE sql

2 participants