calcite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jh...@apache.org
Subject [13/50] [abbrv] calcite git commit: Deprecate some Util methods, and upgrade last modules to JDK 1.7
Date Thu, 21 Jan 2016 22:38:50 GMT
Deprecate some Util methods, and upgrade last modules to JDK 1.7


Project: http://git-wip-us.apache.org/repos/asf/calcite/repo
Commit: http://git-wip-us.apache.org/repos/asf/calcite/commit/4ae02986
Tree: http://git-wip-us.apache.org/repos/asf/calcite/tree/4ae02986
Diff: http://git-wip-us.apache.org/repos/asf/calcite/diff/4ae02986

Branch: refs/heads/branch-release
Commit: 4ae0298688d402484be7c76610e46c6f610a8bc6
Parents: 77e6f49
Author: Julian Hyde <jhyde@apache.org>
Authored: Thu Sep 10 19:27:49 2015 -0700
Committer: Julian Hyde <jhyde@apache.org>
Committed: Sun Jan 10 00:51:24 2016 -0800

----------------------------------------------------------------------
 .../java/org/apache/calcite/rel/RelRoot.java    |  8 +++
 .../main/java/org/apache/calcite/util/Util.java | 51 ++++++++++++--------
 .../calcite/sql/test/SqlOperatorBaseTest.java   |  5 +-
 .../org/apache/calcite/test/LatticeTest.java    |  4 +-
 .../org/apache/calcite/tools/PlannerTest.java   | 34 +++++++------
 mongodb/pom.xml                                 |  8 ---
 .../calcite/adapter/mongodb/MongoTable.java     | 13 ++---
 plus/pom.xml                                    |  8 ---
 spark/pom.xml                                   |  7 ---
 9 files changed, 71 insertions(+), 67 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/calcite/blob/4ae02986/core/src/main/java/org/apache/calcite/rel/RelRoot.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/rel/RelRoot.java b/core/src/main/java/org/apache/calcite/rel/RelRoot.java
index 77f3782..82506d2 100644
--- a/core/src/main/java/org/apache/calcite/rel/RelRoot.java
+++ b/core/src/main/java/org/apache/calcite/rel/RelRoot.java
@@ -109,6 +109,14 @@ public class RelRoot {
         RelCollations.EMPTY);
   }
 
+  @Override public String toString() {
+    return "Root {kind: " + kind
+        + ", rel: " + rel
+        + ", rowType: " + validatedRowType
+        + ", fields: " + fields
+        + ", collation: " + collation + "}";
+  }
+
   /** Creates a copy of this RelRoot, assigning a {@link RelNode}. */
   public RelRoot withRel(RelNode rel) {
     if (rel == this.rel) {

http://git-wip-us.apache.org/repos/asf/calcite/blob/4ae02986/core/src/main/java/org/apache/calcite/util/Util.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/Util.java b/core/src/main/java/org/apache/calcite/util/Util.java
index 35dc0ff..4dc2fdc 100644
--- a/core/src/main/java/org/apache/calcite/util/Util.java
+++ b/core/src/main/java/org/apache/calcite/util/Util.java
@@ -52,6 +52,7 @@ import java.io.StringWriter;
 import java.io.Writer;
 import java.lang.reflect.Array;
 import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
 import java.math.BigDecimal;
 import java.net.MalformedURLException;
 import java.net.URL;
@@ -323,7 +324,7 @@ public class Util {
     } else if (set2.isEmpty()) {
       return set1;
     } else {
-      Set<T> set = new HashSet<T>(set1);
+      Set<T> set = new HashSet<>(set1);
       set.removeAll(set2);
       return set;
     }
@@ -432,7 +433,7 @@ public class Util {
       Field[] fields = clazz.getFields();
       int printed = 0;
       for (Field field : fields) {
-        if (isStatic(field)) {
+        if (Modifier.isStatic(field.getModifiers())) {
           continue;
         }
         if (printed++ > 0) {
@@ -469,8 +470,6 @@ public class Util {
     if (s == null) {
       if (nullMeansNull) {
         pw.print("null");
-      } else {
-        //pw.print("");
       }
     } else {
       String s1 = replace(s, "\\", "\\\\");
@@ -583,6 +582,7 @@ public class Util {
   /**
    * Creates a file-protocol URL for the given file.
    */
+  @Deprecated // to be removed before 2.0
   public static URL toURL(File file) throws MalformedURLException {
     String path = file.getAbsolutePath();
 
@@ -607,6 +607,7 @@ public class Util {
    * Gets a timestamp string for use in file names. The generated timestamp
    * string reflects the current time.
    */
+  @Deprecated // to be removed before 2.0
   public static String getFileTimestamp() {
     SimpleDateFormat sdf = new SimpleDateFormat(FILE_TIMESTAMP_FORMAT);
     return sdf.format(new java.util.Date());
@@ -700,19 +701,15 @@ public class Util {
    * @param iter iterator to materialize
    * @return materialized list
    */
+  @Deprecated // to be removed before 2.0
   public static <T> List<T> toList(Iterator<T> iter) {
-    List<T> list = new ArrayList<T>();
+    List<T> list = new ArrayList<>();
     while (iter.hasNext()) {
       list.add(iter.next());
     }
     return list;
   }
 
-  static boolean isStatic(java.lang.reflect.Member member) {
-    int modifiers = member.getModifiers();
-    return java.lang.reflect.Modifier.isStatic(modifiers);
-  }
-
   /**
    * @return true if s==null or if s.length()==0
    */
@@ -800,6 +797,7 @@ public class Util {
    *
    * @return a non-null string containing all messages of the exception
    */
+  @Deprecated // to be removed before 2.0
   public static String getMessages(Throwable t) {
     StringBuilder sb = new StringBuilder();
     for (Throwable curr = t; curr != null; curr = curr.getCause()) {
@@ -820,7 +818,10 @@ public class Util {
    *
    * @param t Throwable
    * @return Stack trace
+   *
+   * @deprecated Use {@link com.google.common.base.Throwables#getStackTraceAsString(Throwable)}
    */
+  @Deprecated // to be removed before 2.0
   public static String getStackTrace(Throwable t) {
     final StringWriter sw = new StringWriter();
     final PrintWriter pw = new PrintWriter(sw);
@@ -1010,6 +1011,7 @@ public class Util {
    * @param reader reader to read from
    * @return reader contents as string
    */
+  @Deprecated // to be removed before 2.0
   public static String readAllAsString(Reader reader) throws IOException {
     StringBuilder sb = new StringBuilder();
     char[] buf = new char[4096];
@@ -1030,6 +1032,7 @@ public class Util {
    *
    * @param jar jar to close
    */
+  @Deprecated // to be removed before 2.0
   public static void squelchJar(JarFile jar) {
     try {
       if (jar != null) {
@@ -1047,6 +1050,7 @@ public class Util {
    *
    * @param stream stream to close
    */
+  @Deprecated // to be removed before 2.0
   public static void squelchStream(InputStream stream) {
     try {
       if (stream != null) {
@@ -1066,6 +1070,7 @@ public class Util {
    *
    * @param stream stream to close
    */
+  @Deprecated // to be removed before 2.0
   public static void squelchStream(OutputStream stream) {
     try {
       if (stream != null) {
@@ -1083,6 +1088,7 @@ public class Util {
    *
    * @param reader reader to close
    */
+  @Deprecated // to be removed before 2.0
   public static void squelchReader(Reader reader) {
     try {
       if (reader != null) {
@@ -1102,6 +1108,7 @@ public class Util {
    *
    * @param writer writer to close
    */
+  @Deprecated // to be removed before 2.0
   public static void squelchWriter(Writer writer) {
     try {
       if (writer != null) {
@@ -1119,6 +1126,7 @@ public class Util {
    *
    * @param stmt stmt to close
    */
+  @Deprecated // to be removed before 2.0
   public static void squelchStmt(Statement stmt) {
     try {
       if (stmt != null) {
@@ -1136,6 +1144,7 @@ public class Util {
    *
    * @param connection connection to close
    */
+  @Deprecated // to be removed before 2.0
   public static void squelchConnection(Connection connection) {
     try {
       if (connection != null) {
@@ -1152,6 +1161,7 @@ public class Util {
    * @param s string to be trimmed
    * @return trimmed string
    */
+  @Deprecated // to be removed before 2.0
   public static String rtrim(String s) {
     int n = s.length() - 1;
     if (n >= 0) {
@@ -1174,6 +1184,7 @@ public class Util {
    * @param len desired length
    * @return padded string
    */
+  @Deprecated // to be removed before 2.0
   public static String rpad(String s, int len) {
     if (s.length() >= len) {
       return s;
@@ -1509,6 +1520,7 @@ public class Util {
    * @throws IOException
    * @throws InterruptedException
    */
+  @Deprecated // to be removed before 2.0
   public static int runApplication(
       String[] cmdarray,
       Logger logger,
@@ -1527,6 +1539,7 @@ public class Util {
    * @param cmdarray command and arguments.
    * @return a ProcessBuilder.
    */
+  @Deprecated // to be removed before 2.0
   public static ProcessBuilder newAppProcess(String[] cmdarray) {
     // Concatenate quoted words from cmdarray.
     // REVIEW mb 2/24/09 Why is this needed?
@@ -1702,11 +1715,11 @@ public class Util {
    * @param includeFilter Class whose instances to include
    */
   public static <E> Iterable<E> filter(
-      final Iterable<? extends Object> iterable,
+      final Iterable<?> iterable,
       final Class<E> includeFilter) {
     return new Iterable<E>() {
       public Iterator<E> iterator() {
-        return new Filterator<E>(iterable.iterator(), includeFilter);
+        return new Filterator<>(iterable.iterator(), includeFilter);
       }
     };
   }
@@ -1718,7 +1731,7 @@ public class Util {
       private int size = -1;
 
       public Iterator<E> iterator() {
-        return new Filterator<E>(collection.iterator(), includeFilter);
+        return new Filterator<>(collection.iterator(), includeFilter);
       }
 
       public int size() {
@@ -1728,9 +1741,7 @@ public class Util {
           // filtering values.  (Some java.util algorithms
           // call next() on the result of iterator() size() times.)
           int s = 0;
-          Iterator<E> iter = iterator();
-          while (iter.hasNext()) {
-            iter.next();
+          for (E e : this) {
             s++;
           }
           size = s;
@@ -1753,7 +1764,7 @@ public class Util {
   public static <E> List<E> filter(
       final List<?> list,
       final Class<E> includeFilter) {
-    List<E> result = new ArrayList<E>();
+    List<E> result = new ArrayList<>();
     for (Object o : list) {
       if (includeFilter.isInstance(o)) {
         result.add(includeFilter.cast(o));
@@ -1784,6 +1795,7 @@ public class Util {
    */
   public static Map<String, String> toMap(
       final Properties properties) {
+    //noinspection unchecked
     return (Map) properties;
   }
 
@@ -1806,7 +1818,7 @@ public class Util {
    * @return Map with given contents
    */
   public static <K, V> Map<K, V> mapOf(K key, V value, Object... keyValues) {
-    final Map<K, V> map = new LinkedHashMap<K, V>(1 + keyValues.length);
+    final Map<K, V> map = new LinkedHashMap<>(1 + keyValues.length);
     map.put(key, value);
     for (int i = 0; i < keyValues.length;) {
       //noinspection unchecked
@@ -2071,7 +2083,7 @@ public class Util {
       }
       return -1;
     }
-    final Map<E, Object> set = new HashMap<E, Object>(size);
+    final Map<E, Object> set = new HashMap<>(size);
     for (E e : list) {
       if (set.put(e, "") != null) {
         return set.size();
@@ -2316,6 +2328,7 @@ public class Util {
     private final Object node;
 
     /** Singleton instance. Can be used if you don't care about node. */
+    @SuppressWarnings("ThrowableInstanceNeverThrown")
     public static final FoundOne NULL = new FoundOne(null);
 
     public FoundOne(Object node) {

http://git-wip-us.apache.org/repos/asf/calcite/blob/4ae02986/core/src/test/java/org/apache/calcite/sql/test/SqlOperatorBaseTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/sql/test/SqlOperatorBaseTest.java b/core/src/test/java/org/apache/calcite/sql/test/SqlOperatorBaseTest.java
index 47161b3..6a35641 100644
--- a/core/src/test/java/org/apache/calcite/sql/test/SqlOperatorBaseTest.java
+++ b/core/src/test/java/org/apache/calcite/sql/test/SqlOperatorBaseTest.java
@@ -50,6 +50,7 @@ import org.apache.calcite.util.Pair;
 import org.apache.calcite.util.Util;
 
 import com.google.common.base.Function;
+import com.google.common.base.Throwables;
 import com.google.common.collect.Lists;
 
 import org.junit.Before;
@@ -5274,7 +5275,7 @@ public abstract class SqlOperatorBaseTest {
       } catch (SQLException e) {
         thrown = e;
       }
-      final String stack = Util.getStackTrace(thrown);
+      final String stack = Throwables.getStackTraceAsString(thrown);
       for (Pattern pattern : patterns) {
         if (pattern.matcher(stack).matches()) {
           return;
@@ -5316,7 +5317,7 @@ public abstract class SqlOperatorBaseTest {
         thrown = e;
       }
       if (thrown != null) {
-        final String stack = Util.getStackTrace(thrown);
+        final String stack = Throwables.getStackTraceAsString(thrown);
         for (Pattern pattern : patterns) {
           if (pattern.matcher(stack).matches()) {
             return;

http://git-wip-us.apache.org/repos/asf/calcite/blob/4ae02986/core/src/test/java/org/apache/calcite/test/LatticeTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/test/LatticeTest.java b/core/src/test/java/org/apache/calcite/test/LatticeTest.java
index 69eea60..397ad3a 100644
--- a/core/src/test/java/org/apache/calcite/test/LatticeTest.java
+++ b/core/src/test/java/org/apache/calcite/test/LatticeTest.java
@@ -25,6 +25,7 @@ import org.apache.calcite.util.TestUtil;
 import org.apache.calcite.util.Util;
 
 import com.google.common.base.Function;
+import com.google.common.base.Throwables;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Lists;
 
@@ -236,7 +237,8 @@ public class LatticeTest {
                       + "    StarTableScan(table=[[adhoc, star]])\n",
                   counter));
     } catch (RuntimeException e) {
-      assertThat(Util.getStackTrace(e), containsString("CannotPlanException"));
+      assertThat(Throwables.getStackTraceAsString(e),
+          containsString("CannotPlanException"));
     }
     assertThat(counter.get(), equalTo(1));
   }

http://git-wip-us.apache.org/repos/asf/calcite/blob/4ae02986/core/src/test/java/org/apache/calcite/tools/PlannerTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/tools/PlannerTest.java b/core/src/test/java/org/apache/calcite/tools/PlannerTest.java
index b769653..fae8cb9 100644
--- a/core/src/test/java/org/apache/calcite/tools/PlannerTest.java
+++ b/core/src/test/java/org/apache/calcite/tools/PlannerTest.java
@@ -38,6 +38,7 @@ import org.apache.calcite.plan.RelTraitDef;
 import org.apache.calcite.plan.RelTraitSet;
 import org.apache.calcite.rel.RelCollationTraitDef;
 import org.apache.calcite.rel.RelNode;
+import org.apache.calcite.rel.RelRoot;
 import org.apache.calcite.rel.convert.ConverterRule;
 import org.apache.calcite.rel.core.RelFactories;
 import org.apache.calcite.rel.core.TableScan;
@@ -73,6 +74,7 @@ import org.apache.calcite.sql.validate.SqlValidatorScope;
 import org.apache.calcite.test.CalciteAssert;
 import org.apache.calcite.util.Util;
 
+import com.google.common.base.Throwables;
 import com.google.common.collect.ImmutableList;
 
 import org.junit.Ignore;
@@ -102,7 +104,7 @@ public class PlannerTest {
     assertThat(Util.toLinux(parse.toString()), equalTo(queryFromParseTree));
 
     SqlNode validate = planner.validate(parse);
-    RelNode rel = planner.convert(validate);
+    RelNode rel = planner.rel(validate).project();
     assertThat(toString(rel), equalTo(expectedRelExpr));
   }
 
@@ -184,7 +186,7 @@ public class PlannerTest {
       SqlNode validate = planner.validate(parse);
       fail("expected error, got " + validate);
     } catch (ValidationException e) {
-      assertThat(Util.getStackTrace(e),
+      assertThat(Throwables.getStackTraceAsString(e),
           containsString("Column 'Xname' not found in any table"));
       // ok
     }
@@ -256,7 +258,7 @@ public class PlannerTest {
     Planner planner = getPlanner(null);
     SqlNode parse = planner.parse("select * from \"emps\"");
     try {
-      RelNode rel = planner.convert(parse);
+      RelRoot rel = planner.rel(parse);
       fail("expected error, got " + rel);
     } catch (IllegalArgumentException e) {
       assertThat(e.getMessage(),
@@ -272,7 +274,7 @@ public class PlannerTest {
     Planner planner = getPlanner(null);
     SqlNode parse = planner.parse(sql);
     SqlNode validate = planner.validate(parse);
-    RelNode rel = planner.convert(validate);
+    RelNode rel = planner.rel(validate).project();
     final RelOptPredicateList predicates =
         RelMetadataQuery.getPulledUpPredicates(rel);
     final String buf = predicates.pulledUpPredicates.toString();
@@ -327,7 +329,7 @@ public class PlannerTest {
     Planner planner = getPlanner(null, program);
     SqlNode parse = planner.parse("select * from \"emps\"");
     SqlNode validate = planner.validate(parse);
-    RelNode convert = planner.convert(validate);
+    RelNode convert = planner.rel(validate).project();
     RelTraitSet traitSet = planner.getEmptyTraitSet()
         .replace(EnumerableConvention.INSTANCE);
     RelNode transform = planner.transform(0, traitSet, convert);
@@ -350,7 +352,7 @@ public class PlannerTest {
         "select * from \"emps\" "
             + "order by \"emps\".\"deptno\"");
     SqlNode validate = planner.validate(parse);
-    RelNode convert = planner.convert(validate);
+    RelNode convert = planner.rel(validate).project();
     RelTraitSet traitSet = convert.getTraitSet()
         .replace(EnumerableConvention.INSTANCE);
     RelNode transform = planner.transform(0, traitSet, convert);
@@ -432,7 +434,7 @@ public class PlannerTest {
         Programs.of(ruleSet));
     SqlNode parse = planner.parse(sql);
     SqlNode validate = planner.validate(parse);
-    RelNode convert = planner.convert(validate);
+    RelNode convert = planner.rel(validate).rel;
     RelTraitSet traitSet = planner.getEmptyTraitSet()
         .replace(EnumerableConvention.INSTANCE);
     if (traitSet.getTrait(RelCollationTraitDef.INSTANCE) == null) {
@@ -458,7 +460,7 @@ public class PlannerTest {
             + "order by \"emps\".\"deptno\") "
             + "order by \"deptno\"");
     SqlNode validate = planner.validate(parse);
-    RelNode convert = planner.convert(validate);
+    RelNode convert = planner.rel(validate).rel;
     RelTraitSet traitSet = planner.getEmptyTraitSet()
         .replace(EnumerableConvention.INSTANCE);
     RelNode transform = planner.transform(0, traitSet, convert);
@@ -486,7 +488,7 @@ public class PlannerTest {
 
     SqlNode parse = planner.parse("select * from \"emps\"");
     SqlNode validate = planner.validate(parse);
-    RelNode convert = planner.convert(validate);
+    RelNode convert = planner.rel(validate).project();
     RelTraitSet traitSet = planner.getEmptyTraitSet()
         .replace(EnumerableConvention.INSTANCE);
     RelNode transform = planner.transform(0, traitSet, convert);
@@ -506,7 +508,7 @@ public class PlannerTest {
     Planner planner = getPlanner(null, Programs.of(ruleSet));
     SqlNode parse = planner.parse("select * from \"emps\"");
     SqlNode validate = planner.validate(parse);
-    RelNode convert = planner.convert(validate);
+    RelNode convert = planner.rel(validate).project();
     RelTraitSet traitSet = planner.getEmptyTraitSet()
         .replace(EnumerableConvention.INSTANCE);
     RelNode transform = planner.transform(0, traitSet, convert);
@@ -609,7 +611,7 @@ public class PlannerTest {
     SqlNode parse = planner.parse("select T1.\"name\" from \"emps\" as T1 ");
 
     SqlNode validate = planner.validate(parse);
-    RelNode convert = planner.convert(validate);
+    RelNode convert = planner.rel(validate).project();
 
     RelTraitSet traitSet0 = planner.getEmptyTraitSet()
         .replace(EnumerableConvention.INSTANCE);
@@ -670,7 +672,7 @@ public class PlannerTest {
     SqlNode parse = planner.parse(buf.toString());
 
     SqlNode validate = planner.validate(parse);
-    RelNode convert = planner.convert(validate);
+    RelNode convert = planner.rel(validate).project();
     RelTraitSet traitSet = planner.getEmptyTraitSet()
         .replace(EnumerableConvention.INSTANCE);
     RelNode transform = planner.transform(0, traitSet, convert);
@@ -749,7 +751,7 @@ public class PlannerTest {
         Programs.heuristicJoinOrder(Programs.RULE_SET, false, 0));
     SqlNode parse = planner.parse(sql);
     SqlNode validate = planner.validate(parse);
-    RelNode convert = planner.convert(validate);
+    RelNode convert = planner.rel(validate).rel;
     RelTraitSet traitSet = planner.getEmptyTraitSet()
         .replace(EnumerableConvention.INSTANCE);
     RelNode transform = planner.transform(0, traitSet, convert);
@@ -877,7 +879,7 @@ public class PlannerTest {
     SqlNode parse = planner.parse(sql);
 
     SqlNode validate = planner.validate(parse);
-    RelNode convert = planner.convert(validate);
+    RelNode convert = planner.rel(validate).project();
     RelTraitSet traitSet = planner.getEmptyTraitSet()
         .replace(EnumerableConvention.INSTANCE);
     RelNode transform = planner.transform(0, traitSet, convert);
@@ -992,7 +994,7 @@ public class PlannerTest {
     Planner p = Frameworks.getPlanner(config);
     SqlNode n = p.parse(tpchTestQuery);
     n = p.validate(n);
-    RelNode r = p.convert(n);
+    RelNode r = p.rel(n).project();
     String plan = RelOptUtil.toString(r);
     p.close();
     return plan;
@@ -1050,7 +1052,7 @@ public class PlannerTest {
             .build());
     SqlNode n = p.parse(query);
     n = p.validate(n);
-    RelNode r = p.convert(n);
+    RelNode r = p.rel(n).project();
     String plan = RelOptUtil.toString(r);
     plan = Util.toLinux(plan);
     p.close();

http://git-wip-us.apache.org/repos/asf/calcite/blob/4ae02986/mongodb/pom.xml
----------------------------------------------------------------------
diff --git a/mongodb/pom.xml b/mongodb/pom.xml
index 96c8adb..5d23fc2 100644
--- a/mongodb/pom.xml
+++ b/mongodb/pom.xml
@@ -78,14 +78,6 @@ limitations under the License.
            pluginManagement in the root POM, not here. -->
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-compiler-plugin</artifactId>
-        <configuration>
-          <source>1.5</source>
-          <target>1.5</target>
-        </configuration>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-jar-plugin</artifactId>
         <executions>
           <execution>

http://git-wip-us.apache.org/repos/asf/calcite/blob/4ae02986/mongodb/src/main/java/org/apache/calcite/adapter/mongodb/MongoTable.java
----------------------------------------------------------------------
diff --git a/mongodb/src/main/java/org/apache/calcite/adapter/mongodb/MongoTable.java b/mongodb/src/main/java/org/apache/calcite/adapter/mongodb/MongoTable.java
index af8d80c..78e1898 100644
--- a/mongodb/src/main/java/org/apache/calcite/adapter/mongodb/MongoTable.java
+++ b/mongodb/src/main/java/org/apache/calcite/adapter/mongodb/MongoTable.java
@@ -34,6 +34,8 @@ import org.apache.calcite.schema.impl.AbstractTableQueryable;
 import org.apache.calcite.sql.type.SqlTypeName;
 import org.apache.calcite.util.Util;
 
+import com.google.common.collect.Lists;
+
 import com.mongodb.AggregationOptions;
 import com.mongodb.AggregationOutput;
 import com.mongodb.BasicDBList;
@@ -76,7 +78,7 @@ public class MongoTable extends AbstractQueryableTable
 
   public <T> Queryable<T> asQueryable(QueryProvider queryProvider,
       SchemaPlus schema, String tableName) {
-    return new MongoQueryable<T>(queryProvider, schema, this, tableName);
+    return new MongoQueryable<>(queryProvider, schema, this, tableName);
   }
 
   public RelNode toRel(
@@ -131,7 +133,7 @@ public class MongoTable extends AbstractQueryableTable
   public Enumerable<Object> aggregate(final DB mongoDb,
       final List<Map.Entry<String, Class>> fields,
       final List<String> operations) {
-    final List<DBObject> list = new ArrayList<DBObject>();
+    final List<DBObject> list = new ArrayList<>();
     final BasicDBList versionArray = (BasicDBList) mongoDb
         .command("buildInfo").get("versionArray");
     final Integer versionMajor = parseIntString(versionArray
@@ -165,10 +167,9 @@ public class MongoTable extends AbstractQueryableTable
                    .outputMode(AggregationOptions.OutputMode.CURSOR).build();
               // Warning - this can result in a very large ArrayList!
               // but you should know your data and aggregate accordingly
-              ArrayList<DBObject> resultAsArrayList
-                = new ArrayList<DBObject>(Util.toList(mongoDb.
-                      getCollection(collectionName)
-                       .aggregate(list, options)));
+              final List<DBObject> resultAsArrayList =
+                  Lists.newArrayList(mongoDb.getCollection(collectionName)
+                      .aggregate(list, options));
               resultIterator = resultAsArrayList.iterator();
             } else { // Pre MongoDB version 2.6
               AggregationOutput result = aggregateOldWay(mongoDb

http://git-wip-us.apache.org/repos/asf/calcite/blob/4ae02986/plus/pom.xml
----------------------------------------------------------------------
diff --git a/plus/pom.xml b/plus/pom.xml
index 8975280..99721ce 100644
--- a/plus/pom.xml
+++ b/plus/pom.xml
@@ -86,14 +86,6 @@ limitations under the License.
            pluginManagement in the root POM, not here. -->
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-compiler-plugin</artifactId>
-        <configuration>
-          <source>1.5</source>
-          <target>1.5</target>
-        </configuration>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-jar-plugin</artifactId>
         <executions>
           <execution>

http://git-wip-us.apache.org/repos/asf/calcite/blob/4ae02986/spark/pom.xml
----------------------------------------------------------------------
diff --git a/spark/pom.xml b/spark/pom.xml
index 66dd23b..25448ca 100644
--- a/spark/pom.xml
+++ b/spark/pom.xml
@@ -91,13 +91,6 @@ limitations under the License.
   <build>
     <plugins>
       <plugin>
-        <artifactId>maven-compiler-plugin</artifactId>
-        <configuration>
-          <source>1.5</source>
-          <target>1.5</target>
-        </configuration>
-      </plugin>
-      <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-jar-plugin</artifactId>
         <executions>


Mime
View raw message