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

removing sqlCommentParseEnabled config in SQLParser rule #29575

Merged
merged 5 commits into from
Dec 28, 2023
Merged

removing sqlCommentParseEnabled config in SQLParser rule #29575

merged 5 commits into from
Dec 28, 2023

Conversation

TherChenYang
Copy link
Collaborator

Fixes #29535.

Changes proposed in this pull request:

  • remove sqlCommentParseEnabled in SQL Parser Rule and kernel
  • remove sqlCommentParseEnabled in DistSQL
  • remove antlr parser Sharding RALStatement sqlCommentParseEnabled
  • remove sqlCommentParseEnabled in doc, and update SQL Hint usage description

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.

Copy link
Member

@strongduanmu strongduanmu left a comment

Choose a reason for hiding this comment

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

LGTM, merged.

@@ -31,15 +31,15 @@ class SQLStatementParserEngineFactoryTest {

@Test
void assertGetSQLStatementParserEngineNotSame() {
SQLStatementParserEngine before = SQLStatementParserEngineFactory.getSQLStatementParserEngine(databaseType, new CacheOption(2000, 65535L), new CacheOption(128, 1024L), false);
SQLStatementParserEngine after = SQLStatementParserEngineFactory.getSQLStatementParserEngine(databaseType, new CacheOption(2000, 65535L), new CacheOption(128, 1024L), true);
SQLStatementParserEngine before = SQLStatementParserEngineFactory.getSQLStatementParserEngine(databaseType, new CacheOption(2000, 65535L), new CacheOption(64, 1024L));
Copy link
Member

Choose a reason for hiding this comment

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

Why change 128 to 64?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This test class is for testing the getSqlStatementParserEngine method. If the parameters are different, assertNotSame(before, after) should be used. Originally, the sqlCommentParseEnabled parameter was different: true in before and false in after. In the new code, this parameter sqlCommentParseEnabled has been removed, so the test case needs to be adjusted.

@@ -521,8 +521,8 @@ public int[] executeBatch() throws SQLException {

private QueryContext createQueryContext(final String originSQL) {
SQLParserRule sqlParserRule = metaDataContexts.getMetaData().getGlobalRuleMetaData().getSingleRule(SQLParserRule.class);
String sql = sqlParserRule.isSqlCommentParseEnabled() ? originSQL : SQLHintUtils.removeHint(originSQL);
HintValueContext hintValueContext = sqlParserRule.isSqlCommentParseEnabled() ? new HintValueContext() : SQLHintUtils.extractHint(originSQL).orElseGet(HintValueContext::new);
String sql = SQLHintUtils.removeHint(originSQL);
Copy link
Member

Choose a reason for hiding this comment

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

Is this logic wrong?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

image
There is a judgment of 'startWith' in removeHint.

@strongduanmu strongduanmu merged commit b3fed4c into apache:master Dec 28, 2023
134 checks passed
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.

Consider removing sqlCommentParseEnabled config in SQLParser rule
2 participants