You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by wu...@apache.org on 2021/06/04 02:46:37 UTC

[shardingsphere] branch opengauss_adapt updated (5bae300 -> 195b66a)

This is an automated email from the ASF dual-hosted git repository.

wuweijie pushed a change to branch opengauss_adapt
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git.


 discard 5bae300  add jdbc:opengauss supoort (#10601)
 discard 69f7895  Update OpenGaussDataSourceMetaData
 discard 358c05a  Add OpenGauss Database type (#10292)
     add 568e8cd  Update documents dev-manual/proxy (#10621)
     add 5e4b14e  fix select with group by rewrite error (#10620)
     add ff4b505  Refactor gov.registry.node package (#10622)
     add 9500ee6  Revert DataSourceChangedEvent (#10623)
     add ce94a2a  Refactor RDL backend handler (#10624)
     add d4d1ca2  Minor refactor for RQL (#10625)
     add 1a31bbc  Refactor DropResourceBackendHandler (#10628)
     add 7c42a4e  Return no generated key for PostgreSQL (#10627)
     add a54ae1d  Fix PostgreSQL select no columns cause NPE (#10632)
     add dc033b4  Fix Row Description may be missing for PostgreSQL (#10636)
     add acbf570  Add SQLNotificationEvent (#10637)
     add face266  fix group by having merge result error (#10639)
     add a0d369f  Minor refactor for RDL (#10643)
     add 7e5257b  Refactor database created & dropped event (#10648)
     new c1cf25f  Add OpenGauss Database type (#10292)
     new d08ebb6  Update OpenGaussDataSourceMetaData
     new 195b66a  add jdbc:opengauss supoort (#10601)

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (5bae300)
            \
             N -- N -- N   refs/heads/opengauss_adapt (195b66a)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 docs/document/content/dev-manual/proxy.cn.md       |  11 +++
 docs/document/content/dev-manual/proxy.en.md       |  11 +++
 .../merge/dal/show/LogicTablesMergedResult.java    |   5 +-
 .../merge/dal/show/ShowIndexMergedResult.java      |   5 +-
 .../merge/dql/ShardingDQLResultMerger.java         |  35 +++++--
 .../dql/groupby/GroupByMemoryMergedResult.java     |   5 +-
 .../having/HavingDecoratorMergedResult.java        |  84 +++++++++++++++++
 .../merge/ShardingResultMergerEngineTest.java      |   2 +-
 .../merge/dql/ShardingDQLResultMergerTest.java     |  62 ++++++-------
 .../dql/groupby/GroupByMemoryMergedResultTest.java |   2 +-
 .../dql/groupby/GroupByRowComparatorTest.java      |  16 ++--
 .../dql/groupby/GroupByStreamMergedResultTest.java |   2 +-
 .../iterator/IteratorStreamMergedResultTest.java   |   2 +-
 .../dql/orderby/OrderByStreamMergedResultTest.java |   2 +-
 .../merge/dql/orderby/OrderByValueTest.java        |   6 +-
 .../pagination/LimitDecoratorMergedResultTest.java |   6 +-
 .../RowNumberDecoratorMergedResultTest.java        |  16 ++--
 .../TopAndRowNumberDecoratorMergedResultTest.java  |  10 +-
 .../generator/impl/OrderByTokenGenerator.java      |  22 +----
 .../src/test/resources/sharding/select.xml         |  16 +++-
 .../listener/PrivilegeNodeChangedWatcher.java      |   2 +-
 .../metadata/GovernanceMetaDataContexts.java       |  16 ++--
 .../metadata/GovernanceMetaDataContextsTest.java   |  12 +--
 .../instance => }/GovernanceInstance.java          |   2 +-
 .../core/lock/service/LockRegistryService.java     |   4 +-
 .../governance/core/registry/RegistryCenter.java   |   8 +-
 ...CreatedEvent.java => SQLNotificationEvent.java} |  13 +--
 .../core/registry/cache/RegistryCacheManager.java  |   1 +
 .../cache/{ => event}/StartScalingEvent.java       |   2 +-
 .../core/registry/cache/{ => node}/CacheNode.java  |   2 +-
 .../ScalingRegistrySubscriber.java                 |   6 +-
 ...va => DataSourceAddedSQLNotificationEvent.java} |   6 +-
 ...teredEvent.java => DataSourceChangedEvent.java} |   4 +-
 .../DataSourceDroppedSQLNotificationEvent.java}    |  10 +-
 ...ConfigurationsAlteredSQLNotificationEvent.java} |   5 +-
 .../config/{service => }/node/GlobalNode.java      |   2 +-
 .../{service => }/node/SchemaMetadataNode.java     |   2 +-
 .../service/impl/DataSourceRegistryService.java    |  20 ++--
 .../service/impl/GlobalRuleRegistryService.java    |   4 +-
 .../service/impl/PropertiesRegistryService.java    |   2 +-
 .../service/impl/SchemaRuleRegistryService.java    |   6 +-
 .../config/watcher/GlobalRuleChangedWatcher.java   |   2 +-
 .../config/watcher/PropertiesChangedWatcher.java   |   2 +-
 ...va => DatabaseCreatedSQLNotificationEvent.java} |   7 +-
 ...va => DatabaseDroppedSQLNotificationEvent.java} |   7 +-
 .../metadata/service/SchemaRegistryService.java    |  22 ++---
 .../metadata/watcher/MetaDataChangedWatcher.java   |  12 +--
 .../process/{service => node}/ProcessNode.java     |   2 +-
 .../ProcessRegistrySubscriber.java                 |   3 +-
 .../state/event/DisabledStateChangedEvent.java     |   2 +-
 .../state/event/PrimaryStateChangedEvent.java      |   2 +-
 .../state/{service => node}/StatesNode.java        |   4 +-
 .../service/DataSourceStatusRegistryService.java   |   1 +
 .../watcher/DataSourceStateChangedWatcher.java     |   2 +-
 .../state/watcher/TerminalStateChangedWatcher.java |   4 +-
 .../{registry => }/schema/GovernanceSchema.java    |   2 +-
 .../schema/GovernanceSchemaGroup.java              |   2 +-
 .../instance => }/GovernanceInstanceTest.java      |   2 +-
 .../ScalingRegistrySubscriberTest.java             |   3 +-
 .../config/{service => }/node/GlobalNodeTest.java  |   2 +-
 .../{service => }/node/SchemaMetadataNodeTest.java |   2 +-
 .../impl/DataSourceRegistryServiceTest.java        |   9 +-
 .../impl/SchemaRuleRegistryServiceTest.java        |   4 +-
 .../service/SchemaRegistryServiceTest.java         |  12 +--
 .../state/{service => node}/StatesNodeTest.java    |   4 +-
 .../DataSourceStatusRegistryServiceTest.java       |   1 +
 .../watcher/DataSourceStateChangedWatcherTest.java |   2 +-
 .../schema/GovernanceSchemaGroupTest.java          |   2 +-
 .../schema/GovernanceSchemaTest.java               |   2 +-
 .../segment/select/groupby/GroupByContext.java     |   2 -
 .../groupby/engine/GroupByContextEngine.java       |   6 +-
 .../binder/segment/select/having/HavingColumn.java |  13 ++-
 .../segment/select/having/HavingContext.java       |  12 ++-
 .../select/having/engine/HavingContextEngine.java  |  93 +++++++++++++++++++
 .../statement/dml/SelectStatementContext.java      |  38 ++++++++
 .../groupby/engine/GroupByContextEngineTest.java   |   2 -
 .../orderby/engine/OrderByContextEngineTest.java   |  10 +-
 .../engine/ProjectionsContextEngineTest.java       |  16 ++--
 .../statement/impl/SelectStatementContextTest.java |  12 +--
 .../metadata/resource/ShardingSphereResource.java  |   2 +-
 .../result/impl/memory/MemoryMergedResult.java     |  17 +++-
 .../result/impl/memory/MemoryQueryResultRow.java   |  13 +++
 .../memory/fixture/TestMemoryMergedResult.java     |   5 +-
 .../generator/generic/RemoveTokenGenerator.java    |   9 ++
 .../GovernanceShardingSphereDataSourceTest.java    |  11 ++-
 .../backend/communication/ProxySQLExecutor.java    |   4 +-
 .../rdl/impl/AddResourceBackendHandler.java        |  10 +-
 .../AlterDatabaseDiscoveryRuleBackendHandler.java  |  84 +++++++----------
 .../rdl/impl/AlterEncryptRuleBackendHandler.java   |  62 ++++++-------
 .../AlterReadwriteSplittingRuleBackendHandler.java |  70 ++++++--------
 ...terShardingBindingTableRulesBackendHandler.java |  57 ++++--------
 ...rShardingBroadcastTableRulesBackendHandler.java |  28 ++----
 .../impl/AlterShardingTableRuleBackendHandler.java |  66 +++++++-------
 .../rdl/impl/CreateDatabaseBackendHandler.java     |   4 +-
 .../CreateDatabaseDiscoveryRuleBackendHandler.java |  62 ++++---------
 .../rdl/impl/CreateEncryptRuleBackendHandler.java  |  55 ++++-------
 ...CreateReadwriteSplittingRuleBackendHandler.java |  63 ++++---------
 ...ateShardingBindingTableRulesBackendHandler.java |  54 ++++-------
 ...eShardingBroadcastTableRulesBackendHandler.java |  25 ++---
 .../CreateShardingTableRuleBackendHandler.java     |  40 +++-----
 .../rdl/impl/DropDatabaseBackendHandler.java       |   4 +-
 .../DropDatabaseDiscoveryRuleBackendHandler.java   |  59 ++++--------
 .../rdl/impl/DropEncryptRuleBackendHandler.java    |  53 ++++-------
 .../DropReadwriteSplittingRuleBackendHandler.java  |  67 ++++----------
 .../rdl/impl/DropResourceBackendHandler.java       |  73 +++++++--------
 ...ropShardingBindingTableRulesBackendHandler.java |   5 +-
 ...pShardingBroadcastTableRulesBackendHandler.java |   5 +-
 .../impl/DropShardingTableRuleBackendHandler.java  |   5 +-
 .../text/distsql/rdl/impl/RDLBackendHandler.java   |  94 +++++++++++++++++++
 .../DatabaseDiscoveryRulesQueryBackendHandler.java |   3 +-
 .../rql/impl/EncryptRulesQueryBackendHandler.java  |   3 +-
 ...ReadwriteSplittingRulesQueryBackendHandler.java |   3 +-
 .../DatabaseCommunicationEngineTest.java           |   5 +-
 .../text/distsql/RDLBackendHandlerFactoryTest.java |   8 +-
 ...terDatabaseDiscoveryRuleBackendHandlerTest.java |   5 +-
 .../impl/AlterEncryptRuleBackendHandlerTest.java   |   5 +-
 ...erReadwriteSplittingRuleBackendHandlerTest.java |   5 +-
 .../AlterShardingTableRuleBackendHandlerTest.java  |  19 +++-
 .../CreateShardingTableRuleBackendHandlerTest.java |   2 +
 ...ropDatabaseDiscoveryRuleBackendHandlerTest.java |   7 +-
 .../impl/DropEncryptRuleBackendHandlerTest.java    |   7 +-
 ...opReadwriteSplittingRuleBackendHandlerTest.java |   7 +-
 .../impl/GovernanceBootstrapInitializerTest.java   |   4 +-
 .../binary/bind/PostgreSQLComBindExecutor.java     |   2 +-
 .../query/text/PostgreSQLComQueryExecutor.java     |  12 +--
 .../binary/bind/PostgreSQLComBindExecutorTest.java |   8 +-
 .../query/text/PostgreSQLComQueryExecutorTest.java |   6 +-
 .../scaling/core/api/ScalingWorker.java            |   2 +-
 .../src/main/antlr4/imports/mysql/BaseRule.g4      |   2 +-
 .../statement/impl/MySQLStatementSQLVisitor.java   | 101 +++++++++++++--------
 .../impl/OracleDMLStatementSQLVisitor.java         |  11 +++
 .../impl/PostgreSQLStatementSQLVisitor.java        |  23 +++++
 .../impl/SQL92DMLStatementSQLVisitor.java          |  15 ++-
 .../impl/SQLServerDMLStatementSQLVisitor.java      |  11 +++
 .../segment/dml/predicate/HavingSegment.java       |  19 ++--
 .../sql/common/segment/generic/WindowSegment.java  |  11 ++-
 .../sql/common/statement/dml/SelectStatement.java  |  12 +++
 .../handler/dml/SelectStatementHandler.java        |  17 ++++
 .../statement/mysql/dml/MySQLSelectStatement.java  |  12 +++
 .../postgresql/dml/PostgreSQLSelectStatement.java  |  14 ++-
 .../handler/dml/SelectStatementHandlerTest.java    |  31 +++++++
 .../asserts/segment/having/HavingClauseAssert.java |  45 +++++++++
 .../statement/dml/impl/SelectStatementAssert.java  |  23 +++++
 .../segment/impl/having/ExpectedHavingClause.java  |  25 ++---
 .../segment/impl/window/ExpectedWindowClause.java  |  20 ++--
 .../statement/dml/SelectStatementTestCase.java     |  10 +-
 .../main/resources/case/dml/select-group-by.xml    |  53 +++++++++++
 .../sql/supported/dml/select-group-by.xml          |   2 +
 148 files changed, 1450 insertions(+), 1000 deletions(-)
 create mode 100644 shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/main/java/org/apache/shardingsphere/sharding/merge/dql/groupby/having/HavingDecoratorMergedResult.java
 rename shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/{registry/instance => }/GovernanceInstance.java (95%)
 copy shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/{metadata/event/MetaDataCreatedEvent.java => SQLNotificationEvent.java} (74%)
 rename shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/cache/{ => event}/StartScalingEvent.java (99%)
 rename shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/cache/{ => node}/CacheNode.java (99%)
 rename shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/cache/{ => subscriber}/ScalingRegistrySubscriber.java (94%)
 rename shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/event/datasource/{DataSourceAddedEvent.java => DataSourceAddedSQLNotificationEvent.java} (85%)
 rename shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/event/datasource/{DataSourceAlteredEvent.java => DataSourceChangedEvent.java} (93%)
 copy shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/event/{rule/RuleConfigurationsAlteredEvent.java => datasource/DataSourceDroppedSQLNotificationEvent.java} (78%)
 copy shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/event/rule/{RuleConfigurationsAlteredEvent.java => RuleConfigurationsAlteredSQLNotificationEvent.java} (83%)
 rename shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/{service => }/node/GlobalNode.java (98%)
 rename shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/{service => }/node/SchemaMetadataNode.java (99%)
 rename shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/metadata/event/{MetaDataCreatedEvent.java => DatabaseCreatedSQLNotificationEvent.java} (79%)
 copy shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/metadata/event/{MetaDataDroppedEvent.java => DatabaseDroppedSQLNotificationEvent.java} (79%)
 rename shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/process/{service => node}/ProcessNode.java (99%)
 rename shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/process/{service => subscriber}/ProcessRegistrySubscriber.java (98%)
 rename shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/state/{service => node}/StatesNode.java (98%)
 rename shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/{registry => }/schema/GovernanceSchema.java (95%)
 rename shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/{registry => }/schema/GovernanceSchemaGroup.java (96%)
 rename shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/{registry/instance => }/GovernanceInstanceTest.java (94%)
 rename shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/cache/{ => subscriber}/ScalingRegistrySubscriberTest.java (96%)
 rename shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/config/{service => }/node/GlobalNodeTest.java (98%)
 rename shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/config/{service => }/node/SchemaMetadataNodeTest.java (99%)
 rename shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/state/{service => node}/StatesNodeTest.java (97%)
 rename shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/{registry => }/schema/GovernanceSchemaGroupTest.java (97%)
 rename shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/{registry => }/schema/GovernanceSchemaTest.java (96%)
 copy shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/metadata/event/MetaDataDroppedEvent.java => shardingsphere-infra/shardingsphere-infra-binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/having/HavingColumn.java (74%)
 rename shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/metadata/event/MetaDataChangedEvent.java => shardingsphere-infra/shardingsphere-infra-binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/having/HavingContext.java (78%)
 create mode 100644 shardingsphere-infra/shardingsphere-infra-binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/having/engine/HavingContextEngine.java
 create mode 100644 shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/RDLBackendHandler.java
 copy shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/event/rule/RuleConfigurationsAlteredEvent.java => shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/segment/dml/predicate/HavingSegment.java (65%)
 rename shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/metadata/event/MetaDataDroppedEvent.java => shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/segment/generic/WindowSegment.java (75%)
 create mode 100644 shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/segment/having/HavingClauseAssert.java
 copy shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/event/rule/RuleConfigurationsAlteredEvent.java => shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/segment/impl/having/ExpectedHavingClause.java (53%)
 rename shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/event/rule/RuleConfigurationsAlteredEvent.java => shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/segment/impl/window/ExpectedWindowClause.java (63%)

[shardingsphere] 03/03: add jdbc:opengauss supoort (#10601)

Posted by wu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

wuweijie pushed a commit to branch opengauss_adapt
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git

commit 195b66a210d0345920f197c8cc9c849aaadee1b3
Author: justbk2015 <24...@qq.com>
AuthorDate: Tue Jun 1 20:38:33 2021 +0800

    add jdbc:opengauss supoort (#10601)
---
 .../dialect/OpenGaussDataSourceMetaData.java       |   2 +-
 .../dialect/OpenGaussTableMetaDataLoader.java      | 144 +++++++++++++++++++++
 ...a.schema.builder.spi.DialectTableMetaDataLoader |   1 +
 .../optimize/context/OptimizeContextFactory.java   |   4 +-
 .../jdbc/recognizer/impl/OpenGaussRecognizer.java  |  44 +++++++
 ...aussStatementMemoryStrictlyFetchSizeSetter.java |  39 ++++++
 ...ion.jdbc.recognizer.spi.JDBCDriverURLRecognizer |   1 +
 ...tatement.StatementMemoryStrictlyFetchSizeSetter |   1 +
 .../src/main/resources/conf/config-sharding.yaml   |   4 +-
 .../postgresql/OpenGaussFrontendEngine.java        |  56 ++++++++
 ...oxy.frontend.spi.DatabaseProtocolFrontendEngine |   1 +
 .../postgresql/parser/OpenGaussParserFacade.java   |  43 ++++++
 .../facade/OpenGaussFormatSQLVisitorFacade.java    |  72 +++++++++++
 .../facade/OpenGaussStatementSQLVisitorFacade.java |  77 +++++++++++
 ...e.shardingsphere.sql.parser.spi.SQLParserFacade |   1 +
 ....shardingsphere.sql.parser.spi.SQLVisitorFacade |   2 +
 .../xa/jta/connection/XAConnectionFactory.java     |   1 +
 .../dialect/OpenGaussXADataSourceDefinition.java   |  39 ++++++
 ...ta.datasource.properties.XADataSourceDefinition |   1 +
 19 files changed, 529 insertions(+), 4 deletions(-)

diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/metadata/dialect/OpenGaussDataSourceMetaData.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/metadata/dialect/OpenGaussDataSourceMetaData.java
index 84974b3..b9837e6 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/metadata/dialect/OpenGaussDataSourceMetaData.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/metadata/dialect/OpenGaussDataSourceMetaData.java
@@ -42,7 +42,7 @@ public final class OpenGaussDataSourceMetaData implements DataSourceMetaData {
     private final String schema;
     
     // TODO fix OpenGauss's url pattern
-    private final Pattern pattern = Pattern.compile("jdbc:openguass://([\\w\\-\\.]+):?([0-9]*),?.*?/([\\w\\-]+)?\\S*", Pattern.CASE_INSENSITIVE);
+    private final Pattern pattern = Pattern.compile("jdbc:opengauss://([\\w\\-\\.]+):?([0-9]*),?.*?/([\\w\\-]+)?\\S*", Pattern.CASE_INSENSITIVE);
     
     public OpenGaussDataSourceMetaData(final String url) {
         Matcher matcher = pattern.matcher(url);
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/builder/loader/dialect/OpenGaussTableMetaDataLoader.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/builder/loader/dialect/OpenGaussTableMetaDataLoader.java
new file mode 100644
index 0000000..9346b5a
--- /dev/null
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/builder/loader/dialect/OpenGaussTableMetaDataLoader.java
@@ -0,0 +1,144 @@
+/*
+ * 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.infra.metadata.schema.builder.loader.dialect;
+
+import org.apache.shardingsphere.infra.metadata.schema.builder.loader.DataTypeLoader;
+import org.apache.shardingsphere.infra.metadata.schema.builder.spi.DialectTableMetaDataLoader;
+import org.apache.shardingsphere.infra.metadata.schema.model.ColumnMetaData;
+import org.apache.shardingsphere.infra.metadata.schema.model.IndexMetaData;
+import org.apache.shardingsphere.infra.metadata.schema.model.TableMetaData;
+
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+/**
+ * Table meta data loader for OpenGauss.
+ */
+public final class OpenGaussTableMetaDataLoader implements DialectTableMetaDataLoader {
+    
+    private static final String BASIC_TABLE_META_DATA_SQL = "SELECT table_name, column_name, data_type, udt_name, column_default FROM information_schema.columns WHERE table_schema = ?";
+    
+    private static final String TABLE_META_DATA_SQL_WITH_EXISTED_TABLES = BASIC_TABLE_META_DATA_SQL + " AND table_name NOT IN (%s)";
+    
+    private static final String PRIMARY_KEY_META_DATA_SQL = "SELECT tc.table_name, kc.column_name FROM information_schema.table_constraints tc"
+            + " JOIN information_schema.key_column_usage kc"
+            + " ON kc.table_schema = tc.table_schema AND kc.table_name = tc.table_name AND kc.constraint_name = tc.constraint_name"
+            + " WHERE tc.constraint_type = 'PRIMARY KEY' AND kc.ordinal_position IS NOT NULL AND kc.table_schema = ?";
+    
+    private static final String BASIC_INDEX_META_DATA_SQL = "SELECT tablename, indexname FROM pg_indexes WHERE schemaname = ?";
+    
+    @Override
+    public Map<String, TableMetaData> load(final DataSource dataSource, final Collection<String> existedTables) throws SQLException {
+        Map<String, TableMetaData> result = new LinkedHashMap<>();
+        Map<String, Collection<IndexMetaData>> indexMetaDataMap = loadIndexMetaDataMap(dataSource);
+        for (Entry<String, Collection<ColumnMetaData>> entry : loadColumnMetaDataMap(dataSource, existedTables).entrySet()) {
+            Collection<IndexMetaData> indexMetaDataList = indexMetaDataMap.get(entry.getKey());
+            if (null == indexMetaDataList) {
+                indexMetaDataList = Collections.emptyList();
+            }
+            result.put(entry.getKey(), new TableMetaData(entry.getValue(), indexMetaDataList));
+        }
+        return result;
+    }
+    
+    private Map<String, Collection<ColumnMetaData>> loadColumnMetaDataMap(final DataSource dataSource, final Collection<String> existedTables) throws SQLException {
+        Map<String, Collection<ColumnMetaData>> result = new HashMap<>();
+        try (Connection connection = dataSource.getConnection();
+             PreparedStatement preparedStatement = connection.prepareStatement(getTableMetaDataSQL(existedTables))) {
+            Map<String, Integer> dataTypes = DataTypeLoader.load(connection.getMetaData());
+            Set<String> primaryKeys = loadPrimaryKeys(connection);
+            preparedStatement.setString(1, connection.getSchema());
+            try (ResultSet resultSet = preparedStatement.executeQuery()) {
+                while (resultSet.next()) {
+                    String tableName = resultSet.getString("table_name");
+                    Collection<ColumnMetaData> columns = result.computeIfAbsent(tableName, key -> new LinkedList<>());
+                    ColumnMetaData columnMetaData = loadColumnMetaData(dataTypes, primaryKeys, resultSet);
+                    columns.add(columnMetaData);
+                }
+            }
+        }
+        return result;
+    }
+    
+    private Set<String> loadPrimaryKeys(final Connection connection) throws SQLException {
+        Set<String> result = new HashSet<>();
+        try (PreparedStatement preparedStatement = connection.prepareStatement(PRIMARY_KEY_META_DATA_SQL)) {
+            preparedStatement.setString(1, connection.getSchema());
+            try (ResultSet resultSet = preparedStatement.executeQuery()) {
+                while (resultSet.next()) {
+                    String tableName = resultSet.getString("table_name");
+                    String columnName = resultSet.getString("column_name");
+                    result.add(tableName + "," + columnName);
+                }
+            }
+        }
+        return result;
+    }
+    
+    private ColumnMetaData loadColumnMetaData(final Map<String, Integer> dataTypeMap, final Set<String> primaryKeys, final ResultSet resultSet) throws SQLException {
+        String tableName = resultSet.getString("table_name");
+        String columnName = resultSet.getString("column_name");
+        String dataType = resultSet.getString("udt_name");
+        boolean isPrimaryKey = primaryKeys.contains(tableName + "," + columnName);
+        String columnDefault = resultSet.getString("column_default");
+        boolean generated = null != columnDefault && columnDefault.startsWith("nextval(");
+        //TODO user defined collation which deterministic is false
+        boolean caseSensitive = true;
+        return new ColumnMetaData(columnName, dataTypeMap.get(dataType), isPrimaryKey, generated, caseSensitive);
+    }
+    
+    private String getTableMetaDataSQL(final Collection<String> existedTables) {
+        return existedTables.isEmpty() ? BASIC_TABLE_META_DATA_SQL
+                : String.format(TABLE_META_DATA_SQL_WITH_EXISTED_TABLES, existedTables.stream().map(each -> String.format("'%s'", each)).collect(Collectors.joining(",")));
+    }
+    
+    private Map<String, Collection<IndexMetaData>> loadIndexMetaDataMap(final DataSource dataSource) throws SQLException {
+        Map<String, Collection<IndexMetaData>> result = new HashMap<>();
+        try (Connection connection = dataSource.getConnection();
+             PreparedStatement preparedStatement = connection.prepareStatement(BASIC_INDEX_META_DATA_SQL)) {
+            preparedStatement.setString(1, connection.getSchema());
+            try (ResultSet resultSet = preparedStatement.executeQuery()) {
+                while (resultSet.next()) {
+                    String tableName = resultSet.getString("tablename");
+                    Collection<IndexMetaData> indexes = result.computeIfAbsent(tableName, k -> new LinkedList<>());
+                    String indexName = resultSet.getString("indexname");
+                    indexes.add(new IndexMetaData(indexName));
+                }
+            }
+        }
+        return result;
+    }
+    
+    @Override
+    public String getDatabaseType() {
+        return "OpenGauss";
+    }
+}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.metadata.schema.builder.spi.DialectTableMetaDataLoader b/shardingsphere-infra/shardingsphere-infra-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.metadata.schema.builder.spi.DialectTableMetaDataLoader
index 9e92eb6..4dbc8ef 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.metadata.schema.builder.spi.DialectTableMetaDataLoader
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.metadata.schema.builder.spi.DialectTableMetaDataLoader
@@ -18,5 +18,6 @@
 org.apache.shardingsphere.infra.metadata.schema.builder.loader.dialect.MySQLTableMetaDataLoader
 org.apache.shardingsphere.infra.metadata.schema.builder.loader.dialect.OracleTableMetaDataLoader
 org.apache.shardingsphere.infra.metadata.schema.builder.loader.dialect.PostgreSQLTableMetaDataLoader
+org.apache.shardingsphere.infra.metadata.schema.builder.loader.dialect.OpenGaussTableMetaDataLoader
 org.apache.shardingsphere.infra.metadata.schema.builder.loader.dialect.SQLServerTableMetaDataLoader
 org.apache.shardingsphere.infra.metadata.schema.builder.loader.dialect.H2TableMetaDataLoader
diff --git a/shardingsphere-infra/shardingsphere-infra-optimize/src/main/java/org/apache/shardingsphere/infra/optimize/context/OptimizeContextFactory.java b/shardingsphere-infra/shardingsphere-infra-optimize/src/main/java/org/apache/shardingsphere/infra/optimize/context/OptimizeContextFactory.java
index c54cb94..372a258 100644
--- a/shardingsphere-infra/shardingsphere-infra-optimize/src/main/java/org/apache/shardingsphere/infra/optimize/context/OptimizeContextFactory.java
+++ b/shardingsphere-infra/shardingsphere-infra-optimize/src/main/java/org/apache/shardingsphere/infra/optimize/context/OptimizeContextFactory.java
@@ -45,6 +45,7 @@ import org.apache.shardingsphere.infra.database.type.DatabaseType;
 import org.apache.shardingsphere.infra.database.type.dialect.H2DatabaseType;
 import org.apache.shardingsphere.infra.database.type.dialect.MariaDBDatabaseType;
 import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
+import org.apache.shardingsphere.infra.database.type.dialect.OpenGaussDatabaseType;
 import org.apache.shardingsphere.infra.database.type.dialect.OracleDatabaseType;
 import org.apache.shardingsphere.infra.database.type.dialect.PostgreSQLDatabaseType;
 import org.apache.shardingsphere.infra.database.type.dialect.SQL92DatabaseType;
@@ -117,7 +118,8 @@ public final class OptimizeContextFactory {
             properties.setProperty(CONFORMANCE_CAMEL_NAME, SqlConformanceEnum.ORACLE_12.name());
             return;
         }
-        if (databaseType instanceof PostgreSQLDatabaseType) {
+        if (databaseType instanceof PostgreSQLDatabaseType
+            || databaseType instanceof OpenGaussDatabaseType) {
             // TODO No suitable type of Lex and conformance
             properties.setProperty(LEX_CAMEL_NAME, Lex.MYSQL.name());
             properties.setProperty(CONFORMANCE_CAMEL_NAME, SqlConformanceEnum.DEFAULT.name());
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/OpenGaussRecognizer.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/OpenGaussRecognizer.java
new file mode 100644
index 0000000..4a545c0
--- /dev/null
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/OpenGaussRecognizer.java
@@ -0,0 +1,44 @@
+/*
+ * 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.proxy.backend.communication.jdbc.recognizer.impl;
+
+import org.apache.shardingsphere.proxy.backend.communication.jdbc.recognizer.spi.JDBCDriverURLRecognizer;
+
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ * JDBC URL recognizer for OpenGauss.
+ */
+public final class OpenGaussRecognizer implements JDBCDriverURLRecognizer {
+    
+    @Override
+    public String getDatabaseType() {
+        return "OpenGauss";
+    }
+    
+    @Override
+    public Collection<String> getURLPrefixes() {
+        return Collections.singletonList("jdbc:opengauss:");
+    }
+    
+    @Override
+    public String getDriverClassName() {
+        return "org.postgresql.OpenGaussDriver";
+    }
+}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/statement/impl/OpenGaussStatementMemoryStrictlyFetchSizeSetter.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/statement/impl/OpenGaussStatementMemoryStrictlyFetchSizeSetter.java
new file mode 100644
index 0000000..0e9fbf1
--- /dev/null
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/statement/impl/OpenGaussStatementMemoryStrictlyFetchSizeSetter.java
@@ -0,0 +1,39 @@
+/*
+ * 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.proxy.backend.communication.jdbc.statement.impl;
+
+import org.apache.shardingsphere.proxy.backend.communication.jdbc.statement.StatementMemoryStrictlyFetchSizeSetter;
+
+import java.sql.SQLException;
+import java.sql.Statement;
+
+/**
+ * Statement memory strictly fetch size setter for OpenGauss.
+ */
+public final class OpenGaussStatementMemoryStrictlyFetchSizeSetter implements StatementMemoryStrictlyFetchSizeSetter {
+    
+    @Override
+    public void setFetchSize(final Statement statement) throws SQLException {
+        statement.setFetchSize(1);
+    }
+    
+    @Override
+    public String getType() {
+        return "OpenGauss";
+    }
+}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/resources/META-INF/services/org.apache.shardingsphere.proxy.backend.communication.jdbc.recognizer.spi.JDBCDriverURLRecognizer b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/resources/META-INF/services/org.apache.shardingsphere.proxy.backend.communication.jdbc.recognizer.spi.JDBCDriverURLRecognizer
index ef113f7..3a86eb7 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/resources/META-INF/services/org.apache.shardingsphere.proxy.backend.communication.jdbc.recognizer.spi.JDBCDriverURLRecognizer
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/resources/META-INF/services/org.apache.shardingsphere.proxy.backend.communication.jdbc.recognizer.spi.JDBCDriverURLRecognizer
@@ -17,6 +17,7 @@
 
 org.apache.shardingsphere.proxy.backend.communication.jdbc.recognizer.impl.MySQLRecognizer
 org.apache.shardingsphere.proxy.backend.communication.jdbc.recognizer.impl.PostgreSQLRecognizer
+org.apache.shardingsphere.proxy.backend.communication.jdbc.recognizer.impl.OpenGaussRecognizer
 org.apache.shardingsphere.proxy.backend.communication.jdbc.recognizer.impl.OracleRecognizer
 org.apache.shardingsphere.proxy.backend.communication.jdbc.recognizer.impl.SQLServerRecognizer
 org.apache.shardingsphere.proxy.backend.communication.jdbc.recognizer.impl.H2Recognizer
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/resources/META-INF/services/org.apache.shardingsphere.proxy.backend.communication.jdbc.statement.StatementMemoryStrictlyFetchSizeSetter b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/resources/META-INF/services/org.apache.shardingsphere.proxy.backend.communication.jdbc.statement.StatementMemoryStrictlyFetchSizeSetter
index 1992b53..077e29e 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/resources/META-INF/services/org.apache.shardingsphere.proxy.backend.communication.jdbc.statement.StatementMemoryStrictlyFetchSizeSetter
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/resources/META-INF/services/org.apache.shardingsphere.proxy.backend.communication.jdbc.statement.StatementMemoryStrictlyFetchSizeSetter
@@ -17,3 +17,4 @@
 
 org.apache.shardingsphere.proxy.backend.communication.jdbc.statement.impl.MySQLStatementMemoryStrictlyFetchSizeSetter
 org.apache.shardingsphere.proxy.backend.communication.jdbc.statement.impl.PostgreSQLStatementMemoryStrictlyFetchSizeSetter
+org.apache.shardingsphere.proxy.backend.communication.jdbc.statement.impl.OpenGaussStatementMemoryStrictlyFetchSizeSetter
diff --git a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/resources/conf/config-sharding.yaml b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/resources/conf/config-sharding.yaml
index 621efaa..f0de349 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/resources/conf/config-sharding.yaml
+++ b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/resources/conf/config-sharding.yaml
@@ -75,7 +75,7 @@
 #      shardingAlgorithmName: database_inline
 #  defaultTableStrategy:
 #    none:
-#  
+#
 #  shardingAlgorithms:
 #    database_inline:
 #      type: INLINE
@@ -89,7 +89,7 @@
 #      type: INLINE
 #      props:
 #        algorithm-expression: t_order_item_${order_id % 2}
-#  
+#
 #  keyGenerators:
 #    snowflake:
 #      type: SNOWFLAKE
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/OpenGaussFrontendEngine.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/OpenGaussFrontendEngine.java
new file mode 100644
index 0000000..41090e1
--- /dev/null
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/OpenGaussFrontendEngine.java
@@ -0,0 +1,56 @@
+/*
+ * 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.proxy.frontend.postgresql;
+
+import lombok.Getter;
+import org.apache.shardingsphere.db.protocol.codec.DatabasePacketCodecEngine;
+import org.apache.shardingsphere.db.protocol.postgresql.codec.PostgreSQLPacketCodecEngine;
+import org.apache.shardingsphere.db.protocol.postgresql.packet.PostgreSQLPacket;
+import org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.binary.PostgreSQLBinaryStatementRegistry;
+import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
+import org.apache.shardingsphere.proxy.frontend.authentication.AuthenticationEngine;
+import org.apache.shardingsphere.proxy.frontend.command.CommandExecuteEngine;
+import org.apache.shardingsphere.proxy.frontend.context.FrontendContext;
+import org.apache.shardingsphere.proxy.frontend.postgresql.authentication.PostgreSQLAuthenticationEngine;
+import org.apache.shardingsphere.proxy.frontend.postgresql.command.PostgreSQLCommandExecuteEngine;
+import org.apache.shardingsphere.proxy.frontend.spi.DatabaseProtocolFrontendEngine;
+
+/**
+ * Frontend engine for OpenGauss.
+ */
+@Getter
+public final class OpenGaussFrontendEngine implements DatabaseProtocolFrontendEngine {
+    
+    private final FrontendContext frontendContext = new FrontendContext(true, false);
+    
+    private final AuthenticationEngine authenticationEngine = new PostgreSQLAuthenticationEngine();
+    
+    private final CommandExecuteEngine commandExecuteEngine = new PostgreSQLCommandExecuteEngine();
+    
+    private final DatabasePacketCodecEngine<PostgreSQLPacket> codecEngine = new PostgreSQLPacketCodecEngine();
+    
+    @Override
+    public void release(final BackendConnection backendConnection) {
+        PostgreSQLBinaryStatementRegistry.getInstance().unregister(backendConnection.getConnectionId());
+    }
+    
+    @Override
+    public String getDatabaseType() {
+        return "OpenGauss";
+    }
+}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/resources/META-INF/services/org.apache.shardingsphere.proxy.frontend.spi.DatabaseProtocolFrontendEngine b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/resources/META-INF/services/org.apache.shardingsphere.proxy.frontend.spi.DatabaseProtocolFrontendEngine
index 05657ad..4f9324e 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/resources/META-INF/services/org.apache.shardingsphere.proxy.frontend.spi.DatabaseProtocolFrontendEngine
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/resources/META-INF/services/org.apache.shardingsphere.proxy.frontend.spi.DatabaseProtocolFrontendEngine
@@ -16,3 +16,4 @@
 #
 
 org.apache.shardingsphere.proxy.frontend.postgresql.PostgreSQLFrontendEngine
+org.apache.shardingsphere.proxy.frontend.postgresql.OpenGaussFrontendEngine
\ No newline at end of file
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/parser/OpenGaussParserFacade.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/parser/OpenGaussParserFacade.java
new file mode 100644
index 0000000..cce6487
--- /dev/null
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/parser/OpenGaussParserFacade.java
@@ -0,0 +1,43 @@
+/*
+ * 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.postgresql.parser;
+
+import org.apache.shardingsphere.sql.parser.api.parser.SQLLexer;
+import org.apache.shardingsphere.sql.parser.api.parser.SQLParser;
+import org.apache.shardingsphere.sql.parser.spi.SQLParserFacade;
+
+/**
+ * SQL parser facade for OpenGauss.
+ */
+public final class OpenGaussParserFacade implements SQLParserFacade {
+    
+    @Override
+    public String getDatabaseType() {
+        return "OpenGauss";
+    }
+    
+    @Override
+    public Class<? extends SQLLexer> getLexerClass() {
+        return PostgreSQLLexer.class;
+    }
+    
+    @Override
+    public Class<? extends SQLParser> getParserClass() {
+        return PostgreSQLParser.class;
+    }
+}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/format/facade/OpenGaussFormatSQLVisitorFacade.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/format/facade/OpenGaussFormatSQLVisitorFacade.java
new file mode 100644
index 0000000..c28e787
--- /dev/null
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/format/facade/OpenGaussFormatSQLVisitorFacade.java
@@ -0,0 +1,72 @@
+/*
+ * 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.postgresql.visitor.format.facade;
+
+import org.apache.shardingsphere.sql.parser.api.visitor.type.DALSQLVisitor;
+import org.apache.shardingsphere.sql.parser.api.visitor.type.DCLSQLVisitor;
+import org.apache.shardingsphere.sql.parser.api.visitor.type.DDLSQLVisitor;
+import org.apache.shardingsphere.sql.parser.api.visitor.type.DMLSQLVisitor;
+import org.apache.shardingsphere.sql.parser.api.visitor.type.RLSQLVisitor;
+import org.apache.shardingsphere.sql.parser.api.visitor.type.TCLSQLVisitor;
+import org.apache.shardingsphere.sql.parser.spi.SQLVisitorFacade;
+
+/**
+ * Format SQL Visitor facade for OpenGauss.
+ */
+public final class OpenGaussFormatSQLVisitorFacade implements SQLVisitorFacade {
+    
+    @Override
+    public Class<? extends DMLSQLVisitor> getDMLVisitorClass() {
+        throw new UnsupportedOperationException();
+    }
+    
+    @Override
+    public Class<? extends DDLSQLVisitor> getDDLVisitorClass() {
+        throw new UnsupportedOperationException();
+    }
+    
+    @Override
+    public Class<? extends TCLSQLVisitor> getTCLVisitorClass() {
+        throw new UnsupportedOperationException();
+    }
+    
+    @Override
+    public Class<? extends DCLSQLVisitor> getDCLVisitorClass() {
+        throw new UnsupportedOperationException();
+    }
+    
+    @Override
+    public Class<? extends DALSQLVisitor> getDALVisitorClass() {
+        throw new UnsupportedOperationException();
+    }
+    
+    @Override
+    public Class<? extends RLSQLVisitor> getRLVisitorClass() {
+        throw new UnsupportedOperationException();
+    }
+    
+    @Override
+    public String getDatabaseType() {
+        return "OpenGauss";
+    }
+    
+    @Override
+    public String getVisitorType() {
+        return "FORMAT";
+    }
+}
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/facade/OpenGaussStatementSQLVisitorFacade.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/facade/OpenGaussStatementSQLVisitorFacade.java
new file mode 100644
index 0000000..a60356a
--- /dev/null
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/facade/OpenGaussStatementSQLVisitorFacade.java
@@ -0,0 +1,77 @@
+/*
+ * 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.postgresql.visitor.statement.facade;
+
+import org.apache.shardingsphere.sql.parser.api.visitor.type.DALSQLVisitor;
+import org.apache.shardingsphere.sql.parser.api.visitor.type.DCLSQLVisitor;
+import org.apache.shardingsphere.sql.parser.api.visitor.type.DDLSQLVisitor;
+import org.apache.shardingsphere.sql.parser.api.visitor.type.DMLSQLVisitor;
+import org.apache.shardingsphere.sql.parser.api.visitor.type.RLSQLVisitor;
+import org.apache.shardingsphere.sql.parser.api.visitor.type.TCLSQLVisitor;
+import org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLDALStatementSQLVisitor;
+import org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLDCLStatementSQLVisitor;
+import org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLDDLStatementSQLVisitor;
+import org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLDMLStatementSQLVisitor;
+import org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLTCLStatementSQLVisitor;
+import org.apache.shardingsphere.sql.parser.spi.SQLVisitorFacade;
+
+/**
+ * Statement SQL Visitor facade for OpenGauss.
+ */
+public final class OpenGaussStatementSQLVisitorFacade implements SQLVisitorFacade {
+    
+    @Override
+    public Class<? extends DMLSQLVisitor> getDMLVisitorClass() {
+        return PostgreSQLDMLStatementSQLVisitor.class;
+    }
+    
+    @Override
+    public Class<? extends DDLSQLVisitor> getDDLVisitorClass() {
+        return PostgreSQLDDLStatementSQLVisitor.class;
+    }
+    
+    @Override
+    public Class<? extends TCLSQLVisitor> getTCLVisitorClass() {
+        return PostgreSQLTCLStatementSQLVisitor.class;
+    }
+    
+    @Override
+    public Class<? extends DCLSQLVisitor> getDCLVisitorClass() {
+        return PostgreSQLDCLStatementSQLVisitor.class;
+    }
+    
+    @Override
+    public Class<? extends DALSQLVisitor> getDALVisitorClass() {
+        return PostgreSQLDALStatementSQLVisitor.class;
+    }
+    
+    @Override
+    public Class<? extends RLSQLVisitor> getRLVisitorClass() {
+        return null;
+    }
+    
+    @Override
+    public String getDatabaseType() {
+        return "OpenGauss";
+    }
+    
+    @Override
+    public String getVisitorType() {
+        return "STATEMENT";
+    }
+}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/resources/META-INF/services/org.apache.shardingsphere.sql.parser.spi.SQLParserFacade b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/resources/META-INF/services/org.apache.shardingsphere.sql.parser.spi.SQLParserFacade
index b5461a9..54ae70b 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/resources/META-INF/services/org.apache.shardingsphere.sql.parser.spi.SQLParserFacade
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/resources/META-INF/services/org.apache.shardingsphere.sql.parser.spi.SQLParserFacade
@@ -16,3 +16,4 @@
 #
 
 org.apache.shardingsphere.sql.parser.postgresql.parser.PostgreSQLParserFacade
+org.apache.shardingsphere.sql.parser.postgresql.parser.OpenGaussParserFacade
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/resources/META-INF/services/org.apache.shardingsphere.sql.parser.spi.SQLVisitorFacade b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/resources/META-INF/services/org.apache.shardingsphere.sql.parser.spi.SQLVisitorFacade
index b1fc497..611c2ec 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/resources/META-INF/services/org.apache.shardingsphere.sql.parser.spi.SQLVisitorFacade
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/resources/META-INF/services/org.apache.shardingsphere.sql.parser.spi.SQLVisitorFacade
@@ -16,4 +16,6 @@
 #
 
 org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.facade.PostgreSQLStatementSQLVisitorFacade
+org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.facade.OpenGaussStatementSQLVisitorFacade
 org.apache.shardingsphere.sql.parser.postgresql.visitor.format.facade.PostgreSQLFormatSQLVisitorFacade
+org.apache.shardingsphere.sql.parser.postgresql.visitor.format.facade.OpenGaussFormatSQLVisitorFacade
diff --git a/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/main/java/org/apache/shardingsphere/transaction/xa/jta/connection/XAConnectionFactory.java b/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/main/java/org/apache/shardingsphere/transaction/xa/jta/connection/XAConnectionFactory.java
index afad978..171a58e 100644
--- a/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/main/java/org/apache/shardingsphere/transaction/xa/jta/connection/XAConnectionFactory.java
+++ b/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/main/java/org/apache/shardingsphere/transaction/xa/jta/connection/XAConnectionFactory.java
@@ -51,6 +51,7 @@ public final class XAConnectionFactory {
             case "MariaDB":
                 return new MariaDBXAConnectionWrapper().wrap(xaDataSource, connection);
             case "PostgreSQL":
+            case "OpenGauss":
                 return new PostgreSQLXAConnectionWrapper().wrap(xaDataSource, connection);
             case "H2":
                 return new H2XAConnectionWrapper().wrap(xaDataSource, connection);
diff --git a/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/main/java/org/apache/shardingsphere/transaction/xa/jta/datasource/properties/dialect/OpenGaussXADataSourceDefinition.java b/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/main/java/org/apache/shardingsphere/transaction/xa/jta/datasource/properties/dialect/OpenGaussXADataSo [...]
new file mode 100644
index 0000000..9905384
--- /dev/null
+++ b/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/main/java/org/apache/shardingsphere/transaction/xa/jta/datasource/properties/dialect/OpenGaussXADataSourceDefinition.java
@@ -0,0 +1,39 @@
+/*
+ * 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.transaction.xa.jta.datasource.properties.dialect;
+
+import org.apache.shardingsphere.transaction.xa.jta.datasource.properties.XADataSourceDefinition;
+
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ * XA data source definition for PostgreSQL.
+ */
+public final class OpenGaussXADataSourceDefinition implements XADataSourceDefinition {
+    
+    @Override
+    public String getDatabaseType() {
+        return "OpenGauss";
+    }
+    
+    @Override
+    public Collection<String> getXADriverClassName() {
+        return Collections.singletonList("org.postgresql.xa.PGXADataSource");
+    }
+}
diff --git a/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/main/resources/META-INF/services/org.apache.shardingsphere.transaction.xa.jta.datasource.properties.XADataSourceDefinition b/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/main/resources/META-INF/services/org.apache.shardingsphere.transaction.xa.jta.datasource.properties.X [...]
index fc31195..6e707a8 100644
--- a/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/main/resources/META-INF/services/org.apache.shardingsphere.transaction.xa.jta.datasource.properties.XADataSourceDefinition
+++ b/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/main/resources/META-INF/services/org.apache.shardingsphere.transaction.xa.jta.datasource.properties.XADataSourceDefinition
@@ -18,6 +18,7 @@
 org.apache.shardingsphere.transaction.xa.jta.datasource.properties.dialect.MySQLXADataSourceDefinition
 org.apache.shardingsphere.transaction.xa.jta.datasource.properties.dialect.MariaDBXADataSourceDefinition
 org.apache.shardingsphere.transaction.xa.jta.datasource.properties.dialect.PostgreSQLXADataSourceDefinition
+org.apache.shardingsphere.transaction.xa.jta.datasource.properties.dialect.OpenGaussXADataSourceDefinition
 org.apache.shardingsphere.transaction.xa.jta.datasource.properties.dialect.OracleXADataSourceDefinition
 org.apache.shardingsphere.transaction.xa.jta.datasource.properties.dialect.SQLServerXADataSourceDefinition
 org.apache.shardingsphere.transaction.xa.jta.datasource.properties.dialect.H2XADataSourceDefinition

[shardingsphere] 01/03: Add OpenGauss Database type (#10292)

Posted by wu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

wuweijie pushed a commit to branch opengauss_adapt
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git

commit c1cf25fa4fb6b8ffc564dbe13f7245bd6b566286
Author: Liang Zhang <te...@163.com>
AuthorDate: Mon May 10 12:53:24 2021 +0800

    Add OpenGauss Database type (#10292)
---
 .../dialect/OpenGaussDataSourceMetaData.java       | 57 +++++++++++++++++++++
 .../type/dialect/OpenGaussDatabaseType.java        | 59 ++++++++++++++++++++++
 ...shardingsphere.infra.database.type.DatabaseType |  1 +
 3 files changed, 117 insertions(+)

diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/metadata/dialect/OpenGaussDataSourceMetaData.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/metadata/dialect/OpenGaussDataSourceMetaData.java
new file mode 100644
index 0000000..84974b3
--- /dev/null
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/metadata/dialect/OpenGaussDataSourceMetaData.java
@@ -0,0 +1,57 @@
+/*
+ * 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.infra.database.metadata.dialect;
+
+import com.google.common.base.Strings;
+import lombok.Getter;
+import org.apache.shardingsphere.infra.database.metadata.DataSourceMetaData;
+import org.apache.shardingsphere.infra.database.metadata.UnrecognizedDatabaseURLException;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Data source meta data for OpenGauss.
+ */
+@Getter
+public final class OpenGaussDataSourceMetaData implements DataSourceMetaData {
+    
+    private static final int DEFAULT_PORT = 5432;
+    
+    private final String hostName;
+    
+    private final int port;
+    
+    private final String catalog;
+    
+    private final String schema;
+    
+    // TODO fix OpenGauss's url pattern
+    private final Pattern pattern = Pattern.compile("jdbc:openguass://([\\w\\-\\.]+):?([0-9]*),?.*?/([\\w\\-]+)?\\S*", Pattern.CASE_INSENSITIVE);
+    
+    public OpenGaussDataSourceMetaData(final String url) {
+        Matcher matcher = pattern.matcher(url);
+        if (!matcher.find()) {
+            throw new UnrecognizedDatabaseURLException(url, pattern.pattern());
+        }
+        hostName = matcher.group(1);
+        port = Strings.isNullOrEmpty(matcher.group(2)) ? DEFAULT_PORT : Integer.parseInt(matcher.group(2));
+        catalog = matcher.group(3);
+        schema = null;
+    }
+}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/OpenGaussDatabaseType.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/OpenGaussDatabaseType.java
new file mode 100644
index 0000000..9b3d2e0
--- /dev/null
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/OpenGaussDatabaseType.java
@@ -0,0 +1,59 @@
+/*
+ * 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.infra.database.type.dialect;
+
+import org.apache.shardingsphere.infra.database.metadata.dialect.MariaDBDataSourceMetaData;
+import org.apache.shardingsphere.infra.database.type.BranchDatabaseType;
+import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import org.apache.shardingsphere.infra.database.type.DatabaseTypeRegistry;
+import org.apache.shardingsphere.sql.parser.sql.common.constant.QuoteCharacter;
+
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ * Database type of OpenGauss.
+ */
+public final class OpenGaussDatabaseType implements BranchDatabaseType {
+    
+    @Override
+    public String getName() {
+        return "OpenGauss";
+    }
+    
+    @Override
+    public QuoteCharacter getQuoteCharacter() {
+        return QuoteCharacter.QUOTE;
+    }
+    
+    @Override
+    public Collection<String> getJdbcUrlPrefixes() {
+        // TODO fix OpenGauss's url pattern
+        return Collections.singleton(String.format("jdbc:%s:", getName().toLowerCase()));
+    }
+    
+    @Override
+    public MariaDBDataSourceMetaData getDataSourceMetaData(final String url, final String username) {
+        return new MariaDBDataSourceMetaData(url);
+    }
+    
+    @Override
+    public DatabaseType getTrunkDatabaseType() {
+        return DatabaseTypeRegistry.getActualDatabaseType("PostgreSQL");
+    }
+}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.database.type.DatabaseType b/shardingsphere-infra/shardingsphere-infra-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.database.type.DatabaseType
index 3c34e38..8a86232 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.database.type.DatabaseType
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.database.type.DatabaseType
@@ -19,6 +19,7 @@ org.apache.shardingsphere.infra.database.type.dialect.SQL92DatabaseType
 org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType
 org.apache.shardingsphere.infra.database.type.dialect.MariaDBDatabaseType
 org.apache.shardingsphere.infra.database.type.dialect.PostgreSQLDatabaseType
+org.apache.shardingsphere.infra.database.type.dialect.OpenGaussDatabaseType
 org.apache.shardingsphere.infra.database.type.dialect.OracleDatabaseType
 org.apache.shardingsphere.infra.database.type.dialect.SQLServerDatabaseType
 org.apache.shardingsphere.infra.database.type.dialect.H2DatabaseType

[shardingsphere] 02/03: Update OpenGaussDataSourceMetaData

Posted by wu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

wuweijie pushed a commit to branch opengauss_adapt
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git

commit d08ebb664753910ea6dc0b135dbc31d91a6aefae
Author: zhangliang <zh...@apache.org>
AuthorDate: Mon May 10 13:24:34 2021 +0800

    Update OpenGaussDataSourceMetaData
---
 .../infra/database/type/dialect/OpenGaussDatabaseType.java          | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/OpenGaussDatabaseType.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/OpenGaussDatabaseType.java
index 9b3d2e0..d41e53e 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/OpenGaussDatabaseType.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/OpenGaussDatabaseType.java
@@ -17,7 +17,7 @@
 
 package org.apache.shardingsphere.infra.database.type.dialect;
 
-import org.apache.shardingsphere.infra.database.metadata.dialect.MariaDBDataSourceMetaData;
+import org.apache.shardingsphere.infra.database.metadata.dialect.OpenGaussDataSourceMetaData;
 import org.apache.shardingsphere.infra.database.type.BranchDatabaseType;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
 import org.apache.shardingsphere.infra.database.type.DatabaseTypeRegistry;
@@ -48,8 +48,8 @@ public final class OpenGaussDatabaseType implements BranchDatabaseType {
     }
     
     @Override
-    public MariaDBDataSourceMetaData getDataSourceMetaData(final String url, final String username) {
-        return new MariaDBDataSourceMetaData(url);
+    public OpenGaussDataSourceMetaData getDataSourceMetaData(final String url, final String username) {
+        return new OpenGaussDataSourceMetaData(url);
     }
     
     @Override