diff --git a/parser/sql/engine/core/src/main/java/org/apache/shardingsphere/sql/parser/engine/core/database/visitor/SQLVisitorRule.java b/parser/sql/engine/core/src/main/java/org/apache/shardingsphere/sql/parser/engine/core/database/visitor/SQLVisitorRule.java index d99226a161d3f..4d2d581cceab8 100644 --- a/parser/sql/engine/core/src/main/java/org/apache/shardingsphere/sql/parser/engine/core/database/visitor/SQLVisitorRule.java +++ b/parser/sql/engine/core/src/main/java/org/apache/shardingsphere/sql/parser/engine/core/database/visitor/SQLVisitorRule.java @@ -597,8 +597,12 @@ public enum SQLVisitorRule { CLEAN_ALL_PROFILE("CleanAllProfile", SQLStatementType.DAL), + CLEAN_PROFILE("CleanProfile", SQLStatementType.DAL), + PLAN_REPLAYER_PLAY("PlanReplayerPlay", SQLStatementType.DAL), + CREATE_EXTERNAL_RESOURCE("CreateExternalResource", SQLStatementType.DAL), + CREATE_SQL_BLOCK_RULE("CreateSqlBlockRule", SQLStatementType.DAL), DELIMITER("Delimiter", SQLStatementType.DAL), @@ -801,6 +805,8 @@ public enum SQLVisitorRule { CREATE_MATERIALIZED_VIEW("CreateMaterializedView", SQLStatementType.DDL), + DORIS_REFRESH_MATERIALIZED_VIEW("DorisRefreshMaterializedView", SQLStatementType.DDL), + CREATE_MACRO("CreateMacro", SQLStatementType.DDL), DROP_MACRO("DropMacro", SQLStatementType.DDL), diff --git a/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DALStatement.g4 b/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DALStatement.g4 index 79b7b032e0198..211dddd477c1b 100644 --- a/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DALStatement.g4 +++ b/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DALStatement.g4 @@ -447,9 +447,17 @@ cleanAllProfile : CLEAN ALL PROFILE ; +cleanProfile + : CLEAN PROFILE + ; + planReplayerPlay : PLAN REPLAYER PLAY DOUBLE_QUOTED_TEXT ; + +createExternalResource + : CREATE EXTERNAL RESOURCE resourceName PROPERTIES LP_ propertyAssignments RP_ + ; // DORIS ADDED END dorisAlterSystem diff --git a/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DDLStatement.g4 b/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DDLStatement.g4 index 11f92ebdb9427..d7a6ed38f5d6f 100644 --- a/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DDLStatement.g4 +++ b/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DDLStatement.g4 @@ -465,6 +465,18 @@ createMaterializedView ; // DORIS ADDED END +// DORIS ADDED BEGIN +dorisRefreshMaterializedView + : REFRESH MATERIALIZED VIEW name (partitionSpec | COMPLETE | AUTO) + ; +// DORIS ADDED END + +// DORIS ADDED BEGIN +partitionSpec + : PARTITIONS LP_ identifierList RP_ + ; +// DORIS ADDED END + // DORIS ADDED BEGIN buildMode : BUILD (IMMEDIATE | DEFERRED) diff --git a/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DorisKeyword.g4 b/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DorisKeyword.g4 index 55c655c053105..74ac3b7c2b011 100644 --- a/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DorisKeyword.g4 +++ b/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DorisKeyword.g4 @@ -845,6 +845,12 @@ EXTENDED : E X T E N D E D ; +// DORIS ADDED BEGIN +EXTERNAL + : E X T E R N A L + ; +// DORIS ADDED END + // DORIS ADDED BEGIN EXTRACT_URL_PARAMETER : E X T R A C T UL_ U R L UL_ P A R A M E T E R diff --git a/parser/sql/engine/dialect/doris/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/DorisStatement.g4 b/parser/sql/engine/dialect/doris/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/DorisStatement.g4 index c0005b9f93008..1766bb133c825 100644 --- a/parser/sql/engine/dialect/doris/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/DorisStatement.g4 +++ b/parser/sql/engine/dialect/doris/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/DorisStatement.g4 @@ -172,7 +172,10 @@ execute | cancelBackup | cancelLoadStatement | cleanAllProfile + | cleanProfile | planReplayerPlay + | dorisRefreshMaterializedView + | createExternalResource // TODO consider refactor following sytax to SEMI_? EOF ) (SEMI_ EOF? | EOF) | EOF diff --git a/parser/sql/engine/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/engine/doris/visitor/statement/type/DorisDALStatementVisitor.java b/parser/sql/engine/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/engine/doris/visitor/statement/type/DorisDALStatementVisitor.java index e9a56b501325b..c721b1af38665 100644 --- a/parser/sql/engine/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/engine/doris/visitor/statement/type/DorisDALStatementVisitor.java +++ b/parser/sql/engine/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/engine/doris/visitor/statement/type/DorisDALStatementVisitor.java @@ -146,6 +146,8 @@ import org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.PluginPropertyValueContext; import org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AdminCleanTrashContext; import org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CleanAllProfileContext; +import org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CleanProfileContext; +import org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CreateExternalResourceContext; import org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.PlanReplayerPlayContext; import org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.DorisAlterSystemContext; import org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AdminSetReplicaStatusContext; @@ -233,6 +235,8 @@ import org.apache.shardingsphere.sql.parser.statement.core.value.literal.impl.TemporalLiteralValue; import org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisAdminCleanTrashStatement; import org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisCleanAllProfileStatement; +import org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisCleanProfileStatement; +import org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisCreateExternalResourceStatement; import org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisPlanReplayerPlayStatement; import org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisAdminSetReplicaStatusStatement; import org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisAdminSetReplicaVersionStatement; @@ -1272,7 +1276,17 @@ public ASTNode visitAdminCleanTrash(final AdminCleanTrashContext ctx) { public ASTNode visitCleanAllProfile(final CleanAllProfileContext ctx) { return new DorisCleanAllProfileStatement(getDatabaseType()); } - + + @Override + public ASTNode visitCleanProfile(final CleanProfileContext ctx) { + return new DorisCleanProfileStatement(getDatabaseType()); + } + + @Override + public ASTNode visitCreateExternalResource(final CreateExternalResourceContext ctx) { + return new DorisCreateExternalResourceStatement(getDatabaseType()); + } + @Override public ASTNode visitPlanReplayerPlay(final PlanReplayerPlayContext ctx) { return new DorisPlanReplayerPlayStatement(getDatabaseType(), SQLUtils.getExactlyValue(ctx.DOUBLE_QUOTED_TEXT().getText())); diff --git a/parser/sql/engine/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/engine/doris/visitor/statement/type/DorisDDLStatementVisitor.java b/parser/sql/engine/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/engine/doris/visitor/statement/type/DorisDDLStatementVisitor.java index 749f901679041..856c1a92af08d 100644 --- a/parser/sql/engine/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/engine/doris/visitor/statement/type/DorisDDLStatementVisitor.java +++ b/parser/sql/engine/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/engine/doris/visitor/statement/type/DorisDDLStatementVisitor.java @@ -78,6 +78,7 @@ import org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CreateLikeClauseContext; import org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CreateLogfileGroupContext; import org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CreateMaterializedViewContext; +import org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.DorisRefreshMaterializedViewContext; import org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CreateProcedureContext; import org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CreateServerContext; import org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CreateSyncJobContext; @@ -259,6 +260,7 @@ import org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.trigger.DropTriggerStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.view.AlterViewStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.view.CreateMaterializedViewStatement; +import org.apache.shardingsphere.sql.parser.statement.doris.ddl.DorisRefreshMaterializedViewStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.view.CreateViewStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.view.DropViewStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dml.DeleteStatement; @@ -1930,7 +1932,12 @@ public ASTNode visitDeallocate(final DeallocateContext ctx) { public ASTNode visitCreateMaterializedView(final CreateMaterializedViewContext ctx) { return new CreateMaterializedViewStatement(getDatabaseType()); } - + + @Override + public ASTNode visitDorisRefreshMaterializedView(final DorisRefreshMaterializedViewContext ctx) { + return new DorisRefreshMaterializedViewStatement(getDatabaseType()); + } + @Override public ASTNode visitCreateEncryptKey(final CreateEncryptKeyContext ctx) { return new CreateEncryptKeyStatement(getDatabaseType()); diff --git a/parser/sql/statement/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/statement/doris/dal/DorisCleanProfileStatement.java b/parser/sql/statement/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/statement/doris/dal/DorisCleanProfileStatement.java new file mode 100644 index 0000000000000..363c81998b0ec --- /dev/null +++ b/parser/sql/statement/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/statement/doris/dal/DorisCleanProfileStatement.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.sql.parser.statement.doris.dal; + +import org.apache.shardingsphere.database.connector.core.type.DatabaseType; +import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.DALStatement; + +/** + * Clean profile statement for Doris. + */ +public final class DorisCleanProfileStatement extends DALStatement { + + public DorisCleanProfileStatement(final DatabaseType databaseType) { + super(databaseType); + } +} diff --git a/parser/sql/statement/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/statement/doris/dal/DorisCreateExternalResourceStatement.java b/parser/sql/statement/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/statement/doris/dal/DorisCreateExternalResourceStatement.java new file mode 100644 index 0000000000000..5522b38db8690 --- /dev/null +++ b/parser/sql/statement/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/statement/doris/dal/DorisCreateExternalResourceStatement.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.sql.parser.statement.doris.dal; + +import org.apache.shardingsphere.database.connector.core.type.DatabaseType; +import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.DALStatement; + +/** + * Create external resource statement for Doris. + */ +public final class DorisCreateExternalResourceStatement extends DALStatement { + + public DorisCreateExternalResourceStatement(final DatabaseType databaseType) { + super(databaseType); + } +} diff --git a/parser/sql/statement/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/statement/doris/ddl/DorisRefreshMaterializedViewStatement.java b/parser/sql/statement/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/statement/doris/ddl/DorisRefreshMaterializedViewStatement.java new file mode 100644 index 0000000000000..cb6e5d86c7cae --- /dev/null +++ b/parser/sql/statement/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/statement/doris/ddl/DorisRefreshMaterializedViewStatement.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.sql.parser.statement.doris.ddl; + +import org.apache.shardingsphere.database.connector.core.type.DatabaseType; +import org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.DDLStatement; + +/** + * Refresh materialized view statement for Doris. + */ +public final class DorisRefreshMaterializedViewStatement extends DDLStatement { + + public DorisRefreshMaterializedViewStatement(final DatabaseType databaseType) { + super(databaseType); + } +} diff --git a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/DorisDALStatementAssert.java b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/DorisDALStatementAssert.java index 4b29037f42310..5a23eb8957a7b 100644 --- a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/DorisDALStatementAssert.java +++ b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/DorisDALStatementAssert.java @@ -23,6 +23,8 @@ import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.UnsetVariableStatement; import org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisAdminCleanTrashStatement; import org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisCleanAllProfileStatement; +import org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisCleanProfileStatement; +import org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisCreateExternalResourceStatement; import org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisPlanReplayerPlayStatement; import org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisAdminCopyTabletStatement; import org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisAdminSetReplicaStatusStatement; @@ -56,6 +58,8 @@ import org.apache.shardingsphere.test.it.sql.parser.internal.asserts.SQLCaseAssertContext; import org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.doris.type.DorisAdminCleanTrashStatementAssert; import org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.doris.type.DorisCleanAllProfileStatementAssert; +import org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.doris.type.DorisCleanProfileStatementAssert; +import org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.doris.type.DorisCreateExternalResourceStatementAssert; import org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.doris.type.DorisPlanReplayerPlayStatementAssert; import org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.doris.type.DorisAdminCopyTabletStatementAssert; import org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.doris.type.DorisAdminSetReplicaStatusStatementAssert; @@ -90,6 +94,8 @@ import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.SQLParserTestCase; import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisAdminCleanTrashStatementTestCase; import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisCleanAllProfileStatementTestCase; +import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisCleanProfileStatementTestCase; +import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisCreateExternalResourceStatementTestCase; import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisPlanReplayerPlayStatementTestCase; import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisAdminCopyTabletStatementTestCase; import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisAdminSetReplicaStatusStatementTestCase; @@ -200,6 +206,10 @@ public static void assertIs(final SQLCaseAssertContext assertContext, final DALS DorisShowLoadWarningsStatementAssert.assertIs(assertContext, (DorisShowLoadWarningsStatement) actual, (DorisShowLoadWarningsStatementTestCase) expected); } else if (actual instanceof DorisCleanAllProfileStatement) { DorisCleanAllProfileStatementAssert.assertIs(assertContext, (DorisCleanAllProfileStatement) actual, (DorisCleanAllProfileStatementTestCase) expected); + } else if (actual instanceof DorisCleanProfileStatement) { + DorisCleanProfileStatementAssert.assertIs(assertContext, (DorisCleanProfileStatement) actual, (DorisCleanProfileStatementTestCase) expected); + } else if (actual instanceof DorisCreateExternalResourceStatement) { + DorisCreateExternalResourceStatementAssert.assertIs(assertContext, (DorisCreateExternalResourceStatement) actual, (DorisCreateExternalResourceStatementTestCase) expected); } else if (actual instanceof DorisPlanReplayerPlayStatement) { DorisPlanReplayerPlayStatementAssert.assertIs(assertContext, (DorisPlanReplayerPlayStatement) actual, (DorisPlanReplayerPlayStatementTestCase) expected); } diff --git a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisCleanProfileStatementAssert.java b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisCleanProfileStatementAssert.java new file mode 100644 index 0000000000000..7ad2f78edbd8a --- /dev/null +++ b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisCleanProfileStatementAssert.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.doris.type; + +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +import org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisCleanProfileStatement; +import org.apache.shardingsphere.test.it.sql.parser.internal.asserts.SQLCaseAssertContext; +import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisCleanProfileStatementTestCase; + +/** + * Clean profile statement assert for Doris. + */ +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public final class DorisCleanProfileStatementAssert { + + /** + * Assert clean profile statement is correct with expected parser result. + * + * @param assertContext assert context + * @param actual actual clean profile statement + * @param expected expected clean profile statement test case + */ + public static void assertIs(final SQLCaseAssertContext assertContext, final DorisCleanProfileStatement actual, final DorisCleanProfileStatementTestCase expected) { + } +} diff --git a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisCreateExternalResourceStatementAssert.java b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisCreateExternalResourceStatementAssert.java new file mode 100644 index 0000000000000..79982feb2e6fe --- /dev/null +++ b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisCreateExternalResourceStatementAssert.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.doris.type; + +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +import org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisCreateExternalResourceStatement; +import org.apache.shardingsphere.test.it.sql.parser.internal.asserts.SQLCaseAssertContext; +import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisCreateExternalResourceStatementTestCase; + +/** + * Create external resource statement assert for Doris. + */ +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public final class DorisCreateExternalResourceStatementAssert { + + /** + * Assert create external resource statement is correct with expected parser result. + * + * @param assertContext assert context + * @param actual actual create external resource statement + * @param expected expected create external resource statement test case + */ + public static void assertIs(final SQLCaseAssertContext assertContext, final DorisCreateExternalResourceStatement actual, final DorisCreateExternalResourceStatementTestCase expected) { + } +} diff --git a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/dialect/doris/DorisDDLStatementAssert.java b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/dialect/doris/DorisDDLStatementAssert.java index a599476572665..61d9d6a795350 100644 --- a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/dialect/doris/DorisDDLStatementAssert.java +++ b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/dialect/doris/DorisDDLStatementAssert.java @@ -28,6 +28,7 @@ import org.apache.shardingsphere.sql.parser.statement.doris.ddl.DorisAlterJobStatement; import org.apache.shardingsphere.sql.parser.statement.doris.ddl.DorisDropJobStatement; import org.apache.shardingsphere.sql.parser.statement.doris.ddl.DorisPauseJobStatement; +import org.apache.shardingsphere.sql.parser.statement.doris.ddl.DorisRefreshMaterializedViewStatement; import org.apache.shardingsphere.sql.parser.statement.doris.ddl.DorisResumeJobStatement; import org.apache.shardingsphere.sql.parser.statement.doris.ddl.DorisResumeSyncJobStatement; import org.apache.shardingsphere.sql.parser.statement.doris.ddl.DorisPauseSyncJobStatement; @@ -38,11 +39,13 @@ import org.apache.shardingsphere.test.it.sql.parser.internal.asserts.SQLCaseAssertContext; import org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ddl.dialect.doris.type.DorisAlterColocateGroupStatementAssert; import org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ddl.dialect.doris.type.DorisAlterStoragePolicyStatementAssert; +import org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ddl.dialect.doris.type.DorisRefreshMaterializedViewStatementAssert; import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.SQLParserTestCase; import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.dialect.doris.DorisAlterColocateGroupStatementTestCase; import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.dialect.doris.DorisAlterStoragePolicyStatementTestCase; import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.dialect.doris.DorisCreateJobStatementTestCase; import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.dialect.doris.DorisDropFunctionStatementTestCase; +import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.dialect.doris.DorisRefreshMaterializedViewStatementTestCase; import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.dialect.doris.DorisCancelTaskStatementTestCase; import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.dialect.doris.DorisAlterJobStatementTestCase; import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.dialect.doris.DorisDropJobStatementTestCase; @@ -99,6 +102,8 @@ public static void assertIs(final SQLCaseAssertContext assertContext, final DDLS DorisCreateStreamingJobStatementAssert.assertIs(assertContext, (DorisCreateStreamingJobStatement) actual, (DorisCreateStreamingJobStatementTestCase) expected); } else if (actual instanceof DorisCancelTaskStatement) { DorisCancelTaskStatementAssert.assertIs(assertContext, (DorisCancelTaskStatement) actual, (DorisCancelTaskStatementTestCase) expected); + } else if (actual instanceof DorisRefreshMaterializedViewStatement) { + DorisRefreshMaterializedViewStatementAssert.assertIs(assertContext, (DorisRefreshMaterializedViewStatement) actual, (DorisRefreshMaterializedViewStatementTestCase) expected); } } } diff --git a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/dialect/doris/type/DorisRefreshMaterializedViewStatementAssert.java b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/dialect/doris/type/DorisRefreshMaterializedViewStatementAssert.java new file mode 100644 index 0000000000000..0b810a8a6691c --- /dev/null +++ b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/dialect/doris/type/DorisRefreshMaterializedViewStatementAssert.java @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ddl.dialect.doris.type; + +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +import org.apache.shardingsphere.sql.parser.statement.doris.ddl.DorisRefreshMaterializedViewStatement; +import org.apache.shardingsphere.test.it.sql.parser.internal.asserts.SQLCaseAssertContext; +import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.dialect.doris.DorisRefreshMaterializedViewStatementTestCase; + +/** + * Refresh materialized view statement assert for Doris. + */ +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public final class DorisRefreshMaterializedViewStatementAssert { + + /** + * Assert refresh materialized view statement is correct with expected parser result. + * + * @param assertContext assert context + * @param actual actual refresh materialized view statement + * @param expected expected refresh materialized view statement test case + */ + public static void assertIs(final SQLCaseAssertContext assertContext, final DorisRefreshMaterializedViewStatement actual, + final DorisRefreshMaterializedViewStatementTestCase expected) { + } +} diff --git a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/RootSQLParserTestCases.java b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/RootSQLParserTestCases.java index 47a55c957189a..57a8952ba8a2f 100644 --- a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/RootSQLParserTestCases.java +++ b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/RootSQLParserTestCases.java @@ -23,6 +23,8 @@ import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.CommonStatementTestCase; import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisAdminCleanTrashStatementTestCase; import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisCleanAllProfileStatementTestCase; +import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisCleanProfileStatementTestCase; +import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisCreateExternalResourceStatementTestCase; import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisPlanReplayerPlayStatementTestCase; import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisAdminCopyTabletStatementTestCase; import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisAdminSetReplicaStatusStatementTestCase; @@ -36,6 +38,7 @@ import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.dialect.doris.DorisAlterColocateGroupStatementTestCase; import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.dialect.doris.DorisAlterStoragePolicyStatementTestCase; import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.dialect.doris.DorisDropFunctionStatementTestCase; +import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.dialect.doris.DorisRefreshMaterializedViewStatementTestCase; import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.dialect.doris.DorisAlterJobStatementTestCase; import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.dialect.doris.DorisDropJobStatementTestCase; import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.dialect.doris.DorisPauseJobStatementTestCase; @@ -574,6 +577,9 @@ public final class RootSQLParserTestCases { @XmlElement(name = "rename-table") private final List renameTableTestCases = new LinkedList<>(); + @XmlElement(name = "doris-refresh-materialized-view") + private final List dorisRefreshMaterializedViewTestCases = new LinkedList<>(); + @XmlElement(name = "resume-job") private final List resumeJobTestCases = new LinkedList<>(); @@ -795,7 +801,13 @@ public final class RootSQLParserTestCases { @XmlElement(name = "clean-all-profile") private final List cleanAllProfileTestCases = new LinkedList<>(); - + + @XmlElement(name = "clean-profile") + private final List cleanProfileTestCases = new LinkedList<>(); + + @XmlElement(name = "create-external-resource") + private final List createExternalResourceTestCases = new LinkedList<>(); + @XmlElement(name = "plan-replayer-play") private final List planReplayerPlayTestCases = new LinkedList<>(); diff --git a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/dal/dialect/doris/DorisCleanProfileStatementTestCase.java b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/dal/dialect/doris/DorisCleanProfileStatementTestCase.java new file mode 100644 index 0000000000000..3720f62e2aa58 --- /dev/null +++ b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/dal/dialect/doris/DorisCleanProfileStatementTestCase.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris; + +import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.SQLParserTestCase; + +/** + * Clean profile statement test case for Doris. + */ +public final class DorisCleanProfileStatementTestCase extends SQLParserTestCase { +} diff --git a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/dal/dialect/doris/DorisCreateExternalResourceStatementTestCase.java b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/dal/dialect/doris/DorisCreateExternalResourceStatementTestCase.java new file mode 100644 index 0000000000000..b92b7d2c5f220 --- /dev/null +++ b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/dal/dialect/doris/DorisCreateExternalResourceStatementTestCase.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris; + +import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.SQLParserTestCase; + +/** + * Create external resource statement test case for Doris. + */ +public final class DorisCreateExternalResourceStatementTestCase extends SQLParserTestCase { +} diff --git a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/ddl/dialect/doris/DorisRefreshMaterializedViewStatementTestCase.java b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/ddl/dialect/doris/DorisRefreshMaterializedViewStatementTestCase.java new file mode 100644 index 0000000000000..335c97407639d --- /dev/null +++ b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/ddl/dialect/doris/DorisRefreshMaterializedViewStatementTestCase.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.dialect.doris; + +import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.SQLParserTestCase; + +/** + * Refresh materialized view statement test case for Doris. + */ +public final class DorisRefreshMaterializedViewStatementTestCase extends SQLParserTestCase { +} diff --git a/test/it/parser/src/main/resources/case/dal/clean-profile.xml b/test/it/parser/src/main/resources/case/dal/clean-profile.xml new file mode 100644 index 0000000000000..ce1752848efcc --- /dev/null +++ b/test/it/parser/src/main/resources/case/dal/clean-profile.xml @@ -0,0 +1,21 @@ + + + + + + diff --git a/test/it/parser/src/main/resources/case/dal/create-external-resource.xml b/test/it/parser/src/main/resources/case/dal/create-external-resource.xml new file mode 100644 index 0000000000000..c2ca88e189966 --- /dev/null +++ b/test/it/parser/src/main/resources/case/dal/create-external-resource.xml @@ -0,0 +1,22 @@ + + + + + + + diff --git a/test/it/parser/src/main/resources/case/ddl/doris-refresh-materialized-view.xml b/test/it/parser/src/main/resources/case/ddl/doris-refresh-materialized-view.xml new file mode 100644 index 0000000000000..a43b9973ab3f3 --- /dev/null +++ b/test/it/parser/src/main/resources/case/ddl/doris-refresh-materialized-view.xml @@ -0,0 +1,23 @@ + + + + + + + + diff --git a/test/it/parser/src/main/resources/sql/supported/dal/clean-profile.xml b/test/it/parser/src/main/resources/sql/supported/dal/clean-profile.xml new file mode 100644 index 0000000000000..751ee92bdaae8 --- /dev/null +++ b/test/it/parser/src/main/resources/sql/supported/dal/clean-profile.xml @@ -0,0 +1,21 @@ + + + + + + diff --git a/test/it/parser/src/main/resources/sql/supported/dal/create-external-resource.xml b/test/it/parser/src/main/resources/sql/supported/dal/create-external-resource.xml new file mode 100644 index 0000000000000..98749354a686c --- /dev/null +++ b/test/it/parser/src/main/resources/sql/supported/dal/create-external-resource.xml @@ -0,0 +1,22 @@ + + + + + + + diff --git a/test/it/parser/src/main/resources/sql/supported/ddl/doris-refresh-materialized-view.xml b/test/it/parser/src/main/resources/sql/supported/ddl/doris-refresh-materialized-view.xml new file mode 100644 index 0000000000000..332431891c58d --- /dev/null +++ b/test/it/parser/src/main/resources/sql/supported/ddl/doris-refresh-materialized-view.xml @@ -0,0 +1,23 @@ + + + + + + + +