[jira] [Commented] (FLINK-10189) FindBugs warnings: Inefficient use of keySet iterator instead of entrySet iterator

2018-08-29 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/FLINK-10189?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16596450#comment-16596450
 ] 

ASF GitHub Bot commented on FLINK-10189:


zentol closed pull request #6596: [FLINK-10189] Fix FindBugs warnings: 
Inefficient use of keySet iterat…
URL: https://github.com/apache/flink/pull/6596
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/flink-connectors/flink-hbase/src/main/java/org/apache/flink/addons/hbase/HBaseTableSource.java
 
b/flink-connectors/flink-hbase/src/main/java/org/apache/flink/addons/hbase/HBaseTableSource.java
index 1e090d42589..27b75d49ac9 100644
--- 
a/flink-connectors/flink-hbase/src/main/java/org/apache/flink/addons/hbase/HBaseTableSource.java
+++ 
b/flink-connectors/flink-hbase/src/main/java/org/apache/flink/addons/hbase/HBaseTableSource.java
@@ -144,9 +144,10 @@ public HBaseTableSource projectFields(int[] fields) {
for (int field : fields) {
String family = famNames[field];
Map> familyInfo = 
hBaseSchema.getFamilyInfo(family);
-   for (String qualifier : familyInfo.keySet()) {
+   for (Map.Entry> entry : 
familyInfo.entrySet()) {
// create the newSchema
-   newTableSource.addColumn(family, qualifier, 
familyInfo.get(qualifier).getTypeClass());
+   String qualifier = entry.getKey();
+   newTableSource.addColumn(family, qualifier, 
entry.getValue().getTypeClass());
}
}
return newTableSource;
diff --git 
a/flink-runtime/src/main/java/org/apache/flink/runtime/state/ttl/TtlMapState.java
 
b/flink-runtime/src/main/java/org/apache/flink/runtime/state/ttl/TtlMapState.java
index f6f81ffc940..f92e8e4d95c 100644
--- 
a/flink-runtime/src/main/java/org/apache/flink/runtime/state/ttl/TtlMapState.java
+++ 
b/flink-runtime/src/main/java/org/apache/flink/runtime/state/ttl/TtlMapState.java
@@ -68,8 +68,9 @@ public void putAll(Map map) throws Exception {
return;
}
Map> ttlMap = new HashMap<>(map.size());
-   for (UK key : map.keySet()) {
-   ttlMap.put(key, wrapWithTs(map.get(key)));
+   for (Map.Entry entry : map.entrySet()) {
+   UK key = entry.getKey();
+   ttlMap.put(key, wrapWithTs(entry.getValue()));
}
original.putAll(ttlMap);
}


 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> FindBugs warnings: Inefficient use of keySet iterator instead of entrySet 
> iterator
> --
>
> Key: FLINK-10189
> URL: https://issues.apache.org/jira/browse/FLINK-10189
> Project: Flink
>  Issue Type: Bug
>Reporter: Hiroaki Yoshida
>Priority: Major
>  Labels: pull-request-available
>
> FindBugs-3.0.1 ([http://findbugs.sourceforge.net/]) reported two 
> WMI_WRONG_MAP_ITERATOR warnings on master:
> {code:java}
> M P WMI: org.apache.flink.runtime.state.ttl.TtlMapState.putAll(Map) makes 
> inefficient use of keySet iterator instead of entrySet iterator  At 
> TtlMapState.java:[line 72]
> M P WMI: org.apache.flink.addons.hbase.HBaseTableSource.projectFields(int[]) 
> makes inefficient use of keySet iterator instead of entrySet iterator  At 
> HBaseTableSource.java:[line 19] 
> {code}
> The description of the bug is as follows:
> {quote}*WMI: Inefficient use of keySet iterator instead of entrySet iterator 
> (WMI_WRONG_MAP_ITERATOR)*
> This method accesses the value of a Map entry, using a key that was retrieved 
> from a keySet iterator. It is more efficient to use an iterator on the 
> entrySet of the map, to avoid the Map.get(key) lookup.
> [http://findbugs.sourceforge.net/bugDescriptions.html#WMI_WRONG_MAP_ITERATOR]
> {quote}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (FLINK-10189) FindBugs warnings: Inefficient use of keySet iterator instead of entrySet iterator

2018-08-21 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/FLINK-10189?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16587608#comment-16587608
 ] 

ASF GitHub Bot commented on FLINK-10189:


yanghua commented on issue #6596: [FLINK-10189] Fix FindBugs warnings: 
Inefficient use of keySet iterat…
URL: https://github.com/apache/flink/pull/6596#issuecomment-414721125
 
 
   @hiroakiy Thanks for your contribution. The change looks good to me. I just 
give a suggestion : change the PR's description like other PRs (Flink has its 
PR template) to give more details (such as test coverage).


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> FindBugs warnings: Inefficient use of keySet iterator instead of entrySet 
> iterator
> --
>
> Key: FLINK-10189
> URL: https://issues.apache.org/jira/browse/FLINK-10189
> Project: Flink
>  Issue Type: Bug
>Reporter: Hiroaki Yoshida
>Priority: Major
>  Labels: pull-request-available
>
> FindBugs-3.0.1 ([http://findbugs.sourceforge.net/]) reported two 
> WMI_WRONG_MAP_ITERATOR warnings on master:
> {code:java}
> M P WMI: org.apache.flink.runtime.state.ttl.TtlMapState.putAll(Map) makes 
> inefficient use of keySet iterator instead of entrySet iterator  At 
> TtlMapState.java:[line 72]
> M P WMI: org.apache.flink.addons.hbase.HBaseTableSource.projectFields(int[]) 
> makes inefficient use of keySet iterator instead of entrySet iterator  At 
> HBaseTableSource.java:[line 19] 
> {code}
> The description of the bug is as follows:
> {quote}*WMI: Inefficient use of keySet iterator instead of entrySet iterator 
> (WMI_WRONG_MAP_ITERATOR)*
> This method accesses the value of a Map entry, using a key that was retrieved 
> from a keySet iterator. It is more efficient to use an iterator on the 
> entrySet of the map, to avoid the Map.get(key) lookup.
> [http://findbugs.sourceforge.net/bugDescriptions.html#WMI_WRONG_MAP_ITERATOR]
> {quote}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (FLINK-10189) FindBugs warnings: Inefficient use of keySet iterator instead of entrySet iterator

2018-08-21 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/FLINK-10189?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16587305#comment-16587305
 ] 

ASF GitHub Bot commented on FLINK-10189:


hiroakiy opened a new pull request #6596: [FLINK-10189] Fix FindBugs warnings: 
Inefficient use of keySet iterat…
URL: https://github.com/apache/flink/pull/6596
 
 
   This PR fixes two WMI_WRONG_MAP_ITERATOR warnings reported by FindBugs-3.0.1 
([http://findbugs.sourceforge.net/](http://findbugs.sourceforge.net/)):
   ```
   M P WMI: org.apache.flink.runtime.state.ttl.TtlMapState.putAll(Map) makes 
inefficient use of keySet iterator instead of entrySet iterator  At 
TtlMapState.java:[line 72]
   M P WMI: org.apache.flink.addons.hbase.HBaseTableSource.projectFields(int[]) 
makes inefficient use of keySet iterator instead of entrySet iterator  At 
HBaseTableSource.java:[line 19]
   ```
   The description of the bug is as follows:
   > **WMI: Inefficient use of keySet iterator instead of entrySet iterator 
(WMI_WRONG_MAP_ITERATOR)**
   > This method accesses the value of a Map entry, using a key that was 
retrieved from keySet iterator. It is more efficient to use an iterator on the 
entrySet of the map, to avoid the Map.get(key) lookup.
   > 
[http://findbugs.sourceforge.net/bugDescriptions.html#WMI_WRONG_MAP_ITERATOR](http://findbugs.sourceforge.net/bugDescriptions.html#WMI_WRONG_MAP_ITERATOR)


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> FindBugs warnings: Inefficient use of keySet iterator instead of entrySet 
> iterator
> --
>
> Key: FLINK-10189
> URL: https://issues.apache.org/jira/browse/FLINK-10189
> Project: Flink
>  Issue Type: Bug
>Reporter: Hiroaki Yoshida
>Priority: Major
>  Labels: pull-request-available
>
> FindBugs-3.0.1 ([http://findbugs.sourceforge.net/]) reported two 
> WMI_WRONG_MAP_ITERATOR warnings on master:
> {code:java}
> M P WMI: org.apache.flink.runtime.state.ttl.TtlMapState.putAll(Map) makes 
> inefficient use of keySet iterator instead of entrySet iterator  At 
> TtlMapState.java:[line 72]
> M P WMI: org.apache.flink.addons.hbase.HBaseTableSource.projectFields(int[]) 
> makes inefficient use of keySet iterator instead of entrySet iterator  At 
> HBaseTableSource.java:[line 19] 
> {code}
> The description of the bug is as follows:
> {quote}*WMI: Inefficient use of keySet iterator instead of entrySet iterator 
> (WMI_WRONG_MAP_ITERATOR)*
> This method accesses the value of a Map entry, using a key that was retrieved 
> from a keySet iterator. It is more efficient to use an iterator on the 
> entrySet of the map, to avoid the Map.get(key) lookup.
> [http://findbugs.sourceforge.net/bugDescriptions.html#WMI_WRONG_MAP_ITERATOR]
> {quote}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)