You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "ccxxxyy (via GitHub)" <gi...@apache.org> on 2026/01/24 10:24:34 UTC
[PR] Support for the VIEW statement [shardingsphere]
ccxxxyy opened a new pull request, #37831:
URL: https://github.com/apache/shardingsphere/pull/37831
for https://github.com/apache/shardingsphere/issues/31476
Changes proposed in this pull request:
-
---
Before committing this PR, I'm sure that I have checked the following options:
- [x] My code follows the [code of conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/) of this project.
- [x] I have self-reviewed the commit code.
- [ ] I have (or in comment I request) added corresponding labels for the pull request.
- [x] 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](https://shardingsphere.apache.org/community/en/involved/contribute/contributor/)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support for the VIEW statement [shardingsphere]
Posted by "ccxxxyy (via GitHub)" <gi...@apache.org>.
ccxxxyy commented on PR #37831:
URL: https://github.com/apache/shardingsphere/pull/37831#issuecomment-3804975740
@terrymanu Hi! Thank you for your guidance! I hope my revisions can meet the requirements. Hope you can review them when you have time.
1. In parser/sql/engine/core/src/main/java/org/apache/shardingsphere/sql/parser/engine/core/database/visitor/SQLVisitorRule.java,
DORIS_DROP_MATERIALIZED_VIEW ("DropMaterializedView", SQLStatementType.DDL) has been added at line 218,
DORIS_ALTER_MATERIALIZED_VIEW ("DorisAlterMaterializedView", SQLStatementType.DDL) has been added at line 216, and
SHOW_VIEW ("ShowView", SQLStatementType.DAL) has been added at line 234.
As a result, the naming has been corrected and the missing rules have been added.
2. For MaterializedViewColumnSegment, the implementation has been completed.
The corresponding methods in DorisDDLStatementVisitor.java have been enhanced, and the assertions in
test/it/parser/src/main/resources/case/ddl/create-materialized-view.xml have been completed accordingly.
3. The processScheduleTrigger and processAlterMVRefreshTrigger methods in DorisDDLStatementVisitor.java have been modified.
The implementations of DorisAlterMaterializedViewStatement and DorisCreateMaterializedViewStatement, along with their corresponding Assert classes and TestCase classes, have been completed.
Additionally, the assertions in
test/it/parser/src/main/resources/case/ddl/alter-materialized-view.xml and
test/it/parser/src/main/resources/case/ddl/create-materialized-view.xml have been updated.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support parsing Doris VIEW/MATERIALIZED VIEW syntax [shardingsphere]
Posted by "ccxxxyy (via GitHub)" <gi...@apache.org>.
ccxxxyy closed pull request #37831: Support parsing Doris VIEW/MATERIALIZED VIEW syntax
URL: https://github.com/apache/shardingsphere/pull/37831
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support for the VIEW statement [shardingsphere]
Posted by "ccxxxyy (via GitHub)" <gi...@apache.org>.
ccxxxyy commented on PR #37831:
URL: https://github.com/apache/shardingsphere/pull/37831#issuecomment-3796133744
@terrymanu Hi! Thank you for your correction! I have made the revisions as required. Hope you can review them when you have time.
Regarding DATE_TRUNC, MATERIALIZED, and PAUSE: They have been added to the identifierKeywordsUnambiguous rule in BaseRule.g4 and have been designed as unambiguous identifier keywords. Meanwhile, corresponding tests have also been added in this modification.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support parsing Doris VIEW/MATERIALIZED VIEW syntax [shardingsphere]
Posted by "ccxxxyy (via GitHub)" <gi...@apache.org>.
ccxxxyy commented on PR #37831:
URL: https://github.com/apache/shardingsphere/pull/37831#issuecomment-3825032793
<img width="1228" height="548" alt="屏幕截图 2026-01-31 013003" src="https://github.com/user-attachments/assets/5f6a5768-39e8-46e2-a371-b6ad4ff86dfc" />
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support for the VIEW statement [shardingsphere]
Posted by "ccxxxyy (via GitHub)" <gi...@apache.org>.
ccxxxyy commented on PR #37831:
URL: https://github.com/apache/shardingsphere/pull/37831#issuecomment-3809097958
@terrymanu Thank you very much for your response. However, I still have some questions regarding these three points, and I would really appreciate it if you could take a look at my thoughts below.
- About temporarily stopping the improvement of Doris CREATE VIEW syntax in this PR
1. I hope to temporarily stop improving the Doris CREATE VIEW syntax in this PR. The reason is that once we start fixing the syntax, we need to modify CreateViewStatement and the related assertion classes. However, this will cause issues in Hive SQL parsing, because Hive also references CreateViewStatement, the Hive assertion tests will fail. Therefore, in order to properly support the Doris CREATE VIEW syntax, we also need to modify HiveDDLStatementVisitor.java. However, in your previous reply, you suggested rolling back the Hive-related changes and keeping this PR focused only on Doris. This means I must also roll back the changes to CreateViewStatement and the assertion classes; otherwise, the Hive assertion tests will fail and this PR cannot move forward at all.
2. For this reason, before submitting a separate PR to improve Hive parsing, it is not feasible to improve the Doris CREATE VIEW syntax in the current PR. In other words, only after the Hive syntax is improved can we safely proceed with improving the Doris CREATE VIEW syntax. Since both Hive and Doris reference CreateViewStatement, conflicts will inevitably occur between them.
3. Based on this consideration, I propose that this PR should temporarily not include improvements to the Doris CREATE VIEW syntax.
- About the SHOW VIEW syntax
According to the [official documentation](https://doris.apache.org/docs/4.x/sql-manual/sql-statements/table-and-view/view/SHOW-VIEW), the SHOW VIEW syntax is defined as:
SHOW VIEW { FROM | IN } table [ FROM db ]
In my implementation in DALStatement, it is defined as:
SHOW VIEW fromTable fromDatabase?
I am confused about the syntax you mentioned:
SHOW VIEW FROM [LIKE pattern];
Could you please let me know the source of this syntax definition
- About adding Doris bind logic
1. I am also confused about whether Doris-specific binder logic should be added. In a previous [PR ](https://github.com/apache/shardingsphere/pull/37588) I mentioned
(https://github.com/apache/shardingsphere/pull/37588
), the last reply from a Member stated:
"Can you remove the doris bind logic? This does not conform to the current design; the SQL Bind module does not care about specific dialects and only processes SQLStatement."
2. Based on this feedback, I would like to better understand whether adding Doris bind logic is consistent with the current design. I am genuinely unsure whether a binder should be added. If it is indeed necessary, I would greatly appreciate your guidance on how it should be done.
I sincerely look forward to your reply and guidance. Thank you again for your time and effort!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support parsing Doris VIEW/MATERIALIZED VIEW syntax [shardingsphere]
Posted by "ccxxxyy (via GitHub)" <gi...@apache.org>.
ccxxxyy commented on PR #37831:
URL: https://github.com/apache/shardingsphere/pull/37831#issuecomment-3825030910
<img width="1818" height="1480" alt="屏幕截图 2026-01-31 014516" src="https://github.com/user-attachments/assets/a2b731d2-e45c-49ed-b734-a9fba0fddf51" />
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support parsing Doris VIEW/MATERIALIZED VIEW syntax [shardingsphere]
Posted by "ccxxxyy (via GitHub)" <gi...@apache.org>.
ccxxxyy commented on PR #37831:
URL: https://github.com/apache/shardingsphere/pull/37831#issuecomment-3851855226
> This PR is becoming increasingly complex. Could you consider rewriting it by splitting the tasks and submitting smaller, incremental pull requests separately?
Thanks for your reply. I will do it!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support for the VIEW statement [shardingsphere]
Posted by "ccxxxyy (via GitHub)" <gi...@apache.org>.
ccxxxyy commented on PR #37831:
URL: https://github.com/apache/shardingsphere/pull/37831#issuecomment-3808760326
@terrymanu Thank you very much for your feedback and guidance. When you have time, I would appreciate it if you could review my latest changes!
I have reverted the changes to HiveDDLStatementVisitor.java and the related CreateViewStatement and assertion classes.
To address the CreateView improvements more completely, I plan to handle them in a separate PR. I have also temporarily postponed the improvements to the Doris CREATE VIEW syntax in this PR so that complete them in another one. Thanks again for your time and support.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support parsing Doris VIEW/MATERIALIZED VIEW syntax [shardingsphere]
Posted by "ccxxxyy (via GitHub)" <gi...@apache.org>.
ccxxxyy commented on PR #37831:
URL: https://github.com/apache/shardingsphere/pull/37831#issuecomment-3825036547
<img width="1680" height="333" alt="屏幕截图 2026-01-31 012640" src="https://github.com/user-attachments/assets/870fba9b-1a36-43f1-9c6c-256546f346ef" />
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support parsing Doris VIEW/MATERIALIZED VIEW syntax [shardingsphere]
Posted by "ccxxxyy (via GitHub)" <gi...@apache.org>.
ccxxxyy commented on PR #37831:
URL: https://github.com/apache/shardingsphere/pull/37831#issuecomment-3830280374
@terrymanu Hello, Thanks very much for your response. When you have some time, I would appreciate it if you could review my latest changes!
1、finished: All grammar has been checked against the documents one by one again to ensure the correctness. The parsing of owner has been included.
2、finished: Check all grammars and switch to tableName and have the visitor build SimpleTableSegment (with owner/start/stop).
3、finished: Test cases and assertion have been improved.
4、finished: Explicitly scope this PR and call out the remaining gap as shown in the figure.
Thanks again for your time and guidance!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support parsing Doris VIEW/MATERIALIZED VIEW syntax [shardingsphere]
Posted by "ccxxxyy (via GitHub)" <gi...@apache.org>.
ccxxxyy commented on PR #37831:
URL: https://github.com/apache/shardingsphere/pull/37831#issuecomment-3822325334
@terrymanu Hello, thank you for your reply. I am quite confused by the three points you mentioned, and I would be very grateful if you could take some time to respond and help clarify my concerns so that I can move this PR forward.
**First**, I am very confused about the issues you mentioned in points 1 and 2 regarding the DROP VIEW / SHOW VIEW syntax in SQLVisitorRule.java. In the current version of SQLVisitorRule.java, line 218 defines **DORIS_DROP_MATERIALIZED_VIEW("DropMaterializedView", SQLStatementType.DDL)**
and line 234 defines **SHOW_VIEW("ShowView", SQLStatementType.DAL)**
Support for these has already been added in the earlier commit. Therefore, I am confused about the problems mentioned in your first two points. Could you please take a look at the latest version of SQLVisitorRule.java and let me know whether the current definitions at line 218 (DORIS_DROP_MATERIALIZED_VIEW("DropMaterializedView", SQLStatementType.DDL)) and line 234 (SHOW_VIEW("ShowView", SQLStatementType.DAL)) meet the requirements
**Second**, regarding the **CREATE VIEW** syntax, I sincerely and respectfully hope that this PR does not involve further improvements to the CREATE VIEW syntax. I have already removed the reference to CREATE VIEW from the PR description.
Originally, I intended to improve the CREATE VIEW syntax in this PR. However, once CreateViewStatement is modified, HiveDDLStatementVisitor, which also references CreateViewStatement, must be modified at the same time. Since you suggested that this PR should remain focused on Doris, HiveDDLStatementVisitor has to be reverted to its original state. In order to avoid causing failures in the Hive tests that also rely on CreateViewStatement, CreateViewStatement itself cannot be modified in this PR.
Therefore, I would like to propose the following approach: after this PR is merged, I will first submit a separate PR to address the issues in HiveDDLStatementVisitor, and only after that will I submit another PR to improve the assertions.
I have explained this request in detail in previous replies as well. I sincerely hope that, for this PR, we can avoid modifying CreateViewStatement and the related assertion classes. Once the issues in HiveDDLStatementVisitor are resolved, I will improve the CREATE VIEW syntax and assertions in a dedicated PR. I truly hope this request can be accepted!
Thanks again for taking the time to respond to my concerns and respectfully hope. Looking forward to your reply!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support parsing Doris VIEW/MATERIALIZED VIEW syntax [shardingsphere]
Posted by "ccxxxyy (via GitHub)" <gi...@apache.org>.
ccxxxyy commented on PR #37831:
URL: https://github.com/apache/shardingsphere/pull/37831#issuecomment-3825034740
<img width="1228" height="548" alt="屏幕截图 2026-01-31 013003" src="https://github.com/user-attachments/assets/0ff91846-b07d-4f43-ac92-34fae1575039" />
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support for the VIEW statement [shardingsphere]
Posted by "ccxxxyy (via GitHub)" <gi...@apache.org>.
ccxxxyy commented on PR #37831:
URL: https://github.com/apache/shardingsphere/pull/37831#issuecomment-3796815441
@terrymanu Hi! I hope my revision can meet the requirements. Hope you could take a look when you have a moment. Thanks a lot!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support parsing Doris VIEW/MATERIALIZED VIEW syntax [shardingsphere]
Posted by "ccxxxyy (via GitHub)" <gi...@apache.org>.
ccxxxyy commented on PR #37831:
URL: https://github.com/apache/shardingsphere/pull/37831#issuecomment-3825024269
@terrymanu Hello, I have made the requested changes, and the current code has been verified one by one against your requirements. I would greatly appreciate it if you could review it when you have some time. Below is a detailed explanation:
1. **SQLVisitorRule.java, line 218:**
**DORIS_DROP_MATERIALIZED_VIEW("DropMaterializedView", SQLStatementType.DDL)**
There is no DropMaterializesView.
2. **SQLVisitorRule.java, line 216:**
**DORIS_ALTER_MATERIALIZED_VIEW("DorisAlterMaterializedView", SQLStatementType.DDL)**
This line of code has been present from the very beginning.
3. **SQLVisitorRule.java, line 234:**
**DORIS_SHOW_VIEW("ShowView", SQLStatementType.DAL)**
It has been renamed to DORIS_SHOW_VIEW as requested.
All three items above comply with the requirement that “names must match their parser contexts.” As shown in the latest version of the file, I have also checked the visitor method signatures one by one. There are no “naming mismatches (rule vs. Context)”, and there are no missing rules or naming errors.
4. **finished**: “Run the parser ITs for Doris/ALL cases to verify no SQLASTVisitorException remains.”
All test cases pass successfully with no issues. The execution results are shown in the attached output.
5. **finished**: “Document in the PR that this is parser-only support (no execution) and list the verification scope.”
In the PR description, I have explained the grammar improvements covered by this PR and clearly documented the Scope and Limitations.
I hope the explanations above meet your requirements. I sincerely look forward to your review, and thank you very much for your time, effort, and help!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support parsing Doris VIEW/MATERIALIZED VIEW syntax [shardingsphere]
Posted by "ccxxxyy (via GitHub)" <gi...@apache.org>.
ccxxxyy commented on PR #37831:
URL: https://github.com/apache/shardingsphere/pull/37831#issuecomment-3830281370

--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support for the VIEW statement [shardingsphere]
Posted by "ccxxxyy (via GitHub)" <gi...@apache.org>.
ccxxxyy commented on PR #37831:
URL: https://github.com/apache/shardingsphere/pull/37831#issuecomment-3802869105
@terrymanu Hi! Hope you could review this PR when you have a moment. Thank you for your time and help!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support parsing Doris VIEW/MATERIALIZED VIEW syntax [shardingsphere]
Posted by "ccxxxyy (via GitHub)" <gi...@apache.org>.
ccxxxyy commented on PR #37831:
URL: https://github.com/apache/shardingsphere/pull/37831#issuecomment-3814572451
@terrymanu Thanks very much for your reply and guidance! I sincerely hope you could review my latest changes when you have some time.
1. **Regarding dorisCreateMaterializedView**
I have updated DDLStatement.g4 and DorisDDLStatementVisitor.java as requested. In addition, I have added assertion tests in
case/ddl/create-materialized-view.xml and sql/supported/ddl/create-materialized-view.xml.
2. **Regarding DATE_TRUNC, MATERIALIZED, and PAUSE**
My understanding is that by adding them to the **identifierKeywordsUnambiguous** in BaseRule.g4, they can be used in places where identifiers are expected. My reasoning is as follows:
The identifier usage chain is:
tableName → name → identifier
columnName → identifier
and **identifier** includes **identifierKeywordsUnambiguous**.
This means that they can be used as identifiers such as table names, column names, and database names without requiring quotation marks.
In a previous commit, I have added corresponding test cases to verify this behavior in:
case/ddl/create-table.xml
case/dml/select.xml
case/dml/update.xml
as well as the related files under sql/supported/ddl.
3. **About the scope of this PR**
This PR is intentionally scoped as parser-only support. I have clarified this scope explicitly in this PR description and document the known limitation that these statements are not executable yet.
Thanks again for your time, review, and valuable guidance.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support parsing Doris VIEW/MATERIALIZED VIEW syntax [shardingsphere]
Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu commented on PR #37831:
URL: https://github.com/apache/shardingsphere/pull/37831#issuecomment-3835956610
This PR is becoming increasingly complex.
Could you consider rewriting it by splitting the tasks and submitting smaller, incremental pull requests separately?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support parsing Doris VIEW/MATERIALIZED VIEW syntax [shardingsphere]
Posted by "ccxxxyy (via GitHub)" <gi...@apache.org>.
ccxxxyy commented on PR #37831:
URL: https://github.com/apache/shardingsphere/pull/37831#issuecomment-3818182786
@terrymanu Thank you for your reply and suggestions. I would really appreciate it if you could review the changes when you have some spare time.
I would also like to ask for more concrete guidance on what you referred to as **explicit unsupported-path handling**, as this is currently the main blocker for me to move the PR forward.
1. Regarding your first and second points, I have refined the `CREATE VIEW` grammar in DDLStatement.g4 and added two corresponding test cases and assertion results in the relevant files. In order to avoid breaking existing Hive assertion tests, I can not make any changes to CreateViewStatement, so as to prevent conflicts.
2. Regarding **explicit unsupported-path handling**, I hope to successfully implement the explicit unsupported-path handling you mentioned in order to move this PR forward. However, I currently do not have a clear direction and am not sure what the correct approach would be. I would greatly appreciate it if you could provide more concrete guidance on how this should be done. Having a clear direction would be extremely helpful and important to me to proceed correctly.
Thank you very much for your time and guidance! I truly appreciate it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org