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 2020/12/17 06:59:16 UTC
[GitHub] [shardingsphere] jingshanglu opened a new pull request #8665: Add sql stats visitor
jingshanglu opened a new pull request #8665:
URL: https://github.com/apache/shardingsphere/pull/8665
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] tristaZero commented on a change in pull request #8665: Add sql stats visitor
Posted by GitBox <gi...@apache.org>.
tristaZero commented on a change in pull request #8665:
URL: https://github.com/apache/shardingsphere/pull/8665#discussion_r547156878
##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/SqlStats.java
##########
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.sql.parser.sql.common;
+
+import lombok.Getter;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.column.ColumnSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.SimpleTableSegment;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+@Getter
+public class SqlStats {
Review comment:
Plz define it as final
##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/MySQLSQLStatVisitor.java
##########
@@ -0,0 +1,152 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.sql.parser.mysql.visitor;
+
+import lombok.Getter;
+import lombok.Setter;
+import org.antlr.v4.runtime.tree.TerminalNode;
+import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementBaseVisitor;
+import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.AliasContext;
+import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.ColumnDefinitionContext;
+import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.ColumnRefContext;
+import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.IdentifierContext;
+import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.InsertContext;
+import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.OwnerContext;
+import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.TableFactorContext;
+import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.TableNameContext;
+import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.TableWildContext;
+import org.apache.shardingsphere.sql.parser.sql.common.SqlStats;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.column.ColumnSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.AliasSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.OwnerSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.SimpleTableSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.TableNameSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.value.identifier.IdentifierValue;
+
+/**
+ * MySQL SQL Stats visitor for MySQL.
+ */
+@Getter
+@Setter
+public final class MySQLSQLStatVisitor extends MySQLStatementBaseVisitor<SqlStats> {
+
+ private SqlStats sqlStats = new SqlStats();
Review comment:
final?
##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/SqlStats.java
##########
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.sql.parser.sql.common;
+
+import lombok.Getter;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.column.ColumnSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.SimpleTableSegment;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+@Getter
+public class SqlStats {
+
+ private Map<String, SimpleTableSegment> tables = new LinkedHashMap<>();
+
+ private Map<Integer, ColumnSegment> columns = new LinkedHashMap<>();
+
+ private int hashCode(final ColumnSegment column) {
+ StringBuilder columString = new StringBuilder();
+ if (column.getOwner().isPresent()) {
+ columString.append(column.getOwner().get().getIdentifier().getValue());
+ }
+ columString.append(column.getIdentifier().getValue());
+ return columString.toString().hashCode();
+ }
+
+ /**
+ * add table to tables.
+ * @param tableSegment SimpleTableSegment.
+ */
+ public void addTable(final SimpleTableSegment tableSegment) {
+ if (!tables.containsKey(tableSegment.getTableName().getIdentifier().getValue())) {
+ tables.put(tableSegment.getTableName().getIdentifier().getValue(), tableSegment);
+ }
+ }
+
+ /**
+ * add column to columns.
+ * @param column ColumnSegment.
+ */
+ public void addColumn(final ColumnSegment column) {
+ int columnHashcode = hashCode(column);
Review comment:
`HashCode` is supposed to be overwrite in `ColumnSegment`.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] tristaZero commented on a change in pull request #8665: Add sql stats visitor
Posted by GitBox <gi...@apache.org>.
tristaZero commented on a change in pull request #8665:
URL: https://github.com/apache/shardingsphere/pull/8665#discussion_r546482455
##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/MySQLSQLStatVisitor.java
##########
@@ -0,0 +1,172 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.sql.parser.mysql.visitor;
+
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementBaseVisitor;
+import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.AliasContext;
+import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.ColumnDefinitionContext;
+import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.ColumnRefContext;
+import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.IdentifierContext;
+import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.InsertContext;
+import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.OwnerContext;
+import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.TableFactorContext;
+import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.TableNameContext;
+import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.TableWildContext;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.column.ColumnSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.AliasSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.OwnerSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.SimpleTableSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.TableNameSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.value.identifier.IdentifierValue;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * MySQL SQL Stats visitor for MySQL.
+ */
+@Getter
+@Setter
+public final class MySQLSQLStatVisitor extends MySQLStatementBaseVisitor<Boolean> {
+
+ private Map<String, SimpleTableSegment> tables = new LinkedHashMap<>();
+
+ private Map<Integer, ColumnSegment> columns = new LinkedHashMap<>();
+
+ @Override
+ public Boolean visitTableFactor(final TableFactorContext ctx) {
Review comment:
Why is the output result Boolean?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] codecov-io commented on pull request #8665: Add sql stats visitor
Posted by GitBox <gi...@apache.org>.
codecov-io commented on pull request #8665:
URL: https://github.com/apache/shardingsphere/pull/8665#issuecomment-747863547
# [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/8665?src=pr&el=h1) Report
> Merging [#8665](https://codecov.io/gh/apache/shardingsphere/pull/8665?src=pr&el=desc) (df2a68f) into [master](https://codecov.io/gh/apache/shardingsphere/commit/3e350c1265bbc08b062bb8853b547ceafddf99d3?el=desc) (3e350c1) will **decrease** coverage by `1.30%`.
> The diff coverage is `55.38%`.
[](https://codecov.io/gh/apache/shardingsphere/pull/8665?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #8665 +/- ##
============================================
- Coverage 72.22% 70.91% -1.31%
- Complexity 602 621 +19
============================================
Files 1547 1574 +27
Lines 24537 25201 +664
Branches 4325 4414 +89
============================================
+ Hits 17721 17872 +151
- Misses 5659 6126 +467
- Partials 1157 1203 +46
```
| [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/8665?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
|---|---|---|---|
| [.../sql/parser/mysql/visitor/MySQLSQLStatVisitor.java](https://codecov.io/gh/apache/shardingsphere/pull/8665/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLWRpYWxlY3Qvc2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci1teXNxbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9teXNxbC92aXNpdG9yL015U1FMU1FMU3RhdFZpc2l0b3IuamF2YQ==) | `55.38% <55.38%> (ø)` | `0.00 <0.00> (?)` | |
| [...rdingsphere/agent/metrics/api/MetricsProvider.java](https://codecov.io/gh/apache/shardingsphere/pull/8665/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtYWdlbnQvc2hhcmRpbmdzcGhlcmUtYWdlbnQtcGx1Z2lucy9zaGFyZGluZ3NwaGVyZS1hZ2VudC1wbHVnaW4tbWV0cmljcy9zaGFyZGluZ3NwaGVyZS1hZ2VudC1tZXRyaWNzLWFwaS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvYWdlbnQvbWV0cmljcy9hcGkvTWV0cmljc1Byb3ZpZGVyLmphdmE=) | `0.00% <0.00%> (-100.00%)` | `0.00% <0.00%> (ø%)` | |
| [.../visitor/format/impl/MySQLDMLFormatSQLVisitor.java](https://codecov.io/gh/apache/shardingsphere/pull/8665/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLWRpYWxlY3Qvc2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci1teXNxbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9teXNxbC92aXNpdG9yL2Zvcm1hdC9pbXBsL015U1FMRE1MRm9ybWF0U1FMVmlzaXRvci5qYXZh) | `0.00% <0.00%> (-100.00%)` | `0.00% <0.00%> (-1.00%)` | |
| [...re/agent/core/config/AgentConfigurationLoader.java](https://codecov.io/gh/apache/shardingsphere/pull/8665/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtYWdlbnQvc2hhcmRpbmdzcGhlcmUtYWdlbnQtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvYWdlbnQvY29yZS9jb25maWcvQWdlbnRDb25maWd1cmF0aW9uTG9hZGVyLmphdmE=) | `0.00% <0.00%> (-83.34%)` | `0.00% <0.00%> (ø%)` | |
| [...hardingsphere/governance/core/lock/LockCenter.java](https://codecov.io/gh/apache/shardingsphere/pull/8665/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtZ292ZXJuYW5jZS9zaGFyZGluZ3NwaGVyZS1nb3Zlcm5hbmNlLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2dvdmVybmFuY2UvY29yZS9sb2NrL0xvY2tDZW50ZXIuamF2YQ==) | `41.93% <0.00%> (-52.51%)` | `0.00% <0.00%> (ø%)` | |
| [...narayana/manager/NarayanaXATransactionManager.java](https://codecov.io/gh/apache/shardingsphere/pull/8665/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtdHJhbnNhY3Rpb24vc2hhcmRpbmdzcGhlcmUtdHJhbnNhY3Rpb24tMnBjL3NoYXJkaW5nc3BoZXJlLXRyYW5zYWN0aW9uLXhhL3NoYXJkaW5nc3BoZXJlLXRyYW5zYWN0aW9uLXhhLW5hcmF5YW5hL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS90cmFuc2FjdGlvbi94YS9uYXJheWFuYS9tYW5hZ2VyL05hcmF5YW5hWEFUcmFuc2FjdGlvbk1hbmFnZXIuamF2YQ==) | `54.54% <0.00%> (-40.46%)` | `2.00% <0.00%> (+1.00%)` | :arrow_down: |
| [...re/governance/core/state/GovernedStateContext.java](https://codecov.io/gh/apache/shardingsphere/pull/8665/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtZ292ZXJuYW5jZS9zaGFyZGluZ3NwaGVyZS1nb3Zlcm5hbmNlLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2dvdmVybmFuY2UvY29yZS9zdGF0ZS9Hb3Zlcm5lZFN0YXRlQ29udGV4dC5qYXZh) | `21.42% <0.00%> (-38.58%)` | `1.00% <0.00%> (ø%)` | |
| [...che/shardingsphere/agent/core/yaml/YamlEngine.java](https://codecov.io/gh/apache/shardingsphere/pull/8665/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtYWdlbnQvc2hhcmRpbmdzcGhlcmUtYWdlbnQtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvYWdlbnQvY29yZS95YW1sL1lhbWxFbmdpbmUuamF2YQ==) | `0.00% <0.00%> (-36.37%)` | `0.00% <0.00%> (ø%)` | |
| [...i/prometheus/PrometheusMetricsRegisterFactory.java](https://codecov.io/gh/apache/shardingsphere/pull/8665/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtYWdlbnQvc2hhcmRpbmdzcGhlcmUtYWdlbnQtcGx1Z2lucy9zaGFyZGluZ3NwaGVyZS1hZ2VudC1wbHVnaW4tbWV0cmljcy9zaGFyZGluZ3NwaGVyZS1hZ2VudC1tZXRyaWNzLWFwaS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvYWdlbnQvbWV0cmljcy9hcGkvcHJvbWV0aGV1cy9Qcm9tZXRoZXVzTWV0cmljc1JlZ2lzdGVyRmFjdG9yeS5qYXZh) | `0.00% <0.00%> (-33.34%)` | `0.00% <0.00%> (-1.00%)` | |
| [...saction/xa/manager/XATransactionManagerLoader.java](https://codecov.io/gh/apache/shardingsphere/pull/8665/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtdHJhbnNhY3Rpb24vc2hhcmRpbmdzcGhlcmUtdHJhbnNhY3Rpb24tMnBjL3NoYXJkaW5nc3BoZXJlLXRyYW5zYWN0aW9uLXhhL3NoYXJkaW5nc3BoZXJlLXRyYW5zYWN0aW9uLXhhLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3RyYW5zYWN0aW9uL3hhL21hbmFnZXIvWEFUcmFuc2FjdGlvbk1hbmFnZXJMb2FkZXIuamF2YQ==) | `50.00% <0.00%> (-26.93%)` | `0.00% <0.00%> (ø%)` | |
| ... and [170 more](https://codecov.io/gh/apache/shardingsphere/pull/8665/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/8665?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/8665?src=pr&el=footer). Last update [3e350c1...df2a68f](https://codecov.io/gh/apache/shardingsphere/pull/8665?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] tristaZero merged pull request #8665: Add sql stats visitor
Posted by GitBox <gi...@apache.org>.
tristaZero merged pull request #8665:
URL: https://github.com/apache/shardingsphere/pull/8665
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] codecov-io edited a comment on pull request #8665: Add sql stats visitor
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #8665:
URL: https://github.com/apache/shardingsphere/pull/8665#issuecomment-747863547
# [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/8665?src=pr&el=h1) Report
> Merging [#8665](https://codecov.io/gh/apache/shardingsphere/pull/8665?src=pr&el=desc) (f11ff7b) into [master](https://codecov.io/gh/apache/shardingsphere/commit/69cdf6ac155d147f9d0ec0802e4c6a7f36fb0c80?el=desc) (69cdf6a) will **decrease** coverage by `0.09%`.
> The diff coverage is `40.00%`.
[](https://codecov.io/gh/apache/shardingsphere/pull/8665?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #8665 +/- ##
============================================
- Coverage 71.09% 70.99% -0.10%
Complexity 622 622
============================================
Files 1573 1574 +1
Lines 25136 25209 +73
Branches 4174 4416 +242
============================================
+ Hits 17870 17898 +28
- Misses 6081 6122 +41
- Partials 1185 1189 +4
```
| [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/8665?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
|---|---|---|---|
| [...shardingsphere/sql/parser/sql/common/SqlStats.java](https://codecov.io/gh/apache/shardingsphere/pull/8665/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLXN0YXRlbWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9zcWwvY29tbW9uL1NxbFN0YXRzLmphdmE=) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
| [.../sql/parser/mysql/visitor/MySQLSQLStatVisitor.java](https://codecov.io/gh/apache/shardingsphere/pull/8665/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLWRpYWxlY3Qvc2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci1teXNxbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9teXNxbC92aXNpdG9yL015U1FMU1FMU3RhdFZpc2l0b3IuamF2YQ==) | `50.90% <50.90%> (ø)` | `0.00 <0.00> (?)` | |
| [...xecute/executor/importer/AbstractJDBCImporter.java](https://codecov.io/gh/apache/shardingsphere/pull/8665/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtc2NhbGluZy9zaGFyZGluZ3NwaGVyZS1zY2FsaW5nLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NjYWxpbmcvY29yZS9leGVjdXRlL2V4ZWN1dG9yL2ltcG9ydGVyL0Fic3RyYWN0SkRCQ0ltcG9ydGVyLmphdmE=) | `85.10% <0.00%> (-1.07%)` | `0.00% <0.00%> (ø%)` | |
| [.../apache/shardingsphere/ha/algorithm/MGRHAType.java](https://codecov.io/gh/apache/shardingsphere/pull/8665/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtaGEvc2hhcmRpbmdzcGhlcmUtaGEtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9oYS9hbGdvcml0aG0vTUdSSEFUeXBlLmphdmE=) | `3.84% <0.00%> (-0.27%)` | `0.00% <0.00%> (ø%)` | |
| [...here/proxy/frontend/state/impl/LockProxyState.java](https://codecov.io/gh/apache/shardingsphere/pull/8665/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktZnJvbnRlbmQvc2hhcmRpbmdzcGhlcmUtcHJveHktZnJvbnRlbmQtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvZnJvbnRlbmQvc3RhdGUvaW1wbC9Mb2NrUHJveHlTdGF0ZS5qYXZh) | `0.00% <0.00%> (ø)` | `0.00% <0.00%> (ø%)` | |
| [...pository/zookeeper/CuratorZookeeperRepository.java](https://codecov.io/gh/apache/shardingsphere/pull/8665/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtZ292ZXJuYW5jZS9zaGFyZGluZ3NwaGVyZS1nb3Zlcm5hbmNlLXJlcG9zaXRvcnkvc2hhcmRpbmdzcGhlcmUtZ292ZXJuYW5jZS1yZXBvc2l0b3J5LXByb3ZpZGVyL3NoYXJkaW5nc3BoZXJlLWdvdmVybmFuY2UtcmVwb3NpdG9yeS16b29rZWVwZXItY3VyYXRvci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvZ292ZXJuYW5jZS9yZXBvc2l0b3J5L3pvb2tlZXBlci9DdXJhdG9yWm9va2VlcGVyUmVwb3NpdG9yeS5qYXZh) | `72.09% <0.00%> (ø)` | `29.00% <0.00%> (ø%)` | |
| [...xy/backend/exception/LockWaitTimeoutException.java](https://codecov.io/gh/apache/shardingsphere/pull/8665/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC9leGNlcHRpb24vTG9ja1dhaXRUaW1lb3V0RXhjZXB0aW9uLmphdmE=) | | | |
| [...hardingsphere/governance/core/lock/LockCenter.java](https://codecov.io/gh/apache/shardingsphere/pull/8665/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtZ292ZXJuYW5jZS9zaGFyZGluZ3NwaGVyZS1nb3Zlcm5hbmNlLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2dvdmVybmFuY2UvY29yZS9sb2NrL0xvY2tDZW50ZXIuamF2YQ==) | `44.82% <0.00%> (+2.89%)` | `0.00% <0.00%> (ø%)` | |
| ... and [1 more](https://codecov.io/gh/apache/shardingsphere/pull/8665/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/8665?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/8665?src=pr&el=footer). Last update [69cdf6a...f11ff7b](https://codecov.io/gh/apache/shardingsphere/pull/8665?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] codecov-io edited a comment on pull request #8665: Add sql stats visitor
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #8665:
URL: https://github.com/apache/shardingsphere/pull/8665#issuecomment-747863547
# [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/8665?src=pr&el=h1) Report
> Merging [#8665](https://codecov.io/gh/apache/shardingsphere/pull/8665?src=pr&el=desc) (cdf286c) into [master](https://codecov.io/gh/apache/shardingsphere/commit/69cdf6ac155d147f9d0ec0802e4c6a7f36fb0c80?el=desc) (69cdf6a) will **decrease** coverage by `0.28%`.
> The diff coverage is `40.00%`.
[](https://codecov.io/gh/apache/shardingsphere/pull/8665?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #8665 +/- ##
============================================
- Coverage 71.09% 70.80% -0.29%
+ Complexity 622 621 -1
============================================
Files 1573 1574 +1
Lines 25136 25231 +95
Branches 4174 4413 +239
============================================
- Hits 17870 17866 -4
- Misses 6081 6174 +93
- Partials 1185 1191 +6
```
| [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/8665?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
|---|---|---|---|
| [...shardingsphere/sql/parser/sql/common/SqlStats.java](https://codecov.io/gh/apache/shardingsphere/pull/8665/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLXN0YXRlbWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9zcWwvY29tbW9uL1NxbFN0YXRzLmphdmE=) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
| [...r/sql/common/segment/dml/column/ColumnSegment.java](https://codecov.io/gh/apache/shardingsphere/pull/8665/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLXN0YXRlbWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9zcWwvY29tbW9uL3NlZ21lbnQvZG1sL2NvbHVtbi9Db2x1bW5TZWdtZW50LmphdmE=) | `33.33% <0.00%> (-41.67%)` | `0.00 <0.00> (ø)` | |
| [.../sql/parser/mysql/visitor/MySQLSQLStatVisitor.java](https://codecov.io/gh/apache/shardingsphere/pull/8665/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLWRpYWxlY3Qvc2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci1teXNxbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9teXNxbC92aXNpdG9yL015U1FMU1FMU3RhdFZpc2l0b3IuamF2YQ==) | `50.90% <50.90%> (ø)` | `0.00 <0.00> (?)` | |
| [...rdingsphere/agent/metrics/api/MetricsProvider.java](https://codecov.io/gh/apache/shardingsphere/pull/8665/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtYWdlbnQvc2hhcmRpbmdzcGhlcmUtYWdlbnQtcGx1Z2lucy9zaGFyZGluZ3NwaGVyZS1hZ2VudC1wbHVnaW4tbWV0cmljcy9zaGFyZGluZ3NwaGVyZS1hZ2VudC1tZXRyaWNzLWFwaS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvYWdlbnQvbWV0cmljcy9hcGkvTWV0cmljc1Byb3ZpZGVyLmphdmE=) | `0.00% <0.00%> (-100.00%)` | `0.00% <0.00%> (ø%)` | |
| [...re/agent/core/config/AgentConfigurationLoader.java](https://codecov.io/gh/apache/shardingsphere/pull/8665/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtYWdlbnQvc2hhcmRpbmdzcGhlcmUtYWdlbnQtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvYWdlbnQvY29yZS9jb25maWcvQWdlbnRDb25maWd1cmF0aW9uTG9hZGVyLmphdmE=) | `0.00% <0.00%> (-83.34%)` | `0.00% <0.00%> (ø%)` | |
| [...nce/core/lock/strategy/GovernanceLockStrategy.java](https://codecov.io/gh/apache/shardingsphere/pull/8665/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtZ292ZXJuYW5jZS9zaGFyZGluZ3NwaGVyZS1nb3Zlcm5hbmNlLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2dvdmVybmFuY2UvY29yZS9sb2NrL3N0cmF0ZWd5L0dvdmVybmFuY2VMb2NrU3RyYXRlZ3kuamF2YQ==) | `28.57% <0.00%> (-42.86%)` | `1.00% <0.00%> (+1.00%)` | :arrow_down: |
| [...ere/scaling/core/utils/RdbmsConfigurationUtil.java](https://codecov.io/gh/apache/shardingsphere/pull/8665/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtc2NhbGluZy9zaGFyZGluZ3NwaGVyZS1zY2FsaW5nLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NjYWxpbmcvY29yZS91dGlscy9SZGJtc0NvbmZpZ3VyYXRpb25VdGlsLmphdmE=) | `40.00% <0.00%> (-40.00%)` | `0.00% <0.00%> (ø%)` | |
| [...che/shardingsphere/agent/core/yaml/YamlEngine.java](https://codecov.io/gh/apache/shardingsphere/pull/8665/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtYWdlbnQvc2hhcmRpbmdzcGhlcmUtYWdlbnQtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvYWdlbnQvY29yZS95YW1sL1lhbWxFbmdpbmUuamF2YQ==) | `0.00% <0.00%> (-36.37%)` | `0.00% <0.00%> (ø%)` | |
| [...i/prometheus/PrometheusMetricsRegisterFactory.java](https://codecov.io/gh/apache/shardingsphere/pull/8665/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtYWdlbnQvc2hhcmRpbmdzcGhlcmUtYWdlbnQtcGx1Z2lucy9zaGFyZGluZ3NwaGVyZS1hZ2VudC1wbHVnaW4tbWV0cmljcy9zaGFyZGluZ3NwaGVyZS1hZ2VudC1tZXRyaWNzLWFwaS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvYWdlbnQvbWV0cmljcy9hcGkvcHJvbWV0aGV1cy9Qcm9tZXRoZXVzTWV0cmljc1JlZ2lzdGVyRmFjdG9yeS5qYXZh) | `0.00% <0.00%> (-33.34%)` | `0.00% <0.00%> (-1.00%)` | |
| [...phere/governance/core/registry/RegistryCenter.java](https://codecov.io/gh/apache/shardingsphere/pull/8665/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtZ292ZXJuYW5jZS9zaGFyZGluZ3NwaGVyZS1nb3Zlcm5hbmNlLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2dvdmVybmFuY2UvY29yZS9yZWdpc3RyeS9SZWdpc3RyeUNlbnRlci5qYXZh) | `54.05% <0.00%> (-24.90%)` | `0.00% <0.00%> (ø%)` | |
| ... and [89 more](https://codecov.io/gh/apache/shardingsphere/pull/8665/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/8665?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/8665?src=pr&el=footer). Last update [69cdf6a...cdf286c](https://codecov.io/gh/apache/shardingsphere/pull/8665?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] tristaZero commented on a change in pull request #8665: Add sql stats visitor
Posted by GitBox <gi...@apache.org>.
tristaZero commented on a change in pull request #8665:
URL: https://github.com/apache/shardingsphere/pull/8665#discussion_r547694756
##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/SqlStats.java
##########
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.sql.parser.sql.common;
+
+import lombok.Getter;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.column.ColumnSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.SimpleTableSegment;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+@Getter
+public final class SqlStats {
+
+ private final Map<String, SimpleTableSegment> tables = new LinkedHashMap<>();
+
+ private final Map<Integer, ColumnSegment> columns = new LinkedHashMap<>();
Review comment:
If `keys` is just for uniqueness judgment, `HashSet` is enough I guess.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org