You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/01/25 16:30:56 UTC

[GitHub] [shardingsphere] yx9o opened a new pull request #15069: Add EXPORT SCHEMA CONFIGURATION syntax to DistSQL.

yx9o opened a new pull request #15069:
URL: https://github.com/apache/shardingsphere/pull/15069


   For #14807, add `EXPORT SCHEMA CONFIGURATION` syntax to DistSQL.
   
   Changes proposed in this pull request:
   Add `EXPORT SCHEMA CONFIGURATION` syntax.
   Add unit test.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] RaigorJiang merged pull request #15069: Add EXPORT SCHEMA CONFIGURATION syntax to DistSQL.

Posted by GitBox <gi...@apache.org>.
RaigorJiang merged pull request #15069:
URL: https://github.com/apache/shardingsphere/pull/15069


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] RaigorJiang commented on a change in pull request #15069: Add EXPORT SCHEMA CONFIGURATION syntax to DistSQL.

Posted by GitBox <gi...@apache.org>.
RaigorJiang commented on a change in pull request #15069:
URL: https://github.com/apache/shardingsphere/pull/15069#discussion_r793210134



##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/show/executor/ExportSchemaConfigurationExecutor.java
##########
@@ -0,0 +1,348 @@
+/*
+ * 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.text.distsql.ral.common.show.executor;
+
+import com.google.common.base.Strings;
+import com.zaxxer.hikari.HikariDataSource;
+import lombok.RequiredArgsConstructor;
+import org.apache.shardingsphere.distsql.parser.statement.ral.common.ExportSchemaConfigurationStatement;
+import org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmConfiguration;
+import org.apache.shardingsphere.infra.config.rulealtered.OnRuleAlteredActionConfiguration;
+import org.apache.shardingsphere.infra.exception.SchemaNotExistedException;
+import org.apache.shardingsphere.infra.exception.ShardingSphereException;
+import org.apache.shardingsphere.infra.merge.result.MergedResult;
+import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
+import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
+import org.apache.shardingsphere.proxy.backend.exception.NoDatabaseSelectedException;
+import org.apache.shardingsphere.proxy.backend.response.header.query.impl.QueryHeader;
+import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
+import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.rule.ShardingAutoTableRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.keygen.KeyGenerateStrategyConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.ComplexShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.HintShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.NoneShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.ShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.StandardShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.merge.dal.common.MultipleLocalDataMergedResult;
+
+import javax.sql.DataSource;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.sql.Types;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+/**
+ * Export schema configuration executor.
+ */
+@RequiredArgsConstructor
+public final class ExportSchemaConfigurationExecutor extends AbstractShowExecutor {
+    
+    private static final String CONFIG = "config";
+    
+    private static final String COLON = ":";
+    
+    private static final String SPACE = " ";
+    
+    private static final String NEWLINE = "\n";
+    
+    private static final String COLON_SPACE = COLON + SPACE;
+    
+    private static final String COLON_NEWLINE = COLON + NEWLINE;
+    
+    private static final String INDENT = SPACE + SPACE;
+    
+    private final ExportSchemaConfigurationStatement sqlStatement;
+    
+    private final ConnectionSession connectionSession;
+    
+    @Override
+    protected List<QueryHeader> createQueryHeaders() {
+        return Arrays.asList(new QueryHeader("", "", CONFIG, CONFIG, Types.VARCHAR, "VARCHAR", 128, 0, false, false, false, false));
+    }
+    
+    @Override
+    protected MergedResult createMergedResult() {
+        String schemaName = getSchemaName();
+        ShardingSphereMetaData metaData = ProxyContext.getInstance().getMetaData(schemaName);
+        StringBuilder result = new StringBuilder();
+        result.append("schemaName").append(COLON_SPACE).append(schemaName).append(NEWLINE);
+        getDataSourcesConfig(metaData, result);
+        Optional<ShardingRuleConfiguration> ruleConfig = metaData.getRuleMetaData().getConfigurations()
+                .stream().filter(each -> each instanceof ShardingRuleConfiguration).map(each -> (ShardingRuleConfiguration) each).findAny();
+        ruleConfig.ifPresent(rule -> getRulesConfig(rule, result));
+        if (!sqlStatement.getFilePath().isPresent()) {
+            return new MultipleLocalDataMergedResult(Collections.singleton(Collections.singletonList(result.toString())));
+        }
+        
+        File outFile = new File(sqlStatement.getFilePath().get());
+        try (FileOutputStream stream = new FileOutputStream(outFile)) {
+            stream.write(result.toString().getBytes());
+            stream.flush();
+        } catch (final IOException ex) {
+            throw new ShardingSphereException(ex);
+        }
+        return null;
+    }
+    
+    private void getDataSourcesConfig(final ShardingSphereMetaData metaData, final StringBuilder result) {
+        if (null == metaData.getResource().getDataSources() || metaData.getResource().getDataSources().isEmpty()) {
+            return;
+        }
+        result.append(NEWLINE).append("dataSources").append(COLON_NEWLINE);
+        for (Map.Entry<String, DataSource> each : metaData.getResource().getDataSources().entrySet()) {
+            HikariDataSource dataSource = (HikariDataSource) each.getValue();

Review comment:
       Please use the DataSourcePropertiesCreator.create method to obtain the data source properties. It is not a good idea to cast it to HikariDataSource. It can be adjusted in the next PR.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] yx9o commented on a change in pull request #15069: Add EXPORT SCHEMA CONFIGURATION syntax to DistSQL.

Posted by GitBox <gi...@apache.org>.
yx9o commented on a change in pull request #15069:
URL: https://github.com/apache/shardingsphere/pull/15069#discussion_r792300628



##########
File path: shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/RALStatement.g4
##########
@@ -87,6 +87,14 @@ dropTrafficRule
     : DROP TRAFFIC RULE ifExists? ruleName (COMMA ruleName)*
     ;
 
+exportSchema

Review comment:
       > exportSchemaConfiguration or exportSchemaConfig may better.
   
   OK, use exportSchemaConfig.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] codecov-commenter commented on pull request #15069: Add EXPORT SCHEMA CONFIGURATION syntax to DistSQL.

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #15069:
URL: https://github.com/apache/shardingsphere/pull/15069#issuecomment-1023000474


   # [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/15069?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#15069](https://codecov.io/gh/apache/shardingsphere/pull/15069?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (bf9af20) into [master](https://codecov.io/gh/apache/shardingsphere/commit/144761b98c73a3375c65d2594d11c0488aa581a4?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (144761b) will **increase** coverage by `0.09%`.
   > The diff coverage is `48.57%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere/pull/15069/graphs/tree.svg?width=650&height=150&src=pr&token=ZvlXpWa7so&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/shardingsphere/pull/15069?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #15069      +/-   ##
   ============================================
   + Coverage     59.75%   59.84%   +0.09%     
   - Complexity     1912     1922      +10     
   ============================================
     Files          3162     3166       +4     
     Lines         47237    47495     +258     
     Branches       8035     8087      +52     
   ============================================
   + Hits          28226    28425     +199     
   - Misses        16750    16757       +7     
   - Partials       2261     2313      +52     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/15069?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...ser/core/common/CommonDistSQLStatementVisitor.java](https://codecov.io/gh/apache/shardingsphere/pull/15069/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZGlzdHNxbC9zaGFyZGluZ3NwaGVyZS1kaXN0c3FsLXBhcnNlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvZGlzdHNxbC9wYXJzZXIvY29yZS9jb21tb24vQ29tbW9uRGlzdFNRTFN0YXRlbWVudFZpc2l0b3IuamF2YQ==) | `0.00% <0.00%> (ø)` | |
   | [...ral/common/ExportSchemaConfigurationStatement.java](https://codecov.io/gh/apache/shardingsphere/pull/15069/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZGlzdHNxbC9zaGFyZGluZ3NwaGVyZS1kaXN0c3FsLXN0YXRlbWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvZGlzdHNxbC9wYXJzZXIvc3RhdGVtZW50L3JhbC9jb21tb24vRXhwb3J0U2NoZW1hQ29uZmlndXJhdGlvblN0YXRlbWVudC5qYXZh) | `0.00% <0.00%> (ø)` | |
   | [.../ral/common/show/ShowStatementExecutorFactory.java](https://codecov.io/gh/apache/shardingsphere/pull/15069/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC90ZXh0L2Rpc3RzcWwvcmFsL2NvbW1vbi9zaG93L1Nob3dTdGF0ZW1lbnRFeGVjdXRvckZhY3RvcnkuamF2YQ==) | `12.50% <0.00%> (-1.14%)` | :arrow_down: |
   | [...mmon/ExportSchemaConfigurationStatementAssert.java](https://codecov.io/gh/apache/shardingsphere/pull/15069/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtdGVzdC9zaGFyZGluZ3NwaGVyZS1wYXJzZXItdGVzdC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvdGVzdC9zcWwvcGFyc2VyL3BhcmFtZXRlcml6ZWQvYXNzZXJ0cy9zdGF0ZW1lbnQvZGlzdHNxbC9yYWwvaW1wbC9jb21tb24vRXhwb3J0U2NoZW1hQ29uZmlndXJhdGlvblN0YXRlbWVudEFzc2VydC5qYXZh) | `40.00% <40.00%> (ø)` | |
   | [...ow/executor/ExportSchemaConfigurationExecutor.java](https://codecov.io/gh/apache/shardingsphere/pull/15069/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC90ZXh0L2Rpc3RzcWwvcmFsL2NvbW1vbi9zaG93L2V4ZWN1dG9yL0V4cG9ydFNjaGVtYUNvbmZpZ3VyYXRpb25FeGVjdXRvci5qYXZh) | `48.20% <48.20%> (ø)` | |
   | [...andler/query/ShardingAlgorithmsQueryResultSet.java](https://codecov.io/gh/apache/shardingsphere/pull/15069/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctZGlzdHNxbC9zaGFyZGluZ3NwaGVyZS1zaGFyZGluZy1kaXN0c3FsLWhhbmRsZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NoYXJkaW5nL2Rpc3RzcWwvaGFuZGxlci9xdWVyeS9TaGFyZGluZ0FsZ29yaXRobXNRdWVyeVJlc3VsdFNldC5qYXZh) | `73.33% <100.00%> (ø)` | |
   | [...distsql/ral/impl/CommonDistSQLStatementAssert.java](https://codecov.io/gh/apache/shardingsphere/pull/15069/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtdGVzdC9zaGFyZGluZ3NwaGVyZS1wYXJzZXItdGVzdC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvdGVzdC9zcWwvcGFyc2VyL3BhcmFtZXRlcml6ZWQvYXNzZXJ0cy9zdGF0ZW1lbnQvZGlzdHNxbC9yYWwvaW1wbC9Db21tb25EaXN0U1FMU3RhdGVtZW50QXNzZXJ0LmphdmE=) | `100.00% <100.00%> (ø)` | |
   | [...eterized/jaxb/cases/domain/SQLParserTestCases.java](https://codecov.io/gh/apache/shardingsphere/pull/15069/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtdGVzdC9zaGFyZGluZ3NwaGVyZS1wYXJzZXItdGVzdC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvdGVzdC9zcWwvcGFyc2VyL3BhcmFtZXRlcml6ZWQvamF4Yi9jYXNlcy9kb21haW4vU1FMUGFyc2VyVGVzdENhc2VzLmphdmE=) | `99.81% <100.00%> (+<0.01%)` | :arrow_up: |
   | [...al/ExportSchemaConfigurationStatementTestCase.java](https://codecov.io/gh/apache/shardingsphere/pull/15069/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtdGVzdC9zaGFyZGluZ3NwaGVyZS1wYXJzZXItdGVzdC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvdGVzdC9zcWwvcGFyc2VyL3BhcmFtZXRlcml6ZWQvamF4Yi9jYXNlcy9kb21haW4vc3RhdGVtZW50L2Rpc3RzcWwvcmFsL0V4cG9ydFNjaGVtYUNvbmZpZ3VyYXRpb25TdGF0ZW1lbnRUZXN0Q2FzZS5qYXZh) | `100.00% <100.00%> (ø)` | |
   | [...line/mysql/sqlbuilder/MySQLPipelineSQLBuilder.java](https://codecov.io/gh/apache/shardingsphere/pull/15069/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUta2VybmVsL3NoYXJkaW5nc3BoZXJlLWRhdGEtcGlwZWxpbmUvc2hhcmRpbmdzcGhlcmUtZGF0YS1waXBlbGluZS1kaWFsZWN0L3NoYXJkaW5nc3BoZXJlLWRhdGEtcGlwZWxpbmUtbXlzcWwvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2RhdGEvcGlwZWxpbmUvbXlzcWwvc3FsYnVpbGRlci9NeVNRTFBpcGVsaW5lU1FMQnVpbGRlci5qYXZh) | `84.21% <0.00%> (-15.79%)` | :arrow_down: |
   | ... and [54 more](https://codecov.io/gh/apache/shardingsphere/pull/15069/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/15069?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/15069?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [144761b...bf9af20](https://codecov.io/gh/apache/shardingsphere/pull/15069?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] RaigorJiang commented on a change in pull request #15069: Add EXPORT SCHEMA CONFIGURATION syntax to DistSQL.

Posted by GitBox <gi...@apache.org>.
RaigorJiang commented on a change in pull request #15069:
URL: https://github.com/apache/shardingsphere/pull/15069#discussion_r793226176



##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/show/executor/ExportSchemaConfigurationExecutor.java
##########
@@ -0,0 +1,348 @@
+/*
+ * 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.text.distsql.ral.common.show.executor;
+
+import com.google.common.base.Strings;
+import com.zaxxer.hikari.HikariDataSource;
+import lombok.RequiredArgsConstructor;
+import org.apache.shardingsphere.distsql.parser.statement.ral.common.ExportSchemaConfigurationStatement;
+import org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmConfiguration;
+import org.apache.shardingsphere.infra.config.rulealtered.OnRuleAlteredActionConfiguration;
+import org.apache.shardingsphere.infra.exception.SchemaNotExistedException;
+import org.apache.shardingsphere.infra.exception.ShardingSphereException;
+import org.apache.shardingsphere.infra.merge.result.MergedResult;
+import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
+import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
+import org.apache.shardingsphere.proxy.backend.exception.NoDatabaseSelectedException;
+import org.apache.shardingsphere.proxy.backend.response.header.query.impl.QueryHeader;
+import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
+import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.rule.ShardingAutoTableRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.keygen.KeyGenerateStrategyConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.ComplexShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.HintShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.NoneShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.ShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.StandardShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.merge.dal.common.MultipleLocalDataMergedResult;
+
+import javax.sql.DataSource;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.sql.Types;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+/**
+ * Export schema configuration executor.
+ */
+@RequiredArgsConstructor
+public final class ExportSchemaConfigurationExecutor extends AbstractShowExecutor {
+    
+    private static final String CONFIG = "config";
+    
+    private static final String COLON = ":";
+    
+    private static final String SPACE = " ";
+    
+    private static final String NEWLINE = "\n";
+    
+    private static final String COLON_SPACE = COLON + SPACE;
+    
+    private static final String COLON_NEWLINE = COLON + NEWLINE;
+    
+    private static final String INDENT = SPACE + SPACE;
+    
+    private final ExportSchemaConfigurationStatement sqlStatement;
+    
+    private final ConnectionSession connectionSession;
+    
+    @Override
+    protected List<QueryHeader> createQueryHeaders() {
+        return Arrays.asList(new QueryHeader("", "", CONFIG, CONFIG, Types.VARCHAR, "VARCHAR", 128, 0, false, false, false, false));
+    }
+    
+    @Override
+    protected MergedResult createMergedResult() {
+        String schemaName = getSchemaName();
+        ShardingSphereMetaData metaData = ProxyContext.getInstance().getMetaData(schemaName);
+        StringBuilder result = new StringBuilder();
+        result.append("schemaName").append(COLON_SPACE).append(schemaName).append(NEWLINE);
+        getDataSourcesConfig(metaData, result);
+        Optional<ShardingRuleConfiguration> ruleConfig = metaData.getRuleMetaData().getConfigurations()
+                .stream().filter(each -> each instanceof ShardingRuleConfiguration).map(each -> (ShardingRuleConfiguration) each).findAny();
+        ruleConfig.ifPresent(rule -> getRulesConfig(rule, result));

Review comment:
       Sure.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] yx9o commented on pull request #15069: Add EXPORT SCHEMA CONFIGURATION syntax to DistSQL.

Posted by GitBox <gi...@apache.org>.
yx9o commented on pull request #15069:
URL: https://github.com/apache/shardingsphere/pull/15069#issuecomment-1023846860


   > > Hi @RaigorJiang , I tried the way of Yaml.dump, but the result is not very satisfactory, mainly have the following two points:
   > > 
   > > * Direct transfer to Configuration will have empty properties, such as: `hint: null`.
   > > * Only convert non-empty attributes, the code structure is not very good when constructing the Map structure.
   > 
   > Representer can be used to fix the 'null' problem.
   
   OK,I will investigate.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] RaigorJiang commented on a change in pull request #15069: Add EXPORT SCHEMA CONFIGURATION syntax to DistSQL.

Posted by GitBox <gi...@apache.org>.
RaigorJiang commented on a change in pull request #15069:
URL: https://github.com/apache/shardingsphere/pull/15069#discussion_r792293086



##########
File path: shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/RALStatement.g4
##########
@@ -87,6 +87,14 @@ dropTrafficRule
     : DROP TRAFFIC RULE ifExists? ruleName (COMMA ruleName)*
     ;
 
+exportSchema

Review comment:
       exportSchemaConfiguration or exportSchemaConfig may better.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] RaigorJiang commented on pull request #15069: Add EXPORT SCHEMA CONFIGURATION syntax to DistSQL.

Posted by GitBox <gi...@apache.org>.
RaigorJiang commented on pull request #15069:
URL: https://github.com/apache/shardingsphere/pull/15069#issuecomment-1023825007


   > Hi @RaigorJiang , I tried the way of Yaml.dump, but the result is not very satisfactory, mainly have the following two points:
   > 
   > * Direct transfer to Configuration will have empty properties, such as: `hint: null`.
   > * Only convert non-empty attributes, the code structure is not very good when constructing the Map structure.
   
   Representer can be used to fix the 'null' problem. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] RaigorJiang commented on a change in pull request #15069: Add EXPORT SCHEMA CONFIGURATION syntax to DistSQL.

Posted by GitBox <gi...@apache.org>.
RaigorJiang commented on a change in pull request #15069:
URL: https://github.com/apache/shardingsphere/pull/15069#discussion_r792293983



##########
File path: shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/RALStatement.g4
##########
@@ -87,6 +87,14 @@ dropTrafficRule
     : DROP TRAFFIC RULE ifExists? ruleName (COMMA ruleName)*
     ;
 
+exportSchema
+    : EXPORT SCHEMA (CONFIGURATION | CONFIG) (FROM schemaName)? (COMMA FILE EQ filePath)?
+    ;
+
+filePath
+    : IDENTIFIER

Review comment:
       IDENTIFIER may not be suitable, as path, quotes are required, otherwise: `d:\asd` can be parsed successfully, but the result is only "d".
   ![image](https://user-images.githubusercontent.com/5668787/151100236-5a01d28c-c357-473f-86e5-79736df40556.png)
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] RaigorJiang commented on a change in pull request #15069: Add EXPORT SCHEMA CONFIGURATION syntax to DistSQL.

Posted by GitBox <gi...@apache.org>.
RaigorJiang commented on a change in pull request #15069:
URL: https://github.com/apache/shardingsphere/pull/15069#discussion_r793207845



##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/show/executor/ExportSchemaConfigurationExecutor.java
##########
@@ -0,0 +1,348 @@
+/*
+ * 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.text.distsql.ral.common.show.executor;
+
+import com.google.common.base.Strings;
+import com.zaxxer.hikari.HikariDataSource;
+import lombok.RequiredArgsConstructor;
+import org.apache.shardingsphere.distsql.parser.statement.ral.common.ExportSchemaConfigurationStatement;
+import org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmConfiguration;
+import org.apache.shardingsphere.infra.config.rulealtered.OnRuleAlteredActionConfiguration;
+import org.apache.shardingsphere.infra.exception.SchemaNotExistedException;
+import org.apache.shardingsphere.infra.exception.ShardingSphereException;
+import org.apache.shardingsphere.infra.merge.result.MergedResult;
+import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
+import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
+import org.apache.shardingsphere.proxy.backend.exception.NoDatabaseSelectedException;
+import org.apache.shardingsphere.proxy.backend.response.header.query.impl.QueryHeader;
+import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
+import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.rule.ShardingAutoTableRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.keygen.KeyGenerateStrategyConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.ComplexShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.HintShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.NoneShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.ShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.StandardShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.merge.dal.common.MultipleLocalDataMergedResult;
+
+import javax.sql.DataSource;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.sql.Types;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+/**
+ * Export schema configuration executor.
+ */
+@RequiredArgsConstructor
+public final class ExportSchemaConfigurationExecutor extends AbstractShowExecutor {
+    
+    private static final String CONFIG = "config";
+    
+    private static final String COLON = ":";
+    
+    private static final String SPACE = " ";
+    
+    private static final String NEWLINE = "\n";
+    
+    private static final String COLON_SPACE = COLON + SPACE;
+    
+    private static final String COLON_NEWLINE = COLON + NEWLINE;
+    
+    private static final String INDENT = SPACE + SPACE;
+    
+    private final ExportSchemaConfigurationStatement sqlStatement;
+    
+    private final ConnectionSession connectionSession;
+    
+    @Override
+    protected List<QueryHeader> createQueryHeaders() {
+        return Arrays.asList(new QueryHeader("", "", CONFIG, CONFIG, Types.VARCHAR, "VARCHAR", 128, 0, false, false, false, false));
+    }
+    
+    @Override
+    protected MergedResult createMergedResult() {
+        String schemaName = getSchemaName();
+        ShardingSphereMetaData metaData = ProxyContext.getInstance().getMetaData(schemaName);
+        StringBuilder result = new StringBuilder();
+        result.append("schemaName").append(COLON_SPACE).append(schemaName).append(NEWLINE);
+        getDataSourcesConfig(metaData, result);
+        Optional<ShardingRuleConfiguration> ruleConfig = metaData.getRuleMetaData().getConfigurations()
+                .stream().filter(each -> each instanceof ShardingRuleConfiguration).map(each -> (ShardingRuleConfiguration) each).findAny();
+        ruleConfig.ifPresent(rule -> getRulesConfig(rule, result));

Review comment:
       Sorry, I only see the code to export the sharding rule, won't other rules be exported?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] RaigorJiang commented on pull request #15069: Add EXPORT SCHEMA CONFIGURATION syntax to DistSQL.

Posted by GitBox <gi...@apache.org>.
RaigorJiang commented on pull request #15069:
URL: https://github.com/apache/shardingsphere/pull/15069#issuecomment-1024065302


   @yx9o Good job! 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] yx9o commented on a change in pull request #15069: Add EXPORT SCHEMA CONFIGURATION syntax to DistSQL.

Posted by GitBox <gi...@apache.org>.
yx9o commented on a change in pull request #15069:
URL: https://github.com/apache/shardingsphere/pull/15069#discussion_r792300628



##########
File path: shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/RALStatement.g4
##########
@@ -87,6 +87,14 @@ dropTrafficRule
     : DROP TRAFFIC RULE ifExists? ruleName (COMMA ruleName)*
     ;
 
+exportSchema

Review comment:
       > exportSchemaConfiguration or exportSchemaConfig may better.
   
   OK, use exportSchemaConfiguration.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] yx9o commented on a change in pull request #15069: Add EXPORT SCHEMA CONFIGURATION syntax to DistSQL.

Posted by GitBox <gi...@apache.org>.
yx9o commented on a change in pull request #15069:
URL: https://github.com/apache/shardingsphere/pull/15069#discussion_r792503946



##########
File path: shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/RALStatement.g4
##########
@@ -87,6 +87,14 @@ dropTrafficRule
     : DROP TRAFFIC RULE ifExists? ruleName (COMMA ruleName)*
     ;
 
+exportSchema
+    : EXPORT SCHEMA (CONFIGURATION | CONFIG) (FROM schemaName)? (COMMA FILE EQ filePath)?
+    ;
+
+filePath
+    : IDENTIFIER

Review comment:
       Done, please review, thank you.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] yx9o commented on pull request #15069: Add EXPORT SCHEMA CONFIGURATION syntax to DistSQL.

Posted by GitBox <gi...@apache.org>.
yx9o commented on pull request #15069:
URL: https://github.com/apache/shardingsphere/pull/15069#issuecomment-1023110691


   Hi @RaigorJiang , I tried the way of Yaml.dump, but the result is not very satisfactory, mainly have the following two points:
   - Direct transfer to Configuration will have empty properties, such as: `hint: null`.
   - Only convert non-empty attributes, the code structure is not very good when constructing the Map structure.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] RaigorJiang commented on a change in pull request #15069: Add EXPORT SCHEMA CONFIGURATION syntax to DistSQL.

Posted by GitBox <gi...@apache.org>.
RaigorJiang commented on a change in pull request #15069:
URL: https://github.com/apache/shardingsphere/pull/15069#discussion_r793211313



##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/show/executor/ExportSchemaConfigurationExecutor.java
##########
@@ -0,0 +1,348 @@
+/*
+ * 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.text.distsql.ral.common.show.executor;
+
+import com.google.common.base.Strings;
+import com.zaxxer.hikari.HikariDataSource;
+import lombok.RequiredArgsConstructor;
+import org.apache.shardingsphere.distsql.parser.statement.ral.common.ExportSchemaConfigurationStatement;
+import org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmConfiguration;
+import org.apache.shardingsphere.infra.config.rulealtered.OnRuleAlteredActionConfiguration;
+import org.apache.shardingsphere.infra.exception.SchemaNotExistedException;
+import org.apache.shardingsphere.infra.exception.ShardingSphereException;
+import org.apache.shardingsphere.infra.merge.result.MergedResult;
+import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
+import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
+import org.apache.shardingsphere.proxy.backend.exception.NoDatabaseSelectedException;
+import org.apache.shardingsphere.proxy.backend.response.header.query.impl.QueryHeader;
+import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
+import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.rule.ShardingAutoTableRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.keygen.KeyGenerateStrategyConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.ComplexShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.HintShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.NoneShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.ShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.StandardShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.merge.dal.common.MultipleLocalDataMergedResult;
+
+import javax.sql.DataSource;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.sql.Types;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+/**
+ * Export schema configuration executor.
+ */
+@RequiredArgsConstructor
+public final class ExportSchemaConfigurationExecutor extends AbstractShowExecutor {
+    
+    private static final String CONFIG = "config";
+    
+    private static final String COLON = ":";
+    
+    private static final String SPACE = " ";
+    
+    private static final String NEWLINE = "\n";
+    
+    private static final String COLON_SPACE = COLON + SPACE;
+    
+    private static final String COLON_NEWLINE = COLON + NEWLINE;
+    
+    private static final String INDENT = SPACE + SPACE;
+    
+    private final ExportSchemaConfigurationStatement sqlStatement;
+    
+    private final ConnectionSession connectionSession;
+    
+    @Override
+    protected List<QueryHeader> createQueryHeaders() {
+        return Arrays.asList(new QueryHeader("", "", CONFIG, CONFIG, Types.VARCHAR, "VARCHAR", 128, 0, false, false, false, false));
+    }
+    
+    @Override
+    protected MergedResult createMergedResult() {
+        String schemaName = getSchemaName();
+        ShardingSphereMetaData metaData = ProxyContext.getInstance().getMetaData(schemaName);
+        StringBuilder result = new StringBuilder();
+        result.append("schemaName").append(COLON_SPACE).append(schemaName).append(NEWLINE);
+        getDataSourcesConfig(metaData, result);
+        Optional<ShardingRuleConfiguration> ruleConfig = metaData.getRuleMetaData().getConfigurations()
+                .stream().filter(each -> each instanceof ShardingRuleConfiguration).map(each -> (ShardingRuleConfiguration) each).findAny();
+        ruleConfig.ifPresent(rule -> getRulesConfig(rule, result));
+        if (!sqlStatement.getFilePath().isPresent()) {
+            return new MultipleLocalDataMergedResult(Collections.singleton(Collections.singletonList(result.toString())));
+        }
+        
+        File outFile = new File(sqlStatement.getFilePath().get());
+        try (FileOutputStream stream = new FileOutputStream(outFile)) {
+            stream.write(result.toString().getBytes());
+            stream.flush();
+        } catch (final IOException ex) {
+            throw new ShardingSphereException(ex);
+        }
+        return null;
+    }
+    
+    private void getDataSourcesConfig(final ShardingSphereMetaData metaData, final StringBuilder result) {
+        if (null == metaData.getResource().getDataSources() || metaData.getResource().getDataSources().isEmpty()) {
+            return;
+        }
+        result.append(NEWLINE).append("dataSources").append(COLON_NEWLINE);
+        for (Map.Entry<String, DataSource> each : metaData.getResource().getDataSources().entrySet()) {
+            HikariDataSource dataSource = (HikariDataSource) each.getValue();
+            result.append(INDENT).append(each.getKey()).append(COLON_NEWLINE);
+            result.append(indent(2)).append("url").append(COLON_SPACE).append(dataSource.getJdbcUrl()).append(NEWLINE);
+            result.append(indent(2)).append("username").append(COLON_SPACE).append(dataSource.getUsername()).append(NEWLINE);
+            result.append(indent(2)).append("password").append(COLON_SPACE).append(dataSource.getPassword()).append(NEWLINE);
+            result.append(indent(2)).append("connectionTimeoutMilliseconds").append(COLON_SPACE).append(dataSource.getConnectionTimeout()).append(NEWLINE);
+            result.append(indent(2)).append("idleTimeoutMilliseconds").append(COLON_SPACE).append(dataSource.getIdleTimeout()).append(NEWLINE);
+            result.append(indent(2)).append("maxLifetimeMilliseconds").append(COLON_SPACE).append(dataSource.getMaxLifetime()).append(NEWLINE);
+            result.append(indent(2)).append("maxPoolSize").append(COLON_SPACE).append(dataSource.getMaximumPoolSize()).append(NEWLINE);
+            result.append(indent(2)).append("minPoolSize").append(COLON_SPACE).append(dataSource.getMinimumIdle()).append(NEWLINE);
+        }
+    }
+    
+    private void getRulesConfig(final ShardingRuleConfiguration ruleConfig, final StringBuilder result) {
+        result.append(NEWLINE).append("rules").append(COLON_NEWLINE);
+        result.append("- !SHARDING").append(NEWLINE);
+        getTablesConfig(ruleConfig, result);
+        getBindingTablesConfig(ruleConfig, result);
+        getDefaultDatabaseStrategyConfig(ruleConfig, result);
+        getDefaultTableStrategyConfig(ruleConfig, result);
+        getShardingAlgorithmsConfig(ruleConfig, result);
+        getKeyGeneratorsConfig(ruleConfig, result);
+        getScalingConfig(ruleConfig, result);
+    }
+    
+    private void getTablesConfig(final ShardingRuleConfiguration ruleConfig, final StringBuilder result) {
+        if (ruleConfig.getTables().isEmpty() || ruleConfig.getAutoTables().isEmpty()) {
+            return;
+        }
+        result.append(INDENT).append("tables").append(COLON_NEWLINE);
+        getTableRulesConfig(ruleConfig, result);
+        getAutoTableRulesConfig(ruleConfig, result);
+    }
+    
+    private void getTableRulesConfig(final ShardingRuleConfiguration ruleConfig, final StringBuilder result) {
+        for (ShardingTableRuleConfiguration each : ruleConfig.getTables()) {
+            getTableRulesItemConfig(each.getLogicTable(), each.getActualDataNodes(), each.getTableShardingStrategy(), each.getKeyGenerateStrategy(), result);
+        }
+    }
+    
+    private void getAutoTableRulesConfig(final ShardingRuleConfiguration ruleConfig, final StringBuilder result) {
+        for (ShardingAutoTableRuleConfiguration each : ruleConfig.getAutoTables()) {
+            getTableRulesItemConfig(each.getLogicTable(), each.getActualDataSources(), each.getShardingStrategy(), each.getKeyGenerateStrategy(), result);
+        }
+    }
+    
+    private void getTableRulesItemConfig(final String logicTable, final String actualDataNodes, final ShardingStrategyConfiguration tableShardingStrategy,
+                                         final KeyGenerateStrategyConfiguration keyGenerateStrategy, final StringBuilder result) {
+        result.append(indent(2)).append(logicTable).append(COLON_NEWLINE);
+        result.append(indent(3)).append("actualDataNodes").append(COLON_SPACE).append(actualDataNodes).append(NEWLINE);
+        result.append(indent(3)).append("tableStrategy").append(COLON_NEWLINE);
+        String algorithmName = "";
+        String shardingColumn = "";
+        String shardingAlgorithmName = "";
+        if (tableShardingStrategy instanceof StandardShardingStrategyConfiguration) {
+            StandardShardingStrategyConfiguration strategyConfig = (StandardShardingStrategyConfiguration) tableShardingStrategy;
+            algorithmName = "standard";
+            shardingColumn = strategyConfig.getShardingColumn();
+            shardingAlgorithmName = strategyConfig.getShardingAlgorithmName();
+        } else if (tableShardingStrategy instanceof ComplexShardingStrategyConfiguration) {
+            ComplexShardingStrategyConfiguration strategyConfig = (ComplexShardingStrategyConfiguration) tableShardingStrategy;
+            algorithmName = "complex";
+            shardingColumn = strategyConfig.getShardingColumns();
+            shardingAlgorithmName = strategyConfig.getShardingAlgorithmName();
+        } else if (tableShardingStrategy instanceof HintShardingStrategyConfiguration) {
+            HintShardingStrategyConfiguration strategyConfig = (HintShardingStrategyConfiguration) tableShardingStrategy;
+            algorithmName = "hint";
+            shardingAlgorithmName = strategyConfig.getShardingAlgorithmName();
+        } else if (tableShardingStrategy instanceof NoneShardingStrategyConfiguration) {
+            algorithmName = "none";
+        }
+        if (!Strings.isNullOrEmpty(algorithmName)) {
+            result.append(indent(4)).append(algorithmName).append(COLON_NEWLINE);
+        }
+        if (!Strings.isNullOrEmpty(shardingColumn)) {
+            result.append(indent(5)).append("shardingColumn").append(COLON_SPACE).append(shardingColumn).append(NEWLINE);
+        }
+        if (!Strings.isNullOrEmpty(shardingAlgorithmName)) {
+            result.append(indent(5)).append("shardingAlgorithmName").append(COLON_SPACE).append(shardingAlgorithmName).append(NEWLINE);
+        }
+        if (null == keyGenerateStrategy) {
+            return;
+        }
+        result.append(indent(3)).append("keyGenerateStrategy").append(COLON_NEWLINE);
+        result.append(indent(4)).append("column").append(COLON_SPACE).append(keyGenerateStrategy.getColumn()).append(NEWLINE);
+        result.append(indent(4)).append("keyGeneratorName").append(COLON_SPACE).append(keyGenerateStrategy.getKeyGeneratorName()).append(NEWLINE);
+    }
+    
+    private void getBindingTablesConfig(final ShardingRuleConfiguration ruleConfig, final StringBuilder result) {
+        if (ruleConfig.getBindingTableGroups().isEmpty()) {
+            return;
+        }
+        result.append(INDENT).append("bindingTables").append(COLON_NEWLINE);
+        result.append(indent(2)).append("-").append(SPACE).append(String.join(",", ruleConfig.getBindingTableGroups())).append(NEWLINE);
+    }
+    
+    private void getDefaultDatabaseStrategyConfig(final ShardingRuleConfiguration ruleConfig, final StringBuilder result) {
+        if (null == ruleConfig.getDefaultDatabaseShardingStrategy()) {
+            return;
+        }
+        result.append(INDENT).append("defaultDatabaseStrategy").append(COLON_NEWLINE);
+        getCommonDefaultStrategyConfig(ruleConfig.getDefaultDatabaseShardingStrategy(), result);
+    }
+    
+    private void getDefaultTableStrategyConfig(final ShardingRuleConfiguration ruleConfig, final StringBuilder result) {
+        if (null == ruleConfig.getDefaultTableShardingStrategy()) {
+            return;
+        }
+        result.append(INDENT).append("defaultTableStrategy").append(COLON_NEWLINE);
+        getCommonDefaultStrategyConfig(ruleConfig.getDefaultTableShardingStrategy(), result);
+    }
+    
+    private void getShardingAlgorithmsConfig(final ShardingRuleConfiguration ruleConfig, final StringBuilder result) {
+        if (ruleConfig.getShardingAlgorithms().isEmpty()) {
+            return;
+        }
+        result.append(INDENT).append("shardingAlgorithms").append(COLON_NEWLINE);
+        getAlgorithmConfig(ruleConfig.getShardingAlgorithms(), result);
+    }
+    
+    private void getKeyGeneratorsConfig(final ShardingRuleConfiguration ruleConfig, final StringBuilder result) {
+        if (ruleConfig.getKeyGenerators().isEmpty()) {
+            return;
+        }
+        result.append(INDENT).append("keyGenerators").append(COLON_NEWLINE);
+        getAlgorithmConfig(ruleConfig.getKeyGenerators(), result);
+    }
+    
+    private void getScalingConfig(final ShardingRuleConfiguration ruleConfig, final StringBuilder result) {
+        if (Strings.isNullOrEmpty(ruleConfig.getScalingName())) {
+            return;
+        }
+        result.append(INDENT).append("scalingName").append(COLON_SPACE).append(ruleConfig.getScalingName()).append(NEWLINE);
+        if (ruleConfig.getScaling().isEmpty()) {
+            return;
+        }
+        result.append(INDENT).append("scaling").append(COLON_NEWLINE);
+        for (Map.Entry<String, OnRuleAlteredActionConfiguration> each : ruleConfig.getScaling().entrySet()) {
+            OnRuleAlteredActionConfiguration current = each.getValue();
+            result.append(indent(2)).append(each.getKey()).append(COLON_NEWLINE);
+            if (null != current) {
+                getScalingInputOrOutputConfig("input", current.getInput().getWorkerThread(), current.getInput().getBatchSize(), current.getInput().getRateLimiter(), result);
+                getScalingInputOrOutputConfig("output", current.getOutput().getWorkerThread(), current.getOutput().getBatchSize(), current.getOutput().getRateLimiter(), result);
+                getCommonScalingItemConfig("streamChannel", current.getStreamChannel(), result);
+                getCommonScalingItemConfig("completionDetector", current.getCompletionDetector(), result);
+                getCommonScalingItemConfig("dataConsistencyChecker", current.getDataConsistencyChecker(), result);
+            }
+        }
+    }
+    
+    private void getScalingInputOrOutputConfig(final String itemName, final int workerThread, final int batchSize,
+                                               final ShardingSphereAlgorithmConfiguration rateLimiterConfig, final StringBuilder result) {
+        result.append(indent(3)).append(itemName).append(COLON_NEWLINE);
+        result.append(indent(4)).append("workerThread").append(COLON_SPACE).append(workerThread).append(NEWLINE);
+        result.append(indent(4)).append("batchSize").append(COLON_SPACE).append(batchSize).append(NEWLINE);
+        result.append(indent(4)).append("rateLimiter").append(COLON_NEWLINE);
+        result.append(indent(5)).append("type").append(COLON_SPACE).append(rateLimiterConfig.getType()).append(NEWLINE);
+        if (null != rateLimiterConfig.getProps() && !rateLimiterConfig.getProps().isEmpty()) {
+            result.append(indent(5)).append("props").append(COLON_NEWLINE);
+            for (Map.Entry<Object, Object> each : rateLimiterConfig.getProps().entrySet()) {
+                result.append(indent(6)).append(each.getKey()).append(COLON_SPACE).append(each.getValue()).append(NEWLINE);
+            }
+        }
+    }
+    
+    private void getCommonScalingItemConfig(final String itemName, final ShardingSphereAlgorithmConfiguration itemConfig, final StringBuilder result) {
+        result.append(indent(3)).append(itemName).append(COLON_NEWLINE);
+        result.append(indent(4)).append("type").append(COLON_SPACE).append(itemConfig.getType()).append(NEWLINE);
+        if (null != itemConfig.getProps() && !itemConfig.getProps().isEmpty()) {
+            result.append(indent(4)).append("props").append(COLON_NEWLINE);
+            for (Map.Entry<Object, Object> each : itemConfig.getProps().entrySet()) {
+                result.append(indent(5)).append(each.getKey()).append(COLON_SPACE).append(each.getValue()).append(NEWLINE);
+            }
+        }
+    }
+    
+    private void getAlgorithmConfig(final Map<String, ShardingSphereAlgorithmConfiguration> algorithmMap, final StringBuilder result) {
+        for (Map.Entry<String, ShardingSphereAlgorithmConfiguration> each : algorithmMap.entrySet()) {
+            result.append(indent(2)).append(each.getKey()).append(COLON_NEWLINE);
+            result.append(indent(3)).append("type").append(COLON_SPACE).append(each.getValue().getType()).append(NEWLINE);
+            if (null != each.getValue().getProps() && !each.getValue().getProps().isEmpty()) {
+                result.append(indent(3)).append("props").append(COLON_NEWLINE);
+                for (Map.Entry<Object, Object> each1 : each.getValue().getProps().entrySet()) {
+                    result.append(indent(4)).append(each1.getKey()).append(COLON_SPACE).append(each1.getValue()).append(NEWLINE);
+                }
+            }
+        }
+    }
+    
+    private void getCommonDefaultStrategyConfig(final ShardingStrategyConfiguration ruleConfig, final StringBuilder result) {
+        if (ruleConfig instanceof StandardShardingStrategyConfiguration) {
+            StandardShardingStrategyConfiguration strategyConfig = (StandardShardingStrategyConfiguration) ruleConfig;
+            result.append(indent(2)).append("standard").append(COLON_NEWLINE);
+            result.append(indent(3)).append("shardingColumn").append(COLON_SPACE).append(strategyConfig.getShardingColumn()).append(NEWLINE);
+            result.append(indent(3)).append("shardingAlgorithmName").append(COLON_SPACE).append(strategyConfig.getShardingAlgorithmName()).append(NEWLINE);
+        } else if (ruleConfig instanceof ComplexShardingStrategyConfiguration) {
+            ComplexShardingStrategyConfiguration strategyConfig = (ComplexShardingStrategyConfiguration) ruleConfig;
+            result.append(indent(2)).append("complex").append(COLON_NEWLINE);
+            result.append(indent(3)).append("shardingColumn").append(COLON_SPACE).append(strategyConfig.getShardingColumns()).append(NEWLINE);

Review comment:
       Please alse define these magic numbers as variables.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] RaigorJiang commented on a change in pull request #15069: Add EXPORT SCHEMA CONFIGURATION syntax to DistSQL.

Posted by GitBox <gi...@apache.org>.
RaigorJiang commented on a change in pull request #15069:
URL: https://github.com/apache/shardingsphere/pull/15069#discussion_r793210919



##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/show/executor/ExportSchemaConfigurationExecutor.java
##########
@@ -0,0 +1,348 @@
+/*
+ * 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.text.distsql.ral.common.show.executor;
+
+import com.google.common.base.Strings;
+import com.zaxxer.hikari.HikariDataSource;
+import lombok.RequiredArgsConstructor;
+import org.apache.shardingsphere.distsql.parser.statement.ral.common.ExportSchemaConfigurationStatement;
+import org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmConfiguration;
+import org.apache.shardingsphere.infra.config.rulealtered.OnRuleAlteredActionConfiguration;
+import org.apache.shardingsphere.infra.exception.SchemaNotExistedException;
+import org.apache.shardingsphere.infra.exception.ShardingSphereException;
+import org.apache.shardingsphere.infra.merge.result.MergedResult;
+import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
+import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
+import org.apache.shardingsphere.proxy.backend.exception.NoDatabaseSelectedException;
+import org.apache.shardingsphere.proxy.backend.response.header.query.impl.QueryHeader;
+import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
+import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.rule.ShardingAutoTableRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.keygen.KeyGenerateStrategyConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.ComplexShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.HintShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.NoneShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.ShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.StandardShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.merge.dal.common.MultipleLocalDataMergedResult;
+
+import javax.sql.DataSource;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.sql.Types;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+/**
+ * Export schema configuration executor.
+ */
+@RequiredArgsConstructor
+public final class ExportSchemaConfigurationExecutor extends AbstractShowExecutor {
+    
+    private static final String CONFIG = "config";
+    
+    private static final String COLON = ":";
+    
+    private static final String SPACE = " ";
+    
+    private static final String NEWLINE = "\n";
+    
+    private static final String COLON_SPACE = COLON + SPACE;
+    
+    private static final String COLON_NEWLINE = COLON + NEWLINE;
+    
+    private static final String INDENT = SPACE + SPACE;
+    
+    private final ExportSchemaConfigurationStatement sqlStatement;
+    
+    private final ConnectionSession connectionSession;
+    
+    @Override
+    protected List<QueryHeader> createQueryHeaders() {
+        return Arrays.asList(new QueryHeader("", "", CONFIG, CONFIG, Types.VARCHAR, "VARCHAR", 128, 0, false, false, false, false));
+    }
+    
+    @Override
+    protected MergedResult createMergedResult() {
+        String schemaName = getSchemaName();
+        ShardingSphereMetaData metaData = ProxyContext.getInstance().getMetaData(schemaName);
+        StringBuilder result = new StringBuilder();
+        result.append("schemaName").append(COLON_SPACE).append(schemaName).append(NEWLINE);
+        getDataSourcesConfig(metaData, result);
+        Optional<ShardingRuleConfiguration> ruleConfig = metaData.getRuleMetaData().getConfigurations()
+                .stream().filter(each -> each instanceof ShardingRuleConfiguration).map(each -> (ShardingRuleConfiguration) each).findAny();
+        ruleConfig.ifPresent(rule -> getRulesConfig(rule, result));
+        if (!sqlStatement.getFilePath().isPresent()) {
+            return new MultipleLocalDataMergedResult(Collections.singleton(Collections.singletonList(result.toString())));
+        }
+        
+        File outFile = new File(sqlStatement.getFilePath().get());
+        try (FileOutputStream stream = new FileOutputStream(outFile)) {
+            stream.write(result.toString().getBytes());
+            stream.flush();
+        } catch (final IOException ex) {
+            throw new ShardingSphereException(ex);
+        }
+        return null;
+    }
+    
+    private void getDataSourcesConfig(final ShardingSphereMetaData metaData, final StringBuilder result) {
+        if (null == metaData.getResource().getDataSources() || metaData.getResource().getDataSources().isEmpty()) {
+            return;
+        }
+        result.append(NEWLINE).append("dataSources").append(COLON_NEWLINE);
+        for (Map.Entry<String, DataSource> each : metaData.getResource().getDataSources().entrySet()) {
+            HikariDataSource dataSource = (HikariDataSource) each.getValue();
+            result.append(INDENT).append(each.getKey()).append(COLON_NEWLINE);
+            result.append(indent(2)).append("url").append(COLON_SPACE).append(dataSource.getJdbcUrl()).append(NEWLINE);
+            result.append(indent(2)).append("username").append(COLON_SPACE).append(dataSource.getUsername()).append(NEWLINE);
+            result.append(indent(2)).append("password").append(COLON_SPACE).append(dataSource.getPassword()).append(NEWLINE);
+            result.append(indent(2)).append("connectionTimeoutMilliseconds").append(COLON_SPACE).append(dataSource.getConnectionTimeout()).append(NEWLINE);
+            result.append(indent(2)).append("idleTimeoutMilliseconds").append(COLON_SPACE).append(dataSource.getIdleTimeout()).append(NEWLINE);
+            result.append(indent(2)).append("maxLifetimeMilliseconds").append(COLON_SPACE).append(dataSource.getMaxLifetime()).append(NEWLINE);
+            result.append(indent(2)).append("maxPoolSize").append(COLON_SPACE).append(dataSource.getMaximumPoolSize()).append(NEWLINE);
+            result.append(indent(2)).append("minPoolSize").append(COLON_SPACE).append(dataSource.getMinimumIdle()).append(NEWLINE);
+        }
+    }
+    
+    private void getRulesConfig(final ShardingRuleConfiguration ruleConfig, final StringBuilder result) {
+        result.append(NEWLINE).append("rules").append(COLON_NEWLINE);
+        result.append("- !SHARDING").append(NEWLINE);
+        getTablesConfig(ruleConfig, result);
+        getBindingTablesConfig(ruleConfig, result);
+        getDefaultDatabaseStrategyConfig(ruleConfig, result);
+        getDefaultTableStrategyConfig(ruleConfig, result);
+        getShardingAlgorithmsConfig(ruleConfig, result);
+        getKeyGeneratorsConfig(ruleConfig, result);
+        getScalingConfig(ruleConfig, result);
+    }
+    
+    private void getTablesConfig(final ShardingRuleConfiguration ruleConfig, final StringBuilder result) {
+        if (ruleConfig.getTables().isEmpty() || ruleConfig.getAutoTables().isEmpty()) {
+            return;
+        }
+        result.append(INDENT).append("tables").append(COLON_NEWLINE);
+        getTableRulesConfig(ruleConfig, result);
+        getAutoTableRulesConfig(ruleConfig, result);
+    }
+    
+    private void getTableRulesConfig(final ShardingRuleConfiguration ruleConfig, final StringBuilder result) {
+        for (ShardingTableRuleConfiguration each : ruleConfig.getTables()) {
+            getTableRulesItemConfig(each.getLogicTable(), each.getActualDataNodes(), each.getTableShardingStrategy(), each.getKeyGenerateStrategy(), result);
+        }
+    }
+    
+    private void getAutoTableRulesConfig(final ShardingRuleConfiguration ruleConfig, final StringBuilder result) {
+        for (ShardingAutoTableRuleConfiguration each : ruleConfig.getAutoTables()) {
+            getTableRulesItemConfig(each.getLogicTable(), each.getActualDataSources(), each.getShardingStrategy(), each.getKeyGenerateStrategy(), result);
+        }
+    }
+    
+    private void getTableRulesItemConfig(final String logicTable, final String actualDataNodes, final ShardingStrategyConfiguration tableShardingStrategy,
+                                         final KeyGenerateStrategyConfiguration keyGenerateStrategy, final StringBuilder result) {
+        result.append(indent(2)).append(logicTable).append(COLON_NEWLINE);
+        result.append(indent(3)).append("actualDataNodes").append(COLON_SPACE).append(actualDataNodes).append(NEWLINE);
+        result.append(indent(3)).append("tableStrategy").append(COLON_NEWLINE);
+        String algorithmName = "";
+        String shardingColumn = "";
+        String shardingAlgorithmName = "";
+        if (tableShardingStrategy instanceof StandardShardingStrategyConfiguration) {
+            StandardShardingStrategyConfiguration strategyConfig = (StandardShardingStrategyConfiguration) tableShardingStrategy;
+            algorithmName = "standard";
+            shardingColumn = strategyConfig.getShardingColumn();
+            shardingAlgorithmName = strategyConfig.getShardingAlgorithmName();
+        } else if (tableShardingStrategy instanceof ComplexShardingStrategyConfiguration) {
+            ComplexShardingStrategyConfiguration strategyConfig = (ComplexShardingStrategyConfiguration) tableShardingStrategy;
+            algorithmName = "complex";
+            shardingColumn = strategyConfig.getShardingColumns();
+            shardingAlgorithmName = strategyConfig.getShardingAlgorithmName();
+        } else if (tableShardingStrategy instanceof HintShardingStrategyConfiguration) {
+            HintShardingStrategyConfiguration strategyConfig = (HintShardingStrategyConfiguration) tableShardingStrategy;
+            algorithmName = "hint";
+            shardingAlgorithmName = strategyConfig.getShardingAlgorithmName();
+        } else if (tableShardingStrategy instanceof NoneShardingStrategyConfiguration) {
+            algorithmName = "none";
+        }
+        if (!Strings.isNullOrEmpty(algorithmName)) {
+            result.append(indent(4)).append(algorithmName).append(COLON_NEWLINE);
+        }
+        if (!Strings.isNullOrEmpty(shardingColumn)) {
+            result.append(indent(5)).append("shardingColumn").append(COLON_SPACE).append(shardingColumn).append(NEWLINE);
+        }
+        if (!Strings.isNullOrEmpty(shardingAlgorithmName)) {
+            result.append(indent(5)).append("shardingAlgorithmName").append(COLON_SPACE).append(shardingAlgorithmName).append(NEWLINE);
+        }
+        if (null == keyGenerateStrategy) {
+            return;
+        }
+        result.append(indent(3)).append("keyGenerateStrategy").append(COLON_NEWLINE);
+        result.append(indent(4)).append("column").append(COLON_SPACE).append(keyGenerateStrategy.getColumn()).append(NEWLINE);
+        result.append(indent(4)).append("keyGeneratorName").append(COLON_SPACE).append(keyGenerateStrategy.getKeyGeneratorName()).append(NEWLINE);
+    }
+    
+    private void getBindingTablesConfig(final ShardingRuleConfiguration ruleConfig, final StringBuilder result) {
+        if (ruleConfig.getBindingTableGroups().isEmpty()) {
+            return;
+        }
+        result.append(INDENT).append("bindingTables").append(COLON_NEWLINE);
+        result.append(indent(2)).append("-").append(SPACE).append(String.join(",", ruleConfig.getBindingTableGroups())).append(NEWLINE);
+    }
+    
+    private void getDefaultDatabaseStrategyConfig(final ShardingRuleConfiguration ruleConfig, final StringBuilder result) {
+        if (null == ruleConfig.getDefaultDatabaseShardingStrategy()) {
+            return;
+        }
+        result.append(INDENT).append("defaultDatabaseStrategy").append(COLON_NEWLINE);
+        getCommonDefaultStrategyConfig(ruleConfig.getDefaultDatabaseShardingStrategy(), result);
+    }
+    
+    private void getDefaultTableStrategyConfig(final ShardingRuleConfiguration ruleConfig, final StringBuilder result) {
+        if (null == ruleConfig.getDefaultTableShardingStrategy()) {
+            return;
+        }
+        result.append(INDENT).append("defaultTableStrategy").append(COLON_NEWLINE);
+        getCommonDefaultStrategyConfig(ruleConfig.getDefaultTableShardingStrategy(), result);
+    }
+    
+    private void getShardingAlgorithmsConfig(final ShardingRuleConfiguration ruleConfig, final StringBuilder result) {
+        if (ruleConfig.getShardingAlgorithms().isEmpty()) {
+            return;
+        }
+        result.append(INDENT).append("shardingAlgorithms").append(COLON_NEWLINE);
+        getAlgorithmConfig(ruleConfig.getShardingAlgorithms(), result);
+    }
+    
+    private void getKeyGeneratorsConfig(final ShardingRuleConfiguration ruleConfig, final StringBuilder result) {
+        if (ruleConfig.getKeyGenerators().isEmpty()) {
+            return;
+        }
+        result.append(INDENT).append("keyGenerators").append(COLON_NEWLINE);
+        getAlgorithmConfig(ruleConfig.getKeyGenerators(), result);
+    }
+    
+    private void getScalingConfig(final ShardingRuleConfiguration ruleConfig, final StringBuilder result) {
+        if (Strings.isNullOrEmpty(ruleConfig.getScalingName())) {
+            return;
+        }
+        result.append(INDENT).append("scalingName").append(COLON_SPACE).append(ruleConfig.getScalingName()).append(NEWLINE);
+        if (ruleConfig.getScaling().isEmpty()) {
+            return;
+        }
+        result.append(INDENT).append("scaling").append(COLON_NEWLINE);
+        for (Map.Entry<String, OnRuleAlteredActionConfiguration> each : ruleConfig.getScaling().entrySet()) {
+            OnRuleAlteredActionConfiguration current = each.getValue();
+            result.append(indent(2)).append(each.getKey()).append(COLON_NEWLINE);
+            if (null != current) {
+                getScalingInputOrOutputConfig("input", current.getInput().getWorkerThread(), current.getInput().getBatchSize(), current.getInput().getRateLimiter(), result);
+                getScalingInputOrOutputConfig("output", current.getOutput().getWorkerThread(), current.getOutput().getBatchSize(), current.getOutput().getRateLimiter(), result);
+                getCommonScalingItemConfig("streamChannel", current.getStreamChannel(), result);
+                getCommonScalingItemConfig("completionDetector", current.getCompletionDetector(), result);
+                getCommonScalingItemConfig("dataConsistencyChecker", current.getDataConsistencyChecker(), result);
+            }
+        }
+    }
+    
+    private void getScalingInputOrOutputConfig(final String itemName, final int workerThread, final int batchSize,
+                                               final ShardingSphereAlgorithmConfiguration rateLimiterConfig, final StringBuilder result) {
+        result.append(indent(3)).append(itemName).append(COLON_NEWLINE);
+        result.append(indent(4)).append("workerThread").append(COLON_SPACE).append(workerThread).append(NEWLINE);
+        result.append(indent(4)).append("batchSize").append(COLON_SPACE).append(batchSize).append(NEWLINE);
+        result.append(indent(4)).append("rateLimiter").append(COLON_NEWLINE);
+        result.append(indent(5)).append("type").append(COLON_SPACE).append(rateLimiterConfig.getType()).append(NEWLINE);
+        if (null != rateLimiterConfig.getProps() && !rateLimiterConfig.getProps().isEmpty()) {
+            result.append(indent(5)).append("props").append(COLON_NEWLINE);
+            for (Map.Entry<Object, Object> each : rateLimiterConfig.getProps().entrySet()) {
+                result.append(indent(6)).append(each.getKey()).append(COLON_SPACE).append(each.getValue()).append(NEWLINE);
+            }
+        }
+    }
+    
+    private void getCommonScalingItemConfig(final String itemName, final ShardingSphereAlgorithmConfiguration itemConfig, final StringBuilder result) {
+        result.append(indent(3)).append(itemName).append(COLON_NEWLINE);
+        result.append(indent(4)).append("type").append(COLON_SPACE).append(itemConfig.getType()).append(NEWLINE);
+        if (null != itemConfig.getProps() && !itemConfig.getProps().isEmpty()) {
+            result.append(indent(4)).append("props").append(COLON_NEWLINE);
+            for (Map.Entry<Object, Object> each : itemConfig.getProps().entrySet()) {
+                result.append(indent(5)).append(each.getKey()).append(COLON_SPACE).append(each.getValue()).append(NEWLINE);
+            }
+        }
+    }
+    
+    private void getAlgorithmConfig(final Map<String, ShardingSphereAlgorithmConfiguration> algorithmMap, final StringBuilder result) {
+        for (Map.Entry<String, ShardingSphereAlgorithmConfiguration> each : algorithmMap.entrySet()) {
+            result.append(indent(2)).append(each.getKey()).append(COLON_NEWLINE);
+            result.append(indent(3)).append("type").append(COLON_SPACE).append(each.getValue().getType()).append(NEWLINE);
+            if (null != each.getValue().getProps() && !each.getValue().getProps().isEmpty()) {
+                result.append(indent(3)).append("props").append(COLON_NEWLINE);
+                for (Map.Entry<Object, Object> each1 : each.getValue().getProps().entrySet()) {
+                    result.append(indent(4)).append(each1.getKey()).append(COLON_SPACE).append(each1.getValue()).append(NEWLINE);
+                }
+            }
+        }
+    }
+    
+    private void getCommonDefaultStrategyConfig(final ShardingStrategyConfiguration ruleConfig, final StringBuilder result) {
+        if (ruleConfig instanceof StandardShardingStrategyConfiguration) {
+            StandardShardingStrategyConfiguration strategyConfig = (StandardShardingStrategyConfiguration) ruleConfig;
+            result.append(indent(2)).append("standard").append(COLON_NEWLINE);
+            result.append(indent(3)).append("shardingColumn").append(COLON_SPACE).append(strategyConfig.getShardingColumn()).append(NEWLINE);
+            result.append(indent(3)).append("shardingAlgorithmName").append(COLON_SPACE).append(strategyConfig.getShardingAlgorithmName()).append(NEWLINE);

Review comment:
       It would be better to declare these strings as global variables.  (standard, shardingColumn, shardingAlgorithmName, '-', ...)




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] yx9o commented on a change in pull request #15069: Add EXPORT SCHEMA CONFIGURATION syntax to DistSQL.

Posted by GitBox <gi...@apache.org>.
yx9o commented on a change in pull request #15069:
URL: https://github.com/apache/shardingsphere/pull/15069#discussion_r793212265



##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/show/executor/ExportSchemaConfigurationExecutor.java
##########
@@ -0,0 +1,348 @@
+/*
+ * 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.text.distsql.ral.common.show.executor;
+
+import com.google.common.base.Strings;
+import com.zaxxer.hikari.HikariDataSource;
+import lombok.RequiredArgsConstructor;
+import org.apache.shardingsphere.distsql.parser.statement.ral.common.ExportSchemaConfigurationStatement;
+import org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmConfiguration;
+import org.apache.shardingsphere.infra.config.rulealtered.OnRuleAlteredActionConfiguration;
+import org.apache.shardingsphere.infra.exception.SchemaNotExistedException;
+import org.apache.shardingsphere.infra.exception.ShardingSphereException;
+import org.apache.shardingsphere.infra.merge.result.MergedResult;
+import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
+import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
+import org.apache.shardingsphere.proxy.backend.exception.NoDatabaseSelectedException;
+import org.apache.shardingsphere.proxy.backend.response.header.query.impl.QueryHeader;
+import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
+import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.rule.ShardingAutoTableRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.keygen.KeyGenerateStrategyConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.ComplexShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.HintShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.NoneShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.ShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.StandardShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.merge.dal.common.MultipleLocalDataMergedResult;
+
+import javax.sql.DataSource;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.sql.Types;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+/**
+ * Export schema configuration executor.
+ */
+@RequiredArgsConstructor
+public final class ExportSchemaConfigurationExecutor extends AbstractShowExecutor {
+    
+    private static final String CONFIG = "config";
+    
+    private static final String COLON = ":";
+    
+    private static final String SPACE = " ";
+    
+    private static final String NEWLINE = "\n";
+    
+    private static final String COLON_SPACE = COLON + SPACE;
+    
+    private static final String COLON_NEWLINE = COLON + NEWLINE;
+    
+    private static final String INDENT = SPACE + SPACE;
+    
+    private final ExportSchemaConfigurationStatement sqlStatement;
+    
+    private final ConnectionSession connectionSession;
+    
+    @Override
+    protected List<QueryHeader> createQueryHeaders() {
+        return Arrays.asList(new QueryHeader("", "", CONFIG, CONFIG, Types.VARCHAR, "VARCHAR", 128, 0, false, false, false, false));
+    }
+    
+    @Override
+    protected MergedResult createMergedResult() {
+        String schemaName = getSchemaName();
+        ShardingSphereMetaData metaData = ProxyContext.getInstance().getMetaData(schemaName);
+        StringBuilder result = new StringBuilder();
+        result.append("schemaName").append(COLON_SPACE).append(schemaName).append(NEWLINE);
+        getDataSourcesConfig(metaData, result);
+        Optional<ShardingRuleConfiguration> ruleConfig = metaData.getRuleMetaData().getConfigurations()
+                .stream().filter(each -> each instanceof ShardingRuleConfiguration).map(each -> (ShardingRuleConfiguration) each).findAny();
+        ruleConfig.ifPresent(rule -> getRulesConfig(rule, result));

Review comment:
       > Sorry, I only see the code to export the sharding rule, won't other rules be exported?
   
   Yes, can I continue to do it in a follow-up pr.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] codecov-commenter edited a comment on pull request #15069: Add EXPORT SCHEMA CONFIGURATION syntax to DistSQL.

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #15069:
URL: https://github.com/apache/shardingsphere/pull/15069#issuecomment-1023000474


   # [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/15069?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#15069](https://codecov.io/gh/apache/shardingsphere/pull/15069?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (70a4855) into [master](https://codecov.io/gh/apache/shardingsphere/commit/69d49aaa77a3e9b8a1f0655d09779e8de4a93e5e?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (69d49aa) will **decrease** coverage by `0.03%`.
   > The diff coverage is `50.23%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere/pull/15069/graphs/tree.svg?width=650&height=150&src=pr&token=ZvlXpWa7so&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/shardingsphere/pull/15069?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #15069      +/-   ##
   ============================================
   - Coverage     59.88%   59.85%   -0.04%     
   - Complexity     1922     1925       +3     
   ============================================
     Files          3165     3168       +3     
     Lines         47324    47508     +184     
     Branches       8051     8092      +41     
   ============================================
   + Hits          28340    28435      +95     
   - Misses        16697    16757      +60     
   - Partials       2287     2316      +29     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/15069?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...ser/core/common/CommonDistSQLStatementVisitor.java](https://codecov.io/gh/apache/shardingsphere/pull/15069/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZGlzdHNxbC9zaGFyZGluZ3NwaGVyZS1kaXN0c3FsLXBhcnNlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvZGlzdHNxbC9wYXJzZXIvY29yZS9jb21tb24vQ29tbW9uRGlzdFNRTFN0YXRlbWVudFZpc2l0b3IuamF2YQ==) | `0.00% <0.00%> (ø)` | |
   | [...ral/common/ExportSchemaConfigurationStatement.java](https://codecov.io/gh/apache/shardingsphere/pull/15069/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZGlzdHNxbC9zaGFyZGluZ3NwaGVyZS1kaXN0c3FsLXN0YXRlbWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvZGlzdHNxbC9wYXJzZXIvc3RhdGVtZW50L3JhbC9jb21tb24vRXhwb3J0U2NoZW1hQ29uZmlndXJhdGlvblN0YXRlbWVudC5qYXZh) | `0.00% <0.00%> (ø)` | |
   | [.../ral/common/show/ShowStatementExecutorFactory.java](https://codecov.io/gh/apache/shardingsphere/pull/15069/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC90ZXh0L2Rpc3RzcWwvcmFsL2NvbW1vbi9zaG93L1Nob3dTdGF0ZW1lbnRFeGVjdXRvckZhY3RvcnkuamF2YQ==) | `12.50% <0.00%> (-1.14%)` | :arrow_down: |
   | [...mmon/ExportSchemaConfigurationStatementAssert.java](https://codecov.io/gh/apache/shardingsphere/pull/15069/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtdGVzdC9zaGFyZGluZ3NwaGVyZS1wYXJzZXItdGVzdC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvdGVzdC9zcWwvcGFyc2VyL3BhcmFtZXRlcml6ZWQvYXNzZXJ0cy9zdGF0ZW1lbnQvZGlzdHNxbC9yYWwvaW1wbC9jb21tb24vRXhwb3J0U2NoZW1hQ29uZmlndXJhdGlvblN0YXRlbWVudEFzc2VydC5qYXZh) | `40.00% <40.00%> (ø)` | |
   | [...ow/executor/ExportSchemaConfigurationExecutor.java](https://codecov.io/gh/apache/shardingsphere/pull/15069/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC90ZXh0L2Rpc3RzcWwvcmFsL2NvbW1vbi9zaG93L2V4ZWN1dG9yL0V4cG9ydFNjaGVtYUNvbmZpZ3VyYXRpb25FeGVjdXRvci5qYXZh) | `50.00% <50.00%> (ø)` | |
   | [...andler/query/ShardingAlgorithmsQueryResultSet.java](https://codecov.io/gh/apache/shardingsphere/pull/15069/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctZGlzdHNxbC9zaGFyZGluZ3NwaGVyZS1zaGFyZGluZy1kaXN0c3FsLWhhbmRsZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NoYXJkaW5nL2Rpc3RzcWwvaGFuZGxlci9xdWVyeS9TaGFyZGluZ0FsZ29yaXRobXNRdWVyeVJlc3VsdFNldC5qYXZh) | `73.33% <100.00%> (ø)` | |
   | [...distsql/ral/impl/CommonDistSQLStatementAssert.java](https://codecov.io/gh/apache/shardingsphere/pull/15069/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtdGVzdC9zaGFyZGluZ3NwaGVyZS1wYXJzZXItdGVzdC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvdGVzdC9zcWwvcGFyc2VyL3BhcmFtZXRlcml6ZWQvYXNzZXJ0cy9zdGF0ZW1lbnQvZGlzdHNxbC9yYWwvaW1wbC9Db21tb25EaXN0U1FMU3RhdGVtZW50QXNzZXJ0LmphdmE=) | `100.00% <100.00%> (ø)` | |
   | [...eterized/jaxb/cases/domain/SQLParserTestCases.java](https://codecov.io/gh/apache/shardingsphere/pull/15069/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtdGVzdC9zaGFyZGluZ3NwaGVyZS1wYXJzZXItdGVzdC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvdGVzdC9zcWwvcGFyc2VyL3BhcmFtZXRlcml6ZWQvamF4Yi9jYXNlcy9kb21haW4vU1FMUGFyc2VyVGVzdENhc2VzLmphdmE=) | `99.81% <100.00%> (+<0.01%)` | :arrow_up: |
   | [...al/ExportSchemaConfigurationStatementTestCase.java](https://codecov.io/gh/apache/shardingsphere/pull/15069/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtdGVzdC9zaGFyZGluZ3NwaGVyZS1wYXJzZXItdGVzdC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvdGVzdC9zcWwvcGFyc2VyL3BhcmFtZXRlcml6ZWQvamF4Yi9jYXNlcy9kb21haW4vc3RhdGVtZW50L2Rpc3RzcWwvcmFsL0V4cG9ydFNjaGVtYUNvbmZpZ3VyYXRpb25TdGF0ZW1lbnRUZXN0Q2FzZS5qYXZh) | `100.00% <100.00%> (ø)` | |
   | [...shardingsphere/mode/metadata/MetaDataContexts.java](https://codecov.io/gh/apache/shardingsphere/pull/15069/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtbW9kZS9zaGFyZGluZ3NwaGVyZS1tb2RlLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL21vZGUvbWV0YWRhdGEvTWV0YURhdGFDb250ZXh0cy5qYXZh) | `45.45% <0.00%> (-22.97%)` | :arrow_down: |
   | ... and [29 more](https://codecov.io/gh/apache/shardingsphere/pull/15069/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/15069?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/15069?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [69d49aa...70a4855](https://codecov.io/gh/apache/shardingsphere/pull/15069?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org