Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance parsing the Doris create materialized view #34943

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jay841224
Copy link

@jay841224 jay841224 commented Mar 9, 2025

Fixes #31499

Changes proposed in this pull request:
This pull request modify the parsing of the following sql:

CREATE MATERIALIZED VIEW mv1 BUILD IMMEDIATE
CREATE MATERIALIZED VIEW mv1 REFRESH COMPLETE
CREATE MATERIALIZED VIEW mv1 REFRESH ON SCHEDULE EVERY 2 HOUR STARTS "2023-12-13 21:07:09"
CREATE MATERIALIZED VIEW mv1 KEY(k1,k2)

For the completeness of SQL syntax, I added a simple SELECT at the end to ensure they work properly.

CREATE MATERIALIZED VIEW mv1 BUILD IMMEDIATE AS SELECT k1, k2 FROM test_table;
CREATE MATERIALIZED VIEW mv1 REFRESH COMPLETE AS SELECT k1, k2 FROM test_table;
CREATE MATERIALIZED VIEW mv1 REFRESH ON SCHEDULE EVERY 2 HOUR STARTS "2023-12-13 21:07:09" AS SELECT k1, k2 FROM test_table;
CREATE MATERIALIZED VIEW mv1 KEY(k1,k2) AS SELECT k1, k2 FROM test_table;

Since the original Doris DDL did not have Materialized Views, I referred to Materialized Views and added parsing syntax in DDLStatement.g4.


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

@yx9o yx9o added this to the 5.5.3 milestone Mar 14, 2025
@jay841224 jay841224 changed the title Fix the error in parsing the Doris create materialized view Enhance parsing the Doris create materialized view Mar 23, 2025
@iamhucong iamhucong requested a review from Copilot March 27, 2025 02:55
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request enhances Doris SQL parsing by adding support for materialized view creation statements. Key changes include adding a new statement class for materialized views and extending the Doris DDL visitor to handle the new CREATE MATERIALIZED VIEW syntax.

Reviewed Changes

Copilot reviewed 2 out of 7 changed files in this pull request and generated 1 comment.

File Description
parser/sql/statement/type/doris/src/main/java/org/apache/shardingsphere/sql/parser/statement/doris/ddl/DorisCreateMaterializedViewStatement.java Introduces the new statement class for materialized views
parser/sql/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/doris/visitor/statement/type/DorisDDLStatementVisitor.java Adds the visitor method for parsing materialized view creation contexts
Files not reviewed (5)
  • parser/sql/dialect/doris/src/main/antlr4/imports/doris/DDLStatement.g4: Language not supported
  • parser/sql/dialect/doris/src/main/antlr4/imports/doris/DorisKeyword.g4: Language not supported
  • parser/sql/dialect/doris/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/DorisStatement.g4: Language not supported
  • test/it/parser/src/main/resources/case/ddl/create-materialized-view.xml: Language not supported
  • test/it/parser/src/main/resources/sql/supported/ddl/create-materialized-view.xml: Language not supported

@iamhucong
Copy link
Contributor

https://shardingsphere.apache.org/community/en/involved/conduct/code/#maintenance-conduct
@jay841224 Could you mark the syntax differences from MySQL? You can refer to this document for further information.

Additionally, please update the release notes for 5.5.3-SNAPSHOT.

@jay841224
Copy link
Author

Hi @iamhucong I have mark the syntax differences from MySQL and update release notes for 5.5.3-SNAPSHOT.

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 Doris sql
3 participants