beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lc...@apache.org
Subject [1/2] incubator-beam git commit: [BEAM-405] Fixes inefficient use of keySet iterator instead of entrySet iterator.
Date Wed, 06 Jul 2016 12:18:14 GMT
Repository: incubator-beam
Updated Branches:
  refs/heads/master 9adbecb6a -> 8147037d6


[BEAM-405] Fixes inefficient use of keySet iterator instead of entrySet iterator.

BiggQueryIO$StreamingWriteFn.finishBundle: Fixes inefficient use of keySet iterator instead
of entrySet iterator.


Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/88cc25d7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/88cc25d7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/88cc25d7

Branch: refs/heads/master
Commit: 88cc25d76dd769ff0f309010348b94b22f2ff16f
Parents: 9adbecb
Author: Lucas Amorim <lucasamorim@Lucass-MacBook-Pro.local>
Authored: Sun Jul 3 15:47:15 2016 -0700
Committer: Luke Cwik <lcwik@google.com>
Committed: Wed Jul 6 04:56:46 2016 -0700

----------------------------------------------------------------------
 .../build-tools/src/main/resources/beam/findbugs-filter.xml  | 6 ------
 .../src/main/java/org/apache/beam/sdk/io/BigQueryIO.java     | 8 ++++----
 2 files changed, 4 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/88cc25d7/sdks/java/build-tools/src/main/resources/beam/findbugs-filter.xml
----------------------------------------------------------------------
diff --git a/sdks/java/build-tools/src/main/resources/beam/findbugs-filter.xml b/sdks/java/build-tools/src/main/resources/beam/findbugs-filter.xml
index 3f15835..a871eb7 100644
--- a/sdks/java/build-tools/src/main/resources/beam/findbugs-filter.xml
+++ b/sdks/java/build-tools/src/main/resources/beam/findbugs-filter.xml
@@ -122,12 +122,6 @@
     <!--May expose internal representation by incorporating reference to mutable object-->
   </Match>
   <Match>
-    <Class name="org.apache.beam.sdk.io.BigQueryIO$StreamingWriteFn"/>
-    <Method name="finishBundle"/>
-    <Bug pattern="WMI_WRONG_MAP_ITERATOR"/>
-    <!--Inefficient use of keySet iterator instead of entrySet iterator-->
-  </Match>
-  <Match>
     <Class name="org.apache.beam.sdk.io.PubsubIO$Read$Bound$PubsubBoundedReader"/>
     <Method name="processElement"/>
     <Bug pattern="DMI_RANDOM_USED_ONLY_ONCE"/>

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/88cc25d7/sdks/java/core/src/main/java/org/apache/beam/sdk/io/BigQueryIO.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/io/BigQueryIO.java b/sdks/java/core/src/main/java/org/apache/beam/sdk/io/BigQueryIO.java
index 7955022..9141f39 100644
--- a/sdks/java/core/src/main/java/org/apache/beam/sdk/io/BigQueryIO.java
+++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/io/BigQueryIO.java
@@ -2063,10 +2063,10 @@ public class BigQueryIO {
       BigQueryOptions options = context.getPipelineOptions().as(BigQueryOptions.class);
       Bigquery client = Transport.newBigQueryClient(options).build();
 
-      for (String tableSpec : tableRows.keySet()) {
-        TableReference tableReference = getOrCreateTable(options, tableSpec);
-        flushRows(client, tableReference, tableRows.get(tableSpec),
-            uniqueIdsForTableRows.get(tableSpec), options);
+      for (Map.Entry<String, List<TableRow>> entry : tableRows.entrySet()) {
+        TableReference tableReference = getOrCreateTable(options, entry.getKey());
+        flushRows(client, tableReference, entry.getValue(),
+            uniqueIdsForTableRows.get(entry.getKey()), options);
       }
       tableRows.clear();
       uniqueIdsForTableRows.clear();


Mime
View raw message