This is an automated email from the ASF dual-hosted git repository.

qmm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-druid.git


The following commit(s) were added to refs/heads/master by this push:
     new a7391b3  Copy splitToList from Guava (#6800)
a7391b3 is described below

commit a7391b396b28438a1d2ab668332356b4a81183e4
Author: Jihoon Son <[email protected]>
AuthorDate: Thu Jan 3 02:42:13 2019 -0800

    Copy splitToList from Guava (#6800)
    
    * Copy splitToList from Guava
    
    * add comment
    
    * fix commit tag
---
 NOTICE                                             |  2 +-
 .../java/util/common/parsers/DelimitedParser.java  | 25 +++++++++++++++++++++-
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/NOTICE b/NOTICE
index 8207dac..fb92a6d 100644
--- a/NOTICE
+++ b/NOTICE
@@ -77,7 +77,7 @@ This product contains a modified version of The Guava 
Authors's Closer class fro
  * HOMEPAGE:
    * https://github.com/google/guava
  * COMMIT TAG:
-   * 
https://github.com/google/guava/blob/c462d69329709f72a17a64cb229d15e76e72199c
+   * 
https://github.com/google/guava/commit/0ba7ccf36f5384a321cb78d62375bf7574e7bc24
 
 This product contains code adapted from Apache Hadoop
   * LICENSE:
diff --git 
a/core/src/main/java/org/apache/druid/java/util/common/parsers/DelimitedParser.java
 
b/core/src/main/java/org/apache/druid/java/util/common/parsers/DelimitedParser.java
index 0953fdc..61eafa7 100644
--- 
a/core/src/main/java/org/apache/druid/java/util/common/parsers/DelimitedParser.java
+++ 
b/core/src/main/java/org/apache/druid/java/util/common/parsers/DelimitedParser.java
@@ -24,6 +24,9 @@ import com.google.common.base.Preconditions;
 import com.google.common.base.Splitter;
 
 import javax.annotation.Nullable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
 import java.util.List;
 
 public class DelimitedParser extends AbstractFlatTextFormatParser
@@ -74,6 +77,26 @@ public class DelimitedParser extends 
AbstractFlatTextFormatParser
   @Override
   protected List<String> parseLine(String input)
   {
-    return splitter.splitToList(input);
+    return splitToList(input);
+  }
+
+  /**
+   * Copied from Guava's {@link Splitter#splitToList(CharSequence)}.
+   * This is to avoid the error of the missing method signature when using an 
old Guava library.
+   * For example, it may happen when running Druid Hadoop indexing jobs, since 
we may inherit the version provided by
+   * the Hadoop cluster. See 
https://github.com/apache/incubator-druid/issues/6801.
+   */
+  private List<String> splitToList(String input)
+  {
+    Preconditions.checkNotNull(input);
+
+    Iterator<String> iterator = splitter.split(input).iterator();
+    List<String> result = new ArrayList<String>();
+
+    while (iterator.hasNext()) {
+      result.add(iterator.next());
+    }
+
+    return Collections.unmodifiableList(result);
   }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to