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/02/22 07:35:09 UTC

[GitHub] [shardingsphere] dongzl opened a new pull request #15567: [DistSQL] Add a syntax SHOW UNUSED RESOURCES

dongzl opened a new pull request #15567:
URL: https://github.com/apache/shardingsphere/pull/15567


   Fixes #14612 .
   
   Changes proposed in this pull request:
   - Add show unused resource DistSQL parser.
   - Add unit test for show unused resource DistSQL parser.
   


-- 
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] dongzl commented on a change in pull request #15567: [DistSQL] Add a syntax SHOW UNUSED RESOURCES

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



##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/UnusedDataSourceQueryResultSetTest.java
##########
@@ -0,0 +1,126 @@
+/*
+ * 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.rql;
+
+import org.apache.shardingsphere.distsql.parser.statement.rql.show.ShowResourcesStatement;
+import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
+import org.apache.shardingsphere.infra.distsql.query.DistSQLResultSet;
+import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
+import org.apache.shardingsphere.infra.metadata.resource.DataSourcesMetaData;
+import org.apache.shardingsphere.infra.metadata.resource.ShardingSphereResource;
+import org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;
+import org.apache.shardingsphere.proxy.backend.text.distsql.rql.resource.UnusedDataSourceQueryResultSet;
+import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
+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.StandardShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.rule.ShardingRule;
+import org.apache.shardingsphere.test.mock.MockedDataSource;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+
+import javax.sql.DataSource;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+@RunWith(MockitoJUnitRunner.class)
+public final class UnusedDataSourceQueryResultSetTest {
+    
+    @Mock
+    private ShardingSphereMetaData shardingSphereMetaData;
+    
+    @Before
+    public void before() {
+        DatabaseType databaseType = new MySQLDatabaseType();
+        DataSourcesMetaData dataSourcesMetaData = new DataSourcesMetaData(databaseType, createDataSources());
+        ShardingSphereResource resource = new ShardingSphereResource(createDataSources(), dataSourcesMetaData, null, databaseType);
+        ShardingSphereRuleMetaData metaData = new ShardingSphereRuleMetaData(null, Arrays.asList(createShardingRule()));
+        when(shardingSphereMetaData.getResource()).thenReturn(resource);
+        when(shardingSphereMetaData.getRuleMetaData()).thenReturn(metaData);
+    }
+    
+    private ShardingRule createShardingRule() {
+        ShardingRuleConfiguration shardingRuleConfig = new ShardingRuleConfiguration();
+        ShardingTableRuleConfiguration shardingTableRuleConfig = createTableRuleConfiguration("order", "ds_${0..1}.order_${0..1}");
+        shardingTableRuleConfig.setKeyGenerateStrategy(new KeyGenerateStrategyConfiguration("id", "increment"));
+        shardingRuleConfig.getTables().add(shardingTableRuleConfig);
+        return new ShardingRule(shardingRuleConfig, createDataSourceNames());
+    }
+    
+    private ShardingTableRuleConfiguration createTableRuleConfiguration(final String logicTableName, final String actualDataNodes) {
+        ShardingTableRuleConfiguration result = new ShardingTableRuleConfiguration(logicTableName, actualDataNodes);
+        result.setDatabaseShardingStrategy(new StandardShardingStrategyConfiguration("order_id", "database_inline"));
+        result.setTableShardingStrategy(new StandardShardingStrategyConfiguration("order_id", "table_inline"));
+        return result;
+    }
+    
+    private Collection<String> createDataSourceNames() {
+        return Arrays.asList("ds_0", "ds_1", "ds_2");
+    }
+    
+    private Map<String, DataSource> createDataSources() {
+        Map<String, DataSource> result = new HashMap<>();
+        for (String dataSourceName : createDataSourceNames()) {

Review comment:
       fix.




-- 
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] totalo commented on a change in pull request #15567: [DistSQL] Add a syntax SHOW UNUSED RESOURCES

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



##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/resource/UnusedDataSourceQueryResultSet.java
##########
@@ -0,0 +1,161 @@
+/*
+ * 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.rql.resource;
+
+import com.google.common.collect.LinkedListMultimap;
+import com.google.common.collect.Multimap;
+import com.google.gson.Gson;
+import org.apache.shardingsphere.distsql.parser.statement.rql.show.ShowResourcesStatement;
+import org.apache.shardingsphere.infra.database.metadata.DataSourceMetaData;
+import org.apache.shardingsphere.infra.datanode.DataNode;
+import org.apache.shardingsphere.infra.datasource.props.DataSourceProperties;
+import org.apache.shardingsphere.infra.datasource.props.DataSourcePropertiesCreator;
+import org.apache.shardingsphere.infra.distsql.query.DistSQLResultSet;
+import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
+import org.apache.shardingsphere.infra.metadata.resource.ShardingSphereResource;
+import org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;
+import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
+import org.apache.shardingsphere.infra.rule.identifier.type.DataNodeContainedRule;
+import org.apache.shardingsphere.infra.rule.identifier.type.DataSourceContainedRule;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
+
+import javax.sql.DataSource;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+/**
+ * Result set for show unused data source.
+ */
+public final class UnusedDataSourceQueryResultSet implements DistSQLResultSet {
+    
+    private static final String CONNECTION_TIMEOUT_MILLISECONDS = "connectionTimeoutMilliseconds";
+    
+    private static final String IDLE_TIMEOUT_MILLISECONDS = "idleTimeoutMilliseconds";
+    
+    private static final String MAX_LIFETIME_MILLISECONDS = "maxLifetimeMilliseconds";
+    
+    private static final String MAX_POOL_SIZE = "maxPoolSize";
+    
+    private static final String MIN_POOL_SIZE = "minPoolSize";
+    
+    private static final String READ_ONLY = "readOnly";
+    
+    private ShardingSphereResource resource;
+    
+    private Map<String, DataSourceProperties> dataSourcePropsMap;
+    
+    private Iterator<String> dataSourceNames;
+    
+    @Override
+    public void init(final ShardingSphereMetaData metaData, final SQLStatement sqlStatement) {
+        resource = metaData.getResource();
+        dataSourcePropsMap = new LinkedHashMap<>(metaData.getResource().getDataSources().size(), 1);
+        Multimap<String, String> inUsedMultiMap = getInUsedResources(metaData.getRuleMetaData());
+        for (Map.Entry<String, DataSource> entry : metaData.getResource().getDataSources().entrySet()) {

Review comment:
       Please not use `Map.Entry` and just use `Entry`

##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/UnusedDataSourceQueryResultSetTest.java
##########
@@ -0,0 +1,126 @@
+/*
+ * 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.rql;
+
+import org.apache.shardingsphere.distsql.parser.statement.rql.show.ShowResourcesStatement;
+import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
+import org.apache.shardingsphere.infra.distsql.query.DistSQLResultSet;
+import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
+import org.apache.shardingsphere.infra.metadata.resource.DataSourcesMetaData;
+import org.apache.shardingsphere.infra.metadata.resource.ShardingSphereResource;
+import org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;
+import org.apache.shardingsphere.proxy.backend.text.distsql.rql.resource.UnusedDataSourceQueryResultSet;
+import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
+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.StandardShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.rule.ShardingRule;
+import org.apache.shardingsphere.test.mock.MockedDataSource;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+
+import javax.sql.DataSource;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+@RunWith(MockitoJUnitRunner.class)
+public final class UnusedDataSourceQueryResultSetTest {
+    
+    @Mock
+    private ShardingSphereMetaData shardingSphereMetaData;
+    
+    @Before
+    public void before() {
+        DatabaseType databaseType = new MySQLDatabaseType();
+        DataSourcesMetaData dataSourcesMetaData = new DataSourcesMetaData(databaseType, createDataSources());
+        ShardingSphereResource resource = new ShardingSphereResource(createDataSources(), dataSourcesMetaData, null, databaseType);
+        ShardingSphereRuleMetaData metaData = new ShardingSphereRuleMetaData(null, Arrays.asList(createShardingRule()));
+        when(shardingSphereMetaData.getResource()).thenReturn(resource);
+        when(shardingSphereMetaData.getRuleMetaData()).thenReturn(metaData);
+    }
+    
+    private ShardingRule createShardingRule() {
+        ShardingRuleConfiguration shardingRuleConfig = new ShardingRuleConfiguration();
+        ShardingTableRuleConfiguration shardingTableRuleConfig = createTableRuleConfiguration("order", "ds_${0..1}.order_${0..1}");
+        shardingTableRuleConfig.setKeyGenerateStrategy(new KeyGenerateStrategyConfiguration("id", "increment"));
+        shardingRuleConfig.getTables().add(shardingTableRuleConfig);
+        return new ShardingRule(shardingRuleConfig, createDataSourceNames());
+    }
+    
+    private ShardingTableRuleConfiguration createTableRuleConfiguration(final String logicTableName, final String actualDataNodes) {
+        ShardingTableRuleConfiguration result = new ShardingTableRuleConfiguration(logicTableName, actualDataNodes);
+        result.setDatabaseShardingStrategy(new StandardShardingStrategyConfiguration("order_id", "database_inline"));
+        result.setTableShardingStrategy(new StandardShardingStrategyConfiguration("order_id", "table_inline"));
+        return result;
+    }
+    
+    private Collection<String> createDataSourceNames() {
+        return Arrays.asList("ds_0", "ds_1", "ds_2");
+    }
+    
+    private Map<String, DataSource> createDataSources() {
+        Map<String, DataSource> result = new HashMap<>();
+        for (String dataSourceName : createDataSourceNames()) {

Review comment:
       Please use `each` instead of `dataSourceName`




-- 
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] dongzl commented on a change in pull request #15567: [DistSQL] Add a syntax SHOW UNUSED RESOURCES

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



##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/resource/UnusedDataSourceQueryResultSet.java
##########
@@ -0,0 +1,161 @@
+/*
+ * 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.rql.resource;
+
+import com.google.common.collect.LinkedListMultimap;
+import com.google.common.collect.Multimap;
+import com.google.gson.Gson;
+import org.apache.shardingsphere.distsql.parser.statement.rql.show.ShowResourcesStatement;
+import org.apache.shardingsphere.infra.database.metadata.DataSourceMetaData;
+import org.apache.shardingsphere.infra.datanode.DataNode;
+import org.apache.shardingsphere.infra.datasource.props.DataSourceProperties;
+import org.apache.shardingsphere.infra.datasource.props.DataSourcePropertiesCreator;
+import org.apache.shardingsphere.infra.distsql.query.DistSQLResultSet;
+import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
+import org.apache.shardingsphere.infra.metadata.resource.ShardingSphereResource;
+import org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;
+import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
+import org.apache.shardingsphere.infra.rule.identifier.type.DataNodeContainedRule;
+import org.apache.shardingsphere.infra.rule.identifier.type.DataSourceContainedRule;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
+
+import javax.sql.DataSource;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+/**
+ * Result set for show unused data source.
+ */
+public final class UnusedDataSourceQueryResultSet implements DistSQLResultSet {
+    
+    private static final String CONNECTION_TIMEOUT_MILLISECONDS = "connectionTimeoutMilliseconds";
+    
+    private static final String IDLE_TIMEOUT_MILLISECONDS = "idleTimeoutMilliseconds";
+    
+    private static final String MAX_LIFETIME_MILLISECONDS = "maxLifetimeMilliseconds";
+    
+    private static final String MAX_POOL_SIZE = "maxPoolSize";
+    
+    private static final String MIN_POOL_SIZE = "minPoolSize";
+    
+    private static final String READ_ONLY = "readOnly";
+    
+    private ShardingSphereResource resource;
+    
+    private Map<String, DataSourceProperties> dataSourcePropsMap;
+    
+    private Iterator<String> dataSourceNames;
+    
+    @Override
+    public void init(final ShardingSphereMetaData metaData, final SQLStatement sqlStatement) {
+        resource = metaData.getResource();
+        dataSourcePropsMap = new LinkedHashMap<>(metaData.getResource().getDataSources().size(), 1);
+        Multimap<String, String> inUsedMultiMap = getInUsedResources(metaData.getRuleMetaData());
+        for (Map.Entry<String, DataSource> entry : metaData.getResource().getDataSources().entrySet()) {

Review comment:
       @totalo  Thanks, fix it.




-- 
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 #15567: [DistSQL] Add a syntax SHOW UNUSED RESOURCES

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


   


-- 
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 #15567: [DistSQL] Add a syntax SHOW UNUSED RESOURCES

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


   # [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/15567?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 [#15567](https://codecov.io/gh/apache/shardingsphere/pull/15567?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (b4ddfd5) into [master](https://codecov.io/gh/apache/shardingsphere/commit/b55e3fee2c1adc87df1474bd34f9c0d8d6267ba6?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (b55e3fe) will **increase** coverage by `0.01%`.
   > The diff coverage is `75.86%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere/pull/15567/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/15567?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   #15567      +/-   ##
   ============================================
   + Coverage     60.46%   60.48%   +0.01%     
   - Complexity     1991     1992       +1     
   ============================================
     Files          3238     3240       +2     
     Lines         48697    48749      +52     
     Branches       8319     8328       +9     
   ============================================
   + Hits          29446    29485      +39     
   - Misses        16836    16847      +11     
   - Partials       2415     2417       +2     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/15567?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/15567/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%> (ø)` | |
   | [...atement/rql/show/ShowUnusedResourcesStatement.java](https://codecov.io/gh/apache/shardingsphere/pull/15567/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-c2hhcmRpbmdzcGhlcmUtZGlzdHNxbC9zaGFyZGluZ3NwaGVyZS1kaXN0c3FsLXN0YXRlbWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvZGlzdHNxbC9wYXJzZXIvc3RhdGVtZW50L3JxbC9zaG93L1Nob3dVbnVzZWRSZXNvdXJjZXNTdGF0ZW1lbnQuamF2YQ==) | `0.00% <0.00%> (ø)` | |
   | [...l/rql/resource/UnusedDataSourceQueryResultSet.java](https://codecov.io/gh/apache/shardingsphere/pull/15567/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-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC90ZXh0L2Rpc3RzcWwvcnFsL3Jlc291cmNlL1VudXNlZERhdGFTb3VyY2VRdWVyeVJlc3VsdFNldC5qYXZh) | `78.57% <78.57%> (ø)` | |
   | [...gine/impl/InsertClauseShardingConditionEngine.java](https://codecov.io/gh/apache/shardingsphere/pull/15567/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-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2hhcmRpbmcvcm91dGUvZW5naW5lL2NvbmRpdGlvbi9lbmdpbmUvaW1wbC9JbnNlcnRDbGF1c2VTaGFyZGluZ0NvbmRpdGlvbkVuZ2luZS5qYXZh) | `50.94% <0.00%> (-1.06%)` | :arrow_down: |
   | [...re/infra/rewrite/engine/RouteSQLRewriteEngine.java](https://codecov.io/gh/apache/shardingsphere/pull/15567/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-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtcmV3cml0ZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvaW5mcmEvcmV3cml0ZS9lbmdpbmUvUm91dGVTUUxSZXdyaXRlRW5naW5lLmphdmE=) | `75.00% <0.00%> (-0.81%)` | :arrow_down: |
   | [...here/infra/binder/segment/table/TablesContext.java](https://codecov.io/gh/apache/shardingsphere/pull/15567/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-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtYmluZGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9pbmZyYS9iaW5kZXIvc2VnbWVudC90YWJsZS9UYWJsZXNDb250ZXh0LmphdmE=) | `80.61% <0.00%> (-0.39%)` | :arrow_down: |
   | [...driver/jdbc/core/connection/ConnectionManager.java](https://codecov.io/gh/apache/shardingsphere/pull/15567/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-c2hhcmRpbmdzcGhlcmUtamRiYy9zaGFyZGluZ3NwaGVyZS1qZGJjLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2RyaXZlci9qZGJjL2NvcmUvY29ubmVjdGlvbi9Db25uZWN0aW9uTWFuYWdlci5qYXZh) | `87.90% <0.00%> (+0.09%)` | :arrow_up: |
   | [...ngine/impl/WhereClauseShardingConditionEngine.java](https://codecov.io/gh/apache/shardingsphere/pull/15567/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-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2hhcmRpbmcvcm91dGUvZW5naW5lL2NvbmRpdGlvbi9lbmdpbmUvaW1wbC9XaGVyZUNsYXVzZVNoYXJkaW5nQ29uZGl0aW9uRW5naW5lLmphdmE=) | `68.13% <0.00%> (+0.42%)` | :arrow_up: |
   | [...sphere/dbdiscovery/rule/DatabaseDiscoveryRule.java](https://codecov.io/gh/apache/shardingsphere/pull/15567/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-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtZGItZGlzY292ZXJ5L3NoYXJkaW5nc3BoZXJlLWRiLWRpc2NvdmVyeS1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9kYmRpc2NvdmVyeS9ydWxlL0RhdGFiYXNlRGlzY292ZXJ5UnVsZS5qYXZh) | `69.62% <0.00%> (+0.87%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/15567?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/15567?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 [b55e3fe...b4ddfd5](https://codecov.io/gh/apache/shardingsphere/pull/15567?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 #15567: [DistSQL] Add a syntax SHOW UNUSED RESOURCES

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



##########
File path: shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/common/CommonDistSQLStatementVisitor.java
##########
@@ -269,6 +270,11 @@ public ASTNode visitShowResources(final ShowResourcesContext ctx) {
         return new ShowResourcesStatement(null == ctx.schemaName() ? null : (SchemaSegment) visit(ctx.schemaName()));
     }
     
+    @Override
+    public ASTNode visitShowUnusedResources(final ShowUnusedResourcesContext ctx) {
+        return new ShowResourcesStatement(null == ctx.schemaName() ? null : (SchemaSegment) visit(ctx.schemaName()));

Review comment:
       The newly created statement should be used here instead of ShowResourcesStatement?




-- 
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] dongzl commented on a change in pull request #15567: [DistSQL] Add a syntax SHOW UNUSED RESOURCES

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



##########
File path: shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/common/CommonDistSQLStatementVisitor.java
##########
@@ -269,6 +270,11 @@ public ASTNode visitShowResources(final ShowResourcesContext ctx) {
         return new ShowResourcesStatement(null == ctx.schemaName() ? null : (SchemaSegment) visit(ctx.schemaName()));
     }
     
+    @Override
+    public ASTNode visitShowUnusedResources(final ShowUnusedResourcesContext ctx) {
+        return new ShowResourcesStatement(null == ctx.schemaName() ? null : (SchemaSegment) visit(ctx.schemaName()));

Review comment:
       > The newly created statement should be used here instead of ShowResourcesStatement?
   
   @RaigorJiang Thanks for your review, I think the `Statement` content is the same between `SHOW RESOURCES` and `SHOW UNUSED RESOURCES`, so I want to share the class code.




-- 
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] dongzl commented on a change in pull request #15567: [DistSQL] Add a syntax SHOW UNUSED RESOURCES

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



##########
File path: shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/common/CommonDistSQLStatementVisitor.java
##########
@@ -269,6 +270,11 @@ public ASTNode visitShowResources(final ShowResourcesContext ctx) {
         return new ShowResourcesStatement(null == ctx.schemaName() ? null : (SchemaSegment) visit(ctx.schemaName()));
     }
     
+    @Override
+    public ASTNode visitShowUnusedResources(final ShowUnusedResourcesContext ctx) {
+        return new ShowResourcesStatement(null == ctx.schemaName() ? null : (SchemaSegment) visit(ctx.schemaName()));

Review comment:
       > But the ResultSets is different, `RQLBackendHandlerFactory` needs to use the name of the statement to get the ResultSet SPI, the same statement will bring problem.
   
   OK, I understand, I fix it.




-- 
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 #15567: [DistSQL] Add a syntax SHOW UNUSED RESOURCES

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



##########
File path: shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/common/CommonDistSQLStatementVisitor.java
##########
@@ -269,6 +270,11 @@ public ASTNode visitShowResources(final ShowResourcesContext ctx) {
         return new ShowResourcesStatement(null == ctx.schemaName() ? null : (SchemaSegment) visit(ctx.schemaName()));
     }
     
+    @Override
+    public ASTNode visitShowUnusedResources(final ShowUnusedResourcesContext ctx) {
+        return new ShowResourcesStatement(null == ctx.schemaName() ? null : (SchemaSegment) visit(ctx.schemaName()));

Review comment:
       But the ResultSets is different, `RQLBackendHandlerFactory` needs to use the name of the statement to get the ResultSet SPI, the same statement will bring 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