You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by du...@apache.org on 2022/07/06 00:55:54 UTC
[shardingsphere] branch master updated: support reindex statement (#18865)
This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 13ede38e3a4 support reindex statement (#18865)
13ede38e3a4 is described below
commit 13ede38e3a4c14f5b1138613e4a75f0d49dde611
Author: RunQi Zhao <40...@users.noreply.github.com>
AuthorDate: Wed Jul 6 08:55:44 2022 +0800
support reindex statement (#18865)
---
.../main/antlr4/imports/postgresql/DDLStatement.g4 | 28 ++++----
.../parser/autogen/PostgreSQLStatementParser.g4 | 1 +
.../impl/PostgreSQLDDLStatementSQLVisitor.java | 7 ++
.../core/database/visitor/SQLVisitorRule.java | 2 +
.../sql/common/statement/ddl/ReindexStatement.java | 28 ++++++++
.../postgresql/ddl/PostgreSQLReindexStatement.java | 29 ++++++++
.../asserts/statement/ddl/DDLStatementAssert.java | 5 ++
.../statement/ddl/impl/ReindexStatementAssert.java | 41 +++++++++++
.../jaxb/cases/domain/SQLParserTestCases.java | 5 ++
.../statement/ddl/ReindexStatementTestCase.java | 26 +++++++
.../src/main/resources/case/ddl/reindex.xml | 28 ++++++++
.../main/resources/sql/supported/ddl/reindex.xml | 28 ++++++++
.../main/resources/sql/unsupported/unsupported.xml | 83 ----------------------
13 files changed, 214 insertions(+), 97 deletions(-)
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/DDLStatement.g4 b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/DDLStatement.g4
index ccc34a93684..27631c1f4a9 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/DDLStatement.g4
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/DDLStatement.g4
@@ -1819,20 +1819,8 @@ direction
prepare
: PREPARE name prepTypeClause? AS preparableStmt
;
-
-deallocate
- : DEALLOCATE PREPARE? (name | ALL)
- ;
-
-prepTypeClause
- : LP_ typeList RP_
- ;
-
-refreshMaterializedView
- : REFRESH MATERIALIZED VIEW CONCURRENTLY? qualifiedName withData?
- ;
-reIndex
+reindex
: REINDEX reIndexClauses
;
@@ -1848,7 +1836,7 @@ reindexOptionList
;
reindexOptionElem
- : VERBOSE
+ : VERBOSE | CONCURRENTLY | TABLESPACE
;
reindexTargetMultitable
@@ -1859,6 +1847,18 @@ reindexTargetType
: INDEX | TABLE
;
+deallocate
+ : DEALLOCATE PREPARE? (name | ALL)
+ ;
+
+prepTypeClause
+ : LP_ typeList RP_
+ ;
+
+refreshMaterializedView
+ : REFRESH MATERIALIZED VIEW CONCURRENTLY? qualifiedName withData?
+ ;
+
alterForeignTable
: ALTER FOREIGN TABLE ifExists? relationExpr alterForeignTableClauses
;
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/PostgreSQLStatementParser.g4 b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/PostgreSQLStatementParser.g4
index cefbbc46325..b59f513c570 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/PostgreSQLStatementParser.g4
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/PostgreSQLStatementParser.g4
@@ -165,5 +165,6 @@ execute
| prepareTransaction
| reassignOwned
| refreshMatViewStmt
+ | reindex
) SEMI_? EOF
;
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/impl/PostgreSQLDDLStatementSQLVisitor.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/impl/PostgreSQLDDLStatementSQLVisitor.java
index 6cc76f904ca..6cd7b3c247b 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/impl/PostgreSQLDDLStatementSQLVisitor.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/impl/PostgreSQLDDLStatementSQLVisitor.java
@@ -159,6 +159,7 @@ import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.Tr
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.UnlistenContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.ValidateConstraintSpecificationContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.RefreshMatViewStmtContext;
+import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.ReindexContext;
import org.apache.shardingsphere.sql.parser.sql.common.constant.DirectionType;
import org.apache.shardingsphere.sql.parser.sql.common.segment.ddl.AlterDefinitionSegment;
import org.apache.shardingsphere.sql.parser.sql.common.segment.ddl.CreateDefinitionSegment;
@@ -284,6 +285,7 @@ import org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.ddl
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.ddl.PostgreSQLNotifyStmtStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.ddl.PostgreSQLPrepareStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.ddl.PostgreSQLRefreshMatViewStmtStatement;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.ddl.PostgreSQLReindexStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.ddl.PostgreSQLTruncateStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.ddl.PostgreSQLUnlistenStatement;
@@ -1295,4 +1297,9 @@ public final class PostgreSQLDDLStatementSQLVisitor extends PostgreSQLStatementS
public ASTNode visitRefreshMatViewStmt(final RefreshMatViewStmtContext ctx) {
return new PostgreSQLRefreshMatViewStmtStatement();
}
+
+ @Override
+ public ASTNode visitReindex(final ReindexContext ctx) {
+ return new PostgreSQLReindexStatement();
+ }
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java
index 3216cf38b2b..d0c7ec04fd5 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java
@@ -250,6 +250,8 @@ public enum SQLVisitorRule {
REFRESH_MATERIALIZED_VIEW("RefreshMatViewStmt", SQLStatementType.DDL),
+ REINDEX("Reindex", SQLStatementType.DDL),
+
UNLISTEN("Unlisten", SQLStatementType.DDL),
SET_CONSTRAINTS("SetConstraints", SQLStatementType.TCL),
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/statement/ddl/ReindexStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/statement/ddl/ReindexStatement.java
new file mode 100644
index 00000000000..61ddc84b47d
--- /dev/null
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/statement/ddl/ReindexStatement.java
@@ -0,0 +1,28 @@
+/*
+ * 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.sql.common.statement.ddl;
+
+import lombok.ToString;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.AbstractSQLStatement;
+
+/**
+ * Reindex statement.
+ */
+@ToString
+public abstract class ReindexStatement extends AbstractSQLStatement implements DDLStatement {
+}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/postgresql/ddl/PostgreSQLReindexStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/postgresql/ddl/PostgreSQLReindexStatement.java
new file mode 100644
index 00000000000..e87564721b4
--- /dev/null
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/postgresql/ddl/PostgreSQLReindexStatement.java
@@ -0,0 +1,29 @@
+/*
+ * 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.sql.dialect.statement.postgresql.ddl;
+
+import lombok.ToString;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.ReindexStatement;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.PostgreSQLStatement;
+
+/**
+ * PostgreSQL reindex statement.
+ */
+@ToString
+public final class PostgreSQLReindexStatement extends ReindexStatement implements PostgreSQLStatement {
+}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/ddl/DDLStatementAssert.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/ddl/DDLStatementAssert.java
index cd29b20f1b1..768cb06d4c0 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/ddl/DDLStatementAssert.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/ddl/DDLStatementAssert.java
@@ -35,6 +35,7 @@ import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.FetchStatem
import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.ListenStatement;
import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.MoveStatement;
import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.NotifyStmtStatement;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.ReindexStatement;
import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.RefreshMatViewStmtStatement;
import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.RenameTableStatement;
import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.TruncateStatement;
@@ -71,6 +72,7 @@ import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.ddl.impl.NoAuditStatementAssert;
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.ddl.impl.NotifyStmtStatementAssert;
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.ddl.impl.RefreshMatViewStmtStatementAssert;
+import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.ddl.impl.ReindexStatementAssert;
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.ddl.impl.RenameTableStatementAssert;
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.ddl.impl.TruncateStatementAssert;
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.ddl.impl.ListenStatementAssert;
@@ -99,6 +101,7 @@ import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.NoAuditStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.NotifyStmtStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.RefreshMatViewStmtStatementTestCase;
+import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.ReindexStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.RenameTableStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.TruncateStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.ListenStatementTestCase;
@@ -172,6 +175,8 @@ public final class DDLStatementAssert {
NotifyStmtStatementAssert.assertIs(assertContext, (NotifyStmtStatement) actual, (NotifyStmtStatementTestCase) expected);
} else if (actual instanceof RefreshMatViewStmtStatement) {
RefreshMatViewStmtStatementAssert.assertIs(assertContext, (RefreshMatViewStmtStatement) actual, (RefreshMatViewStmtStatementTestCase) expected);
+ } else if (actual instanceof ReindexStatement) {
+ ReindexStatementAssert.assertIs(assertContext, (ReindexStatement) actual, (ReindexStatementTestCase) expected);
}
}
}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/ddl/impl/ReindexStatementAssert.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/ddl/impl/ReindexStatementAssert.java
new file mode 100644
index 00000000000..46eacbb2a7a
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/ddl/impl/ReindexStatementAssert.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.sql.parser.parameterized.asserts.statement.ddl.impl;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.ReindexStatement;
+import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.SQLCaseAssertContext;
+import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.ReindexStatementTestCase;
+
+/**
+ * Reindex statement assert.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class ReindexStatementAssert {
+
+ /**
+ * Assert reindex statement is correct with expected parser result.
+ *
+ * @param assertContext assert context
+ * @param actual actual reindex statement
+ * @param expected expected reindex statement test case
+ */
+ public static void assertIs(final SQLCaseAssertContext assertContext, final ReindexStatement actual, final ReindexStatementTestCase expected) {
+ }
+}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
index d18ffddef2f..6b08dc7e278 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
@@ -242,6 +242,7 @@ import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.PreparedStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.PurgeStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.RefreshMatViewStmtStatementTestCase;
+import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.ReindexStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.RenameStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.RenameTableStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.TruncateStatementTestCase;
@@ -1352,6 +1353,9 @@ public final class SQLParserTestCases {
@XmlElement(name = "refresh-materialized-view")
private final List<RefreshMatViewStmtStatementTestCase> refreshMatViewStmtStatementTestCases = new LinkedList<>();
+ @XmlElement(name = "reindex")
+ private final List<ReindexStatementTestCase> reindexStatementTestCases = new LinkedList<>();
+
@XmlElement(name = "unlisten")
private final List<UnlistenStatementTestCase> unlistenTestCases = new LinkedList<>();
@@ -1879,6 +1883,7 @@ public final class SQLParserTestCases {
putAll(listenTestCases, result);
putAll(notifyTestCases, result);
putAll(refreshMatViewStmtStatementTestCases, result);
+ putAll(reindexStatementTestCases, result);
putAll(unlistenTestCases, result);
putAll(createLockdownProfileTestCases, result);
putAll(dropLockdownProfileTestCases, result);
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/ddl/ReindexStatementTestCase.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/ddl/ReindexStatementTestCase.java
new file mode 100644
index 00000000000..501d7f369f6
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/ddl/ReindexStatementTestCase.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.sql.parser.parameterized.jaxb.cases.domain.statement.ddl;
+
+import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase;
+
+/**
+ * Reindex test case.
+ */
+public final class ReindexStatementTestCase extends SQLParserTestCase {
+}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/reindex.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/reindex.xml
new file mode 100644
index 00000000000..5f79c4b0522
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/reindex.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<sql-parser-test-cases>
+ <reindex sql-case-id="reindex_concurrently" />
+ <reindex sql-case-id="reindex_verbose" />
+ <reindex sql-case-id="reindex_index_concurrently" />
+ <reindex sql-case-id="reindex_index_concurrently_point" />
+ <reindex sql-case-id="reindex_index" />
+ <reindex sql-case-id="reindex_schema" />
+ <reindex sql-case-id="reindex_system" />
+ <reindex sql-case-id="reindex_table" />
+</sql-parser-test-cases>
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/reindex.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/reindex.xml
new file mode 100644
index 00000000000..18af91e83ae
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/reindex.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<sql-cases>
+ <sql-case id="reindex_concurrently" value="REINDEX (CONCURRENTLY) TABLE concur_reindex_tab;" db-types="PostgreSQL" />
+ <sql-case id="reindex_verbose" value="REINDEX (VERBOSE) TABLE reindex_verbose;" db-types="PostgreSQL" />
+ <sql-case id="reindex_index_concurrently" value="REINDEX INDEX CONCURRENTLY concur_reindex_tab3_c2_excl;" db-types="PostgreSQL" />
+ <sql-case id="reindex_index_concurrently_point" value="REINDEX INDEX CONCURRENTLY pg_toast.pg_toast_1260_index;" db-types="PostgreSQL" />
+ <sql-case id="reindex_index" value="REINDEX INDEX concur_reindex_part;" db-types="PostgreSQL" />
+ <sql-case id="reindex_schema" value="REINDEX SCHEMA CONCURRENTLY pg_catalog;" db-types="PostgreSQL" />
+ <sql-case id="reindex_system" value="REINDEX SYSTEM CONCURRENTLY postgres;" db-types="PostgreSQL" />
+ <sql-case id="reindex_table" value="REINDEX TABLE CONCURRENTLY concur_appclass_tab;" db-types="PostgreSQL" />
+</sql-cases>
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/unsupported/unsupported.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/unsupported/unsupported.xml
index 2cc8d31cf21..739c6bfe9e6 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/unsupported/unsupported.xml
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/unsupported/unsupported.xml
@@ -4627,87 +4627,6 @@
<sql-case id="insert_by_postgresql_source_test_case395" value="INSERT INTO truncate_b DEFAULT VALUES;" db-types="PostgreSQL" />
<sql-case id="insert_by_postgresql_source_test_case396" value="INSERT INTO truncate_b DEFAULT VALUES;" db-types="PostgreSQL" />
<sql-case id="insert_by_postgresql_source_test_case428" value="INSERT INTO y2 (SELECT x, md5(x::text) FROM generate_series(0,20) x);" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case1" value="REINDEX (CONCURRENTLY) TABLE concur_reindex_tab;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case2" value="REINDEX (VERBOSE) TABLE reindex_verbose;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case3" value="REINDEX INDEX CONCURRENTLY concur_reindex_tab3_c2_excl;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case4" value="REINDEX INDEX CONCURRENTLY concur_reindex_ind1;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case5" value="REINDEX INDEX CONCURRENTLY concur_reindex_ind5;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case6" value="REINDEX INDEX CONCURRENTLY concur_reindex_ind5;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case7" value="REINDEX INDEX CONCURRENTLY concur_reindex_part;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case8" value="REINDEX INDEX CONCURRENTLY concur_reindex_part_10;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case9" value="REINDEX INDEX CONCURRENTLY concur_reindex_part_index;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case10" value="REINDEX INDEX CONCURRENTLY concur_reindex_part_index_0_1;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case11" value="REINDEX INDEX CONCURRENTLY concur_reindex_part_index_0_2;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case12" value="REINDEX INDEX CONCURRENTLY concur_temp_ind_1;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case13" value="REINDEX INDEX CONCURRENTLY concur_temp_ind_1;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case14" value="REINDEX INDEX CONCURRENTLY concur_temp_ind_2;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case15" value="REINDEX INDEX CONCURRENTLY concur_temp_ind_3;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case16" value="REINDEX INDEX CONCURRENTLY pg_class_oid_index;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case17" value="REINDEX INDEX CONCURRENTLY pg_toast.pg_toast_1260_index;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case18" value="REINDEX INDEX concur_reindex_part;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case19" value="REINDEX INDEX concur_reindex_part_10;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case20" value="REINDEX INDEX concur_reindex_part_index;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case21" value="REINDEX INDEX concur_reindex_part_index;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case22" value="REINDEX INDEX hash_split_index;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case23" value="REINDEX INDEX pg_class_oid_index;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case24" value="REINDEX INDEX pg_class_oid_index;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case25" value="REINDEX INDEX pg_class_relname_nsp_index;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case26" value="REINDEX INDEX pg_class_relname_nsp_index;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case27" value="REINDEX INDEX pg_database_oid_index;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case28" value="REINDEX INDEX pg_database_oid_index;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case29" value="REINDEX INDEX pg_index_indexrelid_index;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case30" value="REINDEX INDEX pg_index_indexrelid_index;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case31" value="REINDEX INDEX pg_index_indrelid_index;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case32" value="REINDEX INDEX pg_index_indrelid_index;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case33" value="REINDEX INDEX pg_shdescription_o_c_index;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case34" value="REINDEX INDEX pg_shdescription_o_c_index;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case35" value="REINDEX INDEX pg_toast.pg_toast_1260_index;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case36" value="REINDEX INDEX tbl_c1_c2_c3_c4_key;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case37" value="REINDEX INDEX tbl_gist_idx;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case38" value="REINDEX INDEX unlogged1_pkey;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case39" value="REINDEX INDEX unlogged2_pkey;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case40" value="REINDEX SCHEMA CONCURRENTLY pg_catalog;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case41" value="REINDEX SCHEMA CONCURRENTLY schema_to_reindex;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case42" value="REINDEX SCHEMA schema_to_reindex;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case43" value="REINDEX SCHEMA schema_to_reindex;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case44" value="REINDEX SCHEMA schema_to_reindex;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case45" value="REINDEX SCHEMA schema_to_reindex;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case46" value="REINDEX SCHEMA schema_to_reindex;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case47" value="REINDEX SYSTEM CONCURRENTLY postgres;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case48" value="REINDEX TABLE CONCURRENTLY concur_appclass_tab;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case49" value="REINDEX TABLE CONCURRENTLY concur_clustered;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case50" value="REINDEX TABLE CONCURRENTLY concur_exprs_tab;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case51" value="REINDEX TABLE CONCURRENTLY concur_reindex_matview;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case52" value="REINDEX TABLE CONCURRENTLY concur_reindex_part;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case53" value="REINDEX TABLE CONCURRENTLY concur_reindex_part_0_1;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case54" value="REINDEX TABLE CONCURRENTLY concur_reindex_part_0_2;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case55" value="REINDEX TABLE CONCURRENTLY concur_reindex_part_index;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case56" value="REINDEX TABLE CONCURRENTLY concur_reindex_part_index_10;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case57" value="REINDEX TABLE CONCURRENTLY concur_reindex_tab3;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case58" value="REINDEX TABLE CONCURRENTLY concur_reindex_tab4;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case59" value="REINDEX TABLE CONCURRENTLY concur_reindex_tab;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case60" value="REINDEX TABLE CONCURRENTLY concur_reindex_tab;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case61" value="REINDEX TABLE CONCURRENTLY concur_replident;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case62" value="REINDEX TABLE CONCURRENTLY concur_temp_tab_1;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case63" value="REINDEX TABLE CONCURRENTLY concur_temp_tab_2;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case64" value="REINDEX TABLE CONCURRENTLY pg_class;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case65" value="REINDEX TABLE CONCURRENTLY pg_toast.pg_toast_1260;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case66" value="REINDEX TABLE CONCURRENTLY testcomment ;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case67" value="REINDEX TABLE concur_heap;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case68" value="REINDEX TABLE concur_heap;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case69" value="REINDEX TABLE concur_reindex_part;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case70" value="REINDEX TABLE concur_reindex_part;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case71" value="REINDEX TABLE concur_reindex_part_index;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case72" value="REINDEX TABLE concur_reindex_part_index_10;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case73" value="REINDEX TABLE concur_reindex_tab;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case74" value="REINDEX TABLE hs2;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case75" value="REINDEX TABLE pg_class;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case76" value="REINDEX TABLE pg_database;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case77" value="REINDEX TABLE pg_index;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case78" value="REINDEX TABLE pg_operator;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case79" value="REINDEX TABLE pg_shdescription;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case80" value="REINDEX TABLE pg_toast.pg_toast_1260;" db-types="PostgreSQL" />
- <sql-case id="reindex_by_postgresql_source_test_case81" value="REINDEX TABLE testcomment;" db-types="PostgreSQL" />
<sql-case id="reset_by_postgresql_source_test_case1" value="RESET TIME ZONE;" db-types="PostgreSQL" />
<sql-case id="security_by_postgresql_source_test_case1" value="SECURITY LABEL ON TABLE seclabel_tbl1 IS 'classified'; -- fail SECURITY LABEL FOR 'dummy' ON TABLE seclabel_tbl1 IS 'classified'; -- fail SECURITY LABEL ON TABLE seclabel_tbl1 IS '...invalid label...'; -- fail SECURITY LABEL ON TABLE seclabel_tbl3 IS 'unclassified'; -- fail SECURITY LABEL ON ROLE regress_seclabel_user1 IS 'classified'; -- fail SECURITY LA [...]
<sql-case id="select_by_postgresql_source_test_case1" value="SELECT i::text || ':' || COALESCE(v::text, 'NULL') as row, logging_agg_strict(v::text) over wnd as inverse, logging_agg_strict(v::text || CASE WHEN random() < 0 then '?' ELSE '' END) over wnd as noinverse FROM (VALUES (1, 'a'), (2, 'b'), (3, 'c') ) AS t(i, v) WINDOW wnd AS (ORDER BY i ROWS BETWEEN 1 PRECEDING AND CURRENT ROW) ORDER BY i;" db- [...]
@@ -6833,8 +6752,6 @@
<sql-case id="low_prepare_by_postgresql_source_test_case3" value="prepare q as select 'some\more_text' as "a$title", E' #<foo>%&^~|\n{bar}' as "junk", ' ' as "empty", n as int from generate_series(1,2) as n;" db-types="PostgreSQL" />
<sql-case id="low_prepare_by_postgresql_source_test_case4" value="prepare q as select 'some\text' as "a\title", E' <foo>\n<bar>' as "junk", ' ' as "empty", n as int from generate_series(1,2) as n;" db-types="PostgreSQL" />
<sql-case id="low_prepare_by_postgresql_source_test_case5" value="prepare q as select 'some|text' as "a|title", ' ' as "empty ", n as int from generate_series(1,2) as n;" db-types="PostgreSQL" />
- <sql-case id="low_reindex_by_postgresql_source_test_case1" value="reindex index gist_pointidx;" db-types="PostgreSQL" />
- <sql-case id="low_reindex_by_postgresql_source_test_case2" value="reindex index spgist_point_idx;" db-types="PostgreSQL" />
<sql-case id="low_select_by_postgresql_source_test_case2" value="select '"\b\f\r\n\t\v\"\''\\"'::jsonpath;" db-types="PostgreSQL" />
<sql-case id="low_select_by_postgresql_source_test_case3" value="select '[2010-01-01 01:00:00 -05, 2010-01-01 02:00:00 -08)'::tstzrange;" db-types="PostgreSQL" />
<sql-case id="low_select_by_postgresql_source_test_case4" value="select '[2010-01-01 01:00:00 -08, 2010-01-01 02:00:00 -05)'::tstzrange;" db-types="PostgreSQL" />