This is an automated email from the ASF dual-hosted git repository.
zhonghongsheng 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 42657ee42eb Add OpenGaussSQLParserEngineTest.assertParseCreateIndexSQL
(#37577)
42657ee42eb is described below
commit 42657ee42eb13dc7df73ab84b202928fa2405c98
Author: Hongsheng Zhong <[email protected]>
AuthorDate: Tue Dec 30 13:07:22 2025 +0800
Add OpenGaussSQLParserEngineTest.assertParseCreateIndexSQL (#37577)
---
.../opengauss/OpenGaussSQLParserEngineTest.java | 47 ++++++++++++++++++++++
1 file changed, 47 insertions(+)
diff --git
a/proxy/frontend/dialect/opengauss/src/test/java/org/apache/shardingsphere/sql/parser/engine/opengauss/OpenGaussSQLParserEngineTest.java
b/proxy/frontend/dialect/opengauss/src/test/java/org/apache/shardingsphere/sql/parser/engine/opengauss/OpenGaussSQLParserEngineTest.java
new file mode 100644
index 00000000000..462860f6375
--- /dev/null
+++
b/proxy/frontend/dialect/opengauss/src/test/java/org/apache/shardingsphere/sql/parser/engine/opengauss/OpenGaussSQLParserEngineTest.java
@@ -0,0 +1,47 @@
+/*
+ * 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.engine.opengauss;
+
+import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
+import
org.apache.shardingsphere.infra.binder.context.SQLStatementContextFactory;
+import
org.apache.shardingsphere.infra.binder.context.segment.table.TablesContext;
+import
org.apache.shardingsphere.infra.binder.context.statement.SQLStatementContext;
+import org.apache.shardingsphere.infra.parser.ShardingSphereSQLParserEngine;
+import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
+import org.apache.shardingsphere.sql.parser.engine.api.CacheOption;
+import
org.apache.shardingsphere.sql.parser.statement.core.statement.SQLStatement;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+
+class OpenGaussSQLParserEngineTest {
+
+ private final DatabaseType databaseType =
TypedSPILoader.getService(DatabaseType.class, "openGauss");
+
+ private final ShardingSphereSQLParserEngine parserEngine = new
ShardingSphereSQLParserEngine(databaseType, new CacheOption(2000, 65535L), new
CacheOption(128, 1024L));
+
+ @Test
+ void assertParseCreateIndexSQL() {
+ String sql = "CREATE INDEX idx_user_id ON test.t_order USING btree
(user_id) TABLESPACE pg_default";
+ SQLStatement sqlStatement = parserEngine.parse(sql, false);
+ SQLStatementContext sqlStatementContext =
SQLStatementContextFactory.newInstance(null, sqlStatement, "logic_db");
+ TablesContext tablesContext = sqlStatementContext.getTablesContext();
+ // TODO schema name should be present after supporting schema parsing
+ assertFalse(tablesContext.getSchemaName().isPresent());
+ }
+}