aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolodymyr Vysotskyi <vvovyk@gmail.com>2018-04-23 11:38:39 +0300
committerVolodymyr Vysotskyi <vvovyk@gmail.com>2018-08-28 20:04:25 +0300
commit44e63bd0deda72af726f51e0ff78fc2b636c64eb (patch)
tree6729d28338ead5c071a1c23f2cbcabe1e340387f
parentd8f9fb6a5cf22a01fa3f48bd40e7dbeb3cb6e4e4 (diff)
DRILL-6422: Update guava to 23.0 and shade it
- Fix compilation errors for new version of Guava. - Remove usage of deprecated API - Shade guava and add dependencies to the shaded version - Ban unshaded package - Introduce drill-shaded module and move guava-shaded under it - Add methods to convert shaded guava lists to the unshaded ones - Add instruction for publishing artifacts to the Apache repository
-rw-r--r--common/src/main/java/org/apache/drill/common/util/DrillFileUtils.java2
-rw-r--r--common/src/main/java/org/apache/drill/common/util/GuavaUtils.java47
-rw-r--r--contrib/storage-hbase/src/test/java/org/apache/drill/hbase/BaseHBaseTest.java2
-rw-r--r--contrib/storage-jdbc/src/main/java/org/apache/drill/exec/store/jdbc/DrillJdbcRuleBase.java3
-rwxr-xr-xcontrib/storage-jdbc/src/main/java/org/apache/drill/exec/store/jdbc/JdbcStoragePlugin.java5
-rw-r--r--contrib/storage-mongo/src/main/java/org/apache/drill/exec/store/mongo/MongoSubScan.java4
-rw-r--r--distribution/src/assemble/bin.xml1
-rw-r--r--docs/dev/UpgradeGuava.md62
-rw-r--r--drill-shaded/drill-shaded-guava/pom.xml72
-rw-r--r--drill-shaded/pom.xml74
-rw-r--r--drill-yarn/src/main/java/org/apache/drill/yarn/zk/ZKClusterCoordinator.java8
-rw-r--r--exec/java-exec/src/main/java/org/apache/drill/exec/coord/zk/ZKClusterCoordinator.java11
-rw-r--r--exec/java-exec/src/main/java/org/apache/drill/exec/expr/HoldingContainerExpression.java5
-rw-r--r--exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractReceiver.java8
-rw-r--r--exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractSubScan.java5
-rw-r--r--exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/UnnestPOP.java4
-rw-r--r--exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/Values.java4
-rw-r--r--exec/java-exec/src/main/java/org/apache/drill/exec/planner/FileSystemPartitionDescriptor.java3
-rw-r--r--exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillValuesRelBase.java12
-rw-r--r--exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillValuesRel.java6
-rw-r--r--exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ValuesPrel.java8
-rw-r--r--exec/java-exec/src/main/java/org/apache/drill/exec/schema/Field.java8
-rw-r--r--exec/java-exec/src/main/java/org/apache/drill/exec/schema/NamedField.java46
-rw-r--r--exec/java-exec/src/main/java/org/apache/drill/exec/schema/OrderedField.java34
-rw-r--r--exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/WorkspaceSchemaFactory.java22
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/DrillSystemTestBase.java4
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/RunRootExec.java2
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/TestQueriesOnLargeFile.java12
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/ZookeeperHelper.java4
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/client/DumpCatTest.java2
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestAggregateFunction.java2
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestDateFunctions.java2
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestMathFunctions.java2
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestMultiInputAdd.java2
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestNewAggregateFunctions.java4
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestRepeatedFunction.java2
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/impersonation/TestInboundImpersonationPrivileges.java6
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/memory/TestAllocators.java4
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/physical/config/TestParsePhysicalPlan.java2
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestBroadcastExchange.java8
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestCastFunctions.java18
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestCastVarCharToBigInt.java4
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestDecimal.java24
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestDistributedFragmentRun.java8
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestExtractFunctions.java9
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestHashToRandomExchange.java4
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestReverseImplicitCast.java2
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestSimpleFragmentRun.java4
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestSimpleFunctions.java6
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestUnionExchange.java6
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/agg/TestAgg.java2
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/filter/TestSimpleFilter.java4
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestHashJoin.java14
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestMergeJoin.java30
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestMergeJoinMulCondition.java14
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/limit/TestSimpleLimit.java4
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/mergereceiver/TestMergingReceiver.java20
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/orderedpartitioner/TestOrderedPartitionExchange.java4
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/project/TestSimpleProjection.java2
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/sort/TestSimpleSort.java4
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/trace/TestTraceMultiRecordBatch.java2
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/trace/TestTraceOutputDump.java10
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/union/TestSimpleUnion.java2
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/writer/TestWriter.java2
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/planner/logical/DrillOptiqTest.java5
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/pop/PopUnitTestBase.java2
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/pop/TestInjectionValue.java2
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/record/TestRecordIterator.java11
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/record/vector/TestDateTypes.java18
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/store/TestImplicitFileColumns.java4
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/ParquetRecordReaderTest.java18
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/store/text/TextRecordReaderTest.java4
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestJsonReader.java4
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/work/batch/TestSpoolingBuffer.java6
-rw-r--r--exec/jdbc-all/pom.xml22
-rw-r--r--exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/DrillConnectionImpl.java2
-rw-r--r--exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/DrillDatabaseMetaDataImpl.java10
-rw-r--r--logical/src/main/java/org/apache/drill/common/expression/NullExpression.java5
-rw-r--r--logical/src/main/java/org/apache/drill/common/expression/TypedNullConstant.java5
-rw-r--r--logical/src/main/java/org/apache/drill/common/expression/ValueExpressions.java28
-rw-r--r--logical/src/main/java/org/apache/drill/common/logical/data/SourceOperator.java5
-rw-r--r--pom.xml18
-rw-r--r--src/main/resources/checkstyle-config.xml5
83 files changed, 581 insertions, 306 deletions
diff --git a/common/src/main/java/org/apache/drill/common/util/DrillFileUtils.java b/common/src/main/java/org/apache/drill/common/util/DrillFileUtils.java
index 343c9473b..4d6d09001 100644
--- a/common/src/main/java/org/apache/drill/common/util/DrillFileUtils.java
+++ b/common/src/main/java/org/apache/drill/common/util/DrillFileUtils.java
@@ -41,6 +41,6 @@ public class DrillFileUtils {
}
public static String getResourceAsString(String fileName) throws IOException {
- return Files.toString(getResourceAsFile(fileName), Charsets.UTF_8);
+ return Files.asCharSource(getResourceAsFile(fileName), Charsets.UTF_8).read();
}
}
diff --git a/common/src/main/java/org/apache/drill/common/util/GuavaUtils.java b/common/src/main/java/org/apache/drill/common/util/GuavaUtils.java
new file mode 100644
index 000000000..5bfbed866
--- /dev/null
+++ b/common/src/main/java/org/apache/drill/common/util/GuavaUtils.java
@@ -0,0 +1,47 @@
+/*
+ * 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.drill.common.util;
+
+import java.util.List;
+
+/**
+ * Utility class which contain methods for conversion guava and shaded guava classes.
+ * Once outer libraries API remove usage of these classes, these methods should be removed.
+ */
+public class GuavaUtils {
+
+ /**
+ * Transforms specified list of lists into {@link com.google.common.collect.ImmutableList} of
+ * {@link com.google.common.collect.ImmutableList} lists to pass it into the methods from other libraries.
+ * @param tuples list to be transformed
+ * @return transformed list
+ */
+ public static <T> com.google.common.collect.ImmutableList
+ <com.google.common.collect.ImmutableList<T>> convertToNestedUnshadedImmutableList(List<? extends List<T>> tuples) {
+ com.google.common.collect.ImmutableList.Builder<com.google.common.collect.ImmutableList<T>> immutableListBuilder =
+ com.google.common.collect.ImmutableList.builder();
+ for (List<T> tuple : tuples) {
+ immutableListBuilder.add(convertToUnshadedImmutableList(tuple));
+ }
+ return immutableListBuilder.build();
+ }
+
+ public static <T> com.google.common.collect.ImmutableList<T> convertToUnshadedImmutableList(List<? extends T> source) {
+ return com.google.common.collect.ImmutableList.copyOf(source);
+ }
+}
diff --git a/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/BaseHBaseTest.java b/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/BaseHBaseTest.java
index ab75eda1e..bb7cc0a21 100644
--- a/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/BaseHBaseTest.java
+++ b/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/BaseHBaseTest.java
@@ -71,7 +71,7 @@ public class BaseHBaseTest extends BaseTestQuery {
}
protected String getPlanText(String planFile, String tableName) throws IOException {
- return Files.toString(DrillFileUtils.getResourceAsFile(planFile), Charsets.UTF_8)
+ return Files.asCharSource(DrillFileUtils.getResourceAsFile(planFile), Charsets.UTF_8).read()
.replaceFirst("\"hbase\\.zookeeper\\.property\\.clientPort\".*:.*\\d+", "\"hbase.zookeeper.property.clientPort\" : " + HBaseTestsSuite.getZookeeperPort())
.replace("[TABLE_NAME]", tableName);
}
diff --git a/contrib/storage-jdbc/src/main/java/org/apache/drill/exec/store/jdbc/DrillJdbcRuleBase.java b/contrib/storage-jdbc/src/main/java/org/apache/drill/exec/store/jdbc/DrillJdbcRuleBase.java
index 9d29a228a..a6438c37f 100644
--- a/contrib/storage-jdbc/src/main/java/org/apache/drill/exec/store/jdbc/DrillJdbcRuleBase.java
+++ b/contrib/storage-jdbc/src/main/java/org/apache/drill/exec/store/jdbc/DrillJdbcRuleBase.java
@@ -20,7 +20,6 @@ package org.apache.drill.exec.store.jdbc;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
-import com.google.common.base.Predicates;
import org.apache.calcite.adapter.jdbc.JdbcConvention;
import org.apache.calcite.adapter.jdbc.JdbcRules;
import org.apache.calcite.plan.Convention;
@@ -52,7 +51,7 @@ abstract class DrillJdbcRuleBase extends ConverterRule {
protected final JdbcConvention out;
private DrillJdbcRuleBase(Class<? extends RelNode> clazz, RelTrait in, JdbcConvention out, String description) {
- super(clazz, Predicates.<RelNode>alwaysTrue(), in, out, DrillRelFactories.LOGICAL_BUILDER, description);
+ super(clazz, input -> true, in, out, DrillRelFactories.LOGICAL_BUILDER, description);
this.out = out;
}
diff --git a/contrib/storage-jdbc/src/main/java/org/apache/drill/exec/store/jdbc/JdbcStoragePlugin.java b/contrib/storage-jdbc/src/main/java/org/apache/drill/exec/store/jdbc/JdbcStoragePlugin.java
index 4de3cf8a1..872e206e5 100755
--- a/contrib/storage-jdbc/src/main/java/org/apache/drill/exec/store/jdbc/JdbcStoragePlugin.java
+++ b/contrib/storage-jdbc/src/main/java/org/apache/drill/exec/store/jdbc/JdbcStoragePlugin.java
@@ -28,7 +28,6 @@ import java.util.Set;
import javax.sql.DataSource;
-import com.google.common.base.Predicates;
import org.apache.calcite.adapter.jdbc.JdbcConvention;
import org.apache.calcite.adapter.jdbc.JdbcRules;
import org.apache.calcite.adapter.jdbc.JdbcSchema;
@@ -202,7 +201,7 @@ public class JdbcStoragePlugin extends AbstractStoragePlugin {
private static class JdbcPrule extends ConverterRule {
private JdbcPrule() {
- super(JdbcDrel.class, Predicates.<RelNode>alwaysTrue(), DrillRel.DRILL_LOGICAL,
+ super(JdbcDrel.class, input -> true, DrillRel.DRILL_LOGICAL,
Prel.DRILL_PHYSICAL, DrillRelFactories.LOGICAL_BUILDER, "JDBC_PREL_Converter");
}
@@ -220,7 +219,7 @@ public class JdbcStoragePlugin extends AbstractStoragePlugin {
private class JdbcDrelConverterRule extends ConverterRule {
public JdbcDrelConverterRule(DrillJdbcConvention in) {
- super(RelNode.class, Predicates.<RelNode>alwaysTrue(), in, DrillRel.DRILL_LOGICAL,
+ super(RelNode.class, input -> true, in, DrillRel.DRILL_LOGICAL,
DrillRelFactories.LOGICAL_BUILDER, "JDBC_DREL_Converter" + in.getName());
}
diff --git a/contrib/storage-mongo/src/main/java/org/apache/drill/exec/store/mongo/MongoSubScan.java b/contrib/storage-mongo/src/main/java/org/apache/drill/exec/store/mongo/MongoSubScan.java
index cff3f5700..c328ae41a 100644
--- a/contrib/storage-mongo/src/main/java/org/apache/drill/exec/store/mongo/MongoSubScan.java
+++ b/contrib/storage-mongo/src/main/java/org/apache/drill/exec/store/mongo/MongoSubScan.java
@@ -17,6 +17,7 @@
*/
package org.apache.drill.exec.store.mongo;
+import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@@ -41,7 +42,6 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.google.common.base.Preconditions;
-import com.google.common.collect.Iterators;
@JsonTypeName("mongo-shard-read")
public class MongoSubScan extends AbstractBase implements SubScan {
@@ -120,7 +120,7 @@ public class MongoSubScan extends AbstractBase implements SubScan {
@Override
public Iterator<PhysicalOperator> iterator() {
- return Iterators.emptyIterator();
+ return Collections.emptyIterator();
}
public static class MongoSubScanSpec {
diff --git a/distribution/src/assemble/bin.xml b/distribution/src/assemble/bin.xml
index 1db6804ef..c65d31a83 100644
--- a/distribution/src/assemble/bin.xml
+++ b/distribution/src/assemble/bin.xml
@@ -105,6 +105,7 @@
<include>org.apache.drill.contrib:drill-storage-kafka</include>
<include>org.apache.drill.contrib:drill-opentsdb-storage</include>
<include>org.apache.drill.contrib:drill-udfs</include>
+ <include>org.apache.drill:drill-shaded-guava</include>
</includes>
<excludes>
<exclude>org.apache.drill.contrib.storage-hive:drill-storage-hive-core:jar:tests</exclude>
diff --git a/docs/dev/UpgradeGuava.md b/docs/dev/UpgradeGuava.md
new file mode 100644
index 000000000..5a0a44af4
--- /dev/null
+++ b/docs/dev/UpgradeGuava.md
@@ -0,0 +1,62 @@
+# How to upgrade Guava in Drill
+
+To avoid conflicts with the version of Guava used by Drill and versions used by other dependencies, Guava was shaded.
+
+## Update shaded version of guava
+
+* Set the new version of Guava to `guava.version` property and to the version of the artifact in
+`drill-shaded/drill-shaded-guava/pom.xml` file.
+* Set the same new version of Guava to `shaded.guava.version` property in the root `pom.xml` file.
+* Build `drill-shaded-guava` module.
+* Try to build Drill and resolve compile errors if required.
+* When all errors are resolved and all tests are passed, push shaded artifacts to the Apache repository.
+* After artifacts became available, changes may be merged.
+
+# How to publish artifacts to the Apache repository
+
+## Prerequisites
+
+Only PMC members have an access for pushing artifacts to the Apache repository.
+
+Setup your development env according to [this instruction](http://www.apache.org/dev/publishing-maven-artifacts.html#dev-env).
+
+Set passphrase variable without putting it into shell history:
+
+`read -s GPG_PASSPHRASE`
+
+## Deploy artifacts with signatures to the staging repository
+
+Change directory to `drill/drill-shaded/drill-shaded-guava`.
+
+* For the case when `maven-gpg-plugin` plugin wasn’t added to the `pom.xml`, run
+
+`mvn clean verify gpg:sign install:install deploy:deploy -Darguments="-Dgpg.passphrase=${GPG_PASSPHRASE} -Dgpg.keyname=${GPG_KEY_ID}"`
+
+* For the case of configured `maven-gpg-plugin` plugin, run
+
+`mvn deploy -Darguments="-Dgpg.passphrase=${GPG_PASSPHRASE} -Dgpg.keyname=${GPG_KEY_ID}"`
+
+## Visit [repository.apache.org](https://repository.apache.org/#stagingRepositories)
+
+* Log in using your Apache credentials
+* Select uploaded staging repository
+* Check that all required `jar` and `pom` files are uploaded
+* Verify that every `jar` and `pom` file has a corresponding signature file (*.asc)
+
+If something went wrong, press `Drop` to remove the staging repository.
+
+## Close staging repository
+
+Select uploaded staging repository and press `Close` button.
+
+Verify that all checks are passed and staging repository was closed. Otherwise, drop staging repository and fix errors.
+
+## Publish artifacts to the Apache repository
+
+Select uploaded staging repository and press `Release` button.
+
+## Check that artifacts were deployed
+
+Find deployed artifacts at [repository.apache.org](https://repository.apache.org/content/groups/public/org/apache/drill/)
+
+Artifacts will become available within 24 hours.
diff --git a/drill-shaded/drill-shaded-guava/pom.xml b/drill-shaded/drill-shaded-guava/pom.xml
new file mode 100644
index 000000000..83645d9e6
--- /dev/null
+++ b/drill-shaded/drill-shaded-guava/pom.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.drill</groupId>
+ <artifactId>drill-shaded</artifactId>
+ <version>1.0</version>
+ </parent>
+
+ <artifactId>drill-shaded-guava</artifactId>
+ <version>23.0</version>
+ <name>drill-shaded/drill-shaded-guava</name>
+
+ <properties>
+ <guava.version>23.0</guava.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>${guava.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <configuration>
+ <artifactSet>
+ <includes>
+ <include>com.google.guava:guava</include>
+ </includes>
+ </artifactSet>
+ <relocations>
+ <relocation>
+ <pattern>com.google.common</pattern>
+ <shadedPattern>org.apache.drill.shaded.guava.com.google.common</shadedPattern>
+ </relocation>
+ <relocation>
+ <pattern>com.google.thirdparty.publicsuffix</pattern>
+ <shadedPattern>org.apache.drill.shaded.guava.com.google.thirdparty.publicsuffix</shadedPattern>
+ </relocation>
+ </relocations>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/drill-shaded/pom.xml b/drill-shaded/pom.xml
new file mode 100644
index 000000000..f9c60456f
--- /dev/null
+++ b/drill-shaded/pom.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache</groupId>
+ <artifactId>apache</artifactId>
+ <version>18</version>
+ <relativePath/>
+ </parent>
+
+ <groupId>org.apache.drill</groupId>
+ <artifactId>drill-shaded</artifactId>
+ <version>1.0</version>
+
+ <name>drill-shaded</name>
+ <packaging>pom</packaging>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <version>3.1.0</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <createSourcesJar>true</createSourcesJar>
+ <shadeSourcesContent>true</shadeSourcesContent>
+ <promoteTransitiveDependencies>true</promoteTransitiveDependencies>
+ <dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation>
+ <transformers>
+ <transformer implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer"/>
+ <transformer implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer">
+ <addHeader>false</addHeader>
+ </transformer>
+ </transformers>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+ <modules>
+ <module>drill-shaded-guava</module>
+ </modules>
+
+</project>
diff --git a/drill-yarn/src/main/java/org/apache/drill/yarn/zk/ZKClusterCoordinator.java b/drill-yarn/src/main/java/org/apache/drill/yarn/zk/ZKClusterCoordinator.java
index 7c5f5f359..70f2f8161 100644
--- a/drill-yarn/src/main/java/org/apache/drill/yarn/zk/ZKClusterCoordinator.java
+++ b/drill-yarn/src/main/java/org/apache/drill/yarn/zk/ZKClusterCoordinator.java
@@ -17,7 +17,6 @@
*/
package org.apache.drill.yarn.zk;
-import static com.google.common.base.Throwables.propagate;
import static com.google.common.collect.Collections2.transform;
import java.io.IOException;
@@ -28,6 +27,7 @@ import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
+import com.google.common.base.Throwables;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.curator.RetryPolicy;
@@ -185,7 +185,8 @@ public class ZKClusterCoordinator extends ClusterCoordinator {
discovery.registerService(serviceInstance);
return new ZKRegistrationHandle(serviceInstance.getId(), data);
} catch (Exception e) {
- throw propagate(e);
+ Throwables.throwIfUnchecked(e);
+ throw new RuntimeException(e);
}
}
@@ -206,7 +207,8 @@ public class ZKClusterCoordinator extends ClusterCoordinator {
.name(serviceName).build();
discovery.unregisterService(serviceInstance);
} catch (Exception e) {
- propagate(e);
+ Throwables.throwIfUnchecked(e);
+ throw new RuntimeException(e);
}
}
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/coord/zk/ZKClusterCoordinator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/coord/zk/ZKClusterCoordinator.java
index cc23a99ec..083b48fb4 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/coord/zk/ZKClusterCoordinator.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/coord/zk/ZKClusterCoordinator.java
@@ -17,7 +17,6 @@
*/
package org.apache.drill.exec.coord.zk;
-import static com.google.common.base.Throwables.propagate;
import static com.google.common.collect.Collections2.transform;
import java.io.IOException;
@@ -32,6 +31,7 @@ import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import com.google.common.base.Throwables;
import org.apache.commons.collections.keyvalue.MultiKey;
import org.apache.curator.RetryPolicy;
import org.apache.curator.framework.CuratorFramework;
@@ -179,7 +179,8 @@ public class ZKClusterCoordinator extends ClusterCoordinator {
discovery.registerService(serviceInstance);
return new ZKRegistrationHandle(serviceInstance.getId(),data);
} catch (Exception e) {
- throw propagate(e);
+ Throwables.throwIfUnchecked(e);
+ throw new RuntimeException(e);
}
}
@@ -202,7 +203,8 @@ public class ZKClusterCoordinator extends ClusterCoordinator {
.build();
discovery.unregisterService(serviceInstance);
} catch (Exception e) {
- propagate(e);
+ Throwables.throwIfUnchecked(e);
+ throw new RuntimeException(e);
}
}
@@ -222,7 +224,8 @@ public class ZKClusterCoordinator extends ClusterCoordinator {
.payload(endpoint).build();
discovery.updateService(serviceInstance);
} catch (Exception e) {
- propagate(e);
+ Throwables.throwIfUnchecked(e);
+ throw new RuntimeException(e);
}
return handle;
}
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/HoldingContainerExpression.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/HoldingContainerExpression.java
index 882ac58bd..ccabb8a3c 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/HoldingContainerExpression.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/HoldingContainerExpression.java
@@ -17,6 +17,7 @@
*/
package org.apache.drill.exec.expr;
+import java.util.Collections;
import java.util.Iterator;
import org.apache.drill.common.expression.ExpressionPosition;
@@ -25,8 +26,6 @@ import org.apache.drill.common.expression.visitors.ExprVisitor;
import org.apache.drill.common.types.TypeProtos.MajorType;
import org.apache.drill.exec.expr.ClassGenerator.HoldingContainer;
-import com.google.common.collect.Iterators;
-
public class HoldingContainerExpression implements LogicalExpression{
static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(HoldingContainerExpression.class);
@@ -38,7 +37,7 @@ public class HoldingContainerExpression implements LogicalExpression{
@Override
public Iterator<LogicalExpression> iterator() {
- return Iterators.emptyIterator();
+ return Collections.emptyIterator();
}
@Override
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractReceiver.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractReceiver.java
index 7fa746016..debb865e6 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractReceiver.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractReceiver.java
@@ -17,6 +17,7 @@
*/
package org.apache.drill.exec.physical.base;
+import java.util.Collections;
import java.util.Iterator;
import java.util.List;
@@ -24,10 +25,9 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterators;
import org.apache.drill.exec.physical.MinorFragmentEndpoint;
-public abstract class AbstractReceiver extends AbstractBase implements Receiver{
+public abstract class AbstractReceiver extends AbstractBase implements Receiver {
static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(AbstractReceiver.class);
@@ -40,7 +40,7 @@ public abstract class AbstractReceiver extends AbstractBase implements Receiver{
* @param senders List of sender MinorFragmentEndpoints each containing sender MinorFragmentId and Drillbit endpoint
* where it is running.
*/
- public AbstractReceiver(int oppositeMajorFragmentId, List<MinorFragmentEndpoint> senders, boolean spooling){
+ public AbstractReceiver(int oppositeMajorFragmentId, List<MinorFragmentEndpoint> senders, boolean spooling) {
this.oppositeMajorFragmentId = oppositeMajorFragmentId;
this.senders = ImmutableList.copyOf(senders);
this.spooling = spooling;
@@ -48,7 +48,7 @@ public abstract class AbstractReceiver extends AbstractBase implements Receiver{
@Override
public Iterator<PhysicalOperator> iterator() {
- return Iterators.emptyIterator();
+ return Collections.emptyIterator();
}
@Override
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractSubScan.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractSubScan.java
index 923b1d116..d744db424 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractSubScan.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractSubScan.java
@@ -17,6 +17,7 @@
*/
package org.apache.drill.exec.physical.base;
+import java.util.Collections;
import java.util.Iterator;
import java.util.List;
@@ -24,8 +25,6 @@ import org.apache.drill.common.exceptions.ExecutionSetupException;
import org.apache.drill.common.graph.GraphVisitor;
import org.apache.drill.exec.record.BatchSchema.SelectionVectorMode;
-import com.google.common.collect.Iterators;
-
public abstract class AbstractSubScan extends AbstractBase implements SubScan{
static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(AbstractSubScan.class);
@@ -58,7 +57,7 @@ public abstract class AbstractSubScan extends AbstractBase implements SubScan{
@Override
public Iterator<PhysicalOperator> iterator() {
- return Iterators.emptyIterator();
+ return Collections.emptyIterator();
}
@Override
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/UnnestPOP.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/UnnestPOP.java
index 022ea3720..42635a83d 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/UnnestPOP.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/UnnestPOP.java
@@ -21,7 +21,6 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeName;
-import com.google.common.collect.Iterators;
import org.apache.drill.common.exceptions.ExecutionSetupException;
import org.apache.drill.common.expression.SchemaPath;
import org.apache.drill.exec.physical.base.AbstractBase;
@@ -30,6 +29,7 @@ import org.apache.drill.exec.physical.base.PhysicalOperator;
import org.apache.drill.exec.physical.base.PhysicalVisitor;
import org.apache.drill.exec.physical.impl.unnest.UnnestRecordBatch;
+import java.util.Collections;
import java.util.Iterator;
import java.util.List;
@@ -66,7 +66,7 @@ public class UnnestPOP extends AbstractBase implements Leaf {
@Override
public Iterator<PhysicalOperator> iterator() {
- return Iterators.emptyIterator();
+ return Collections.emptyIterator();
}
public SchemaPath getColumn() {
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/Values.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/Values.java
index 445851132..c454d60b4 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/Values.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/Values.java
@@ -17,6 +17,7 @@
*/
package org.apache.drill.exec.physical.config;
+import java.util.Collections;
import java.util.Iterator;
import java.util.List;
@@ -29,7 +30,6 @@ import org.apache.drill.exec.physical.base.PhysicalVisitor;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
-import com.google.common.collect.Iterators;
public class Values extends AbstractBase implements Leaf {
@@ -66,7 +66,7 @@ public class Values extends AbstractBase implements Leaf {
@Override
public Iterator<PhysicalOperator> iterator() {
- return Iterators.emptyIterator();
+ return Collections.emptyIterator();
}
}
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/FileSystemPartitionDescriptor.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/FileSystemPartitionDescriptor.java
index 49c9726e9..cce36fb1c 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/FileSystemPartitionDescriptor.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/FileSystemPartitionDescriptor.java
@@ -26,6 +26,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import org.apache.drill.common.util.GuavaUtils;
import com.google.common.base.Charsets;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
@@ -261,7 +262,7 @@ public class FileSystemPartitionDescriptor extends AbstractPartitionDescriptor {
table.getUserName(),
newFormatSelection));
final RelOptTableImpl newOptTableImpl = RelOptTableImpl.create(t.getRelOptSchema(), t.getRowType(), newTable,
- ImmutableList.<String>of());
+ GuavaUtils.convertToUnshadedImmutableList(ImmutableList.of()));
// return an EnumerableTableScan with fileSelection being part of digest of TableScan node.
return DirPrunedEnumerableTableScan.create(oldScan.getCluster(), newOptTableImpl, newFileSelection.toString());
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillValuesRelBase.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillValuesRelBase.java
index f6f72738f..933dc357c 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillValuesRelBase.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillValuesRelBase.java
@@ -34,6 +34,7 @@ import org.apache.calcite.rex.RexLiteral;
import org.apache.calcite.util.NlsString;
import org.apache.drill.common.JSONOptions;
import org.apache.drill.common.exceptions.DrillRuntimeException;
+import org.apache.drill.common.util.GuavaUtils;
import org.apache.drill.exec.vector.complex.fn.ExtendedJsonOutput;
import org.apache.drill.exec.vector.complex.fn.JsonOutput;
import org.joda.time.DateTime;
@@ -44,7 +45,6 @@ import com.fasterxml.jackson.core.JsonLocation;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.util.TokenBuffer;
-import com.google.common.collect.ImmutableList;
/**
* Base class for logical and physical Values implemented in Drill.
@@ -55,7 +55,7 @@ public abstract class DrillValuesRelBase extends Values implements DrillRelNode
protected final JSONOptions content;
- public DrillValuesRelBase(RelOptCluster cluster, RelDataType rowType, ImmutableList<ImmutableList<RexLiteral>> tuples, RelTraitSet traits) {
+ public DrillValuesRelBase(RelOptCluster cluster, RelDataType rowType, List<? extends List<RexLiteral>> tuples, RelTraitSet traits) {
this(cluster, rowType, tuples, traits, convertToJsonOptions(rowType, tuples));
}
@@ -65,10 +65,10 @@ public abstract class DrillValuesRelBase extends Values implements DrillRelNode
*/
public DrillValuesRelBase(RelOptCluster cluster,
RelDataType rowType,
- ImmutableList<ImmutableList<RexLiteral>> tuples,
+ List<? extends List<RexLiteral>> tuples,
RelTraitSet traits,
JSONOptions content) {
- super(cluster, rowType, tuples, traits);
+ super(cluster, rowType, GuavaUtils.convertToNestedUnshadedImmutableList(tuples), traits);
this.content = content;
}
@@ -87,7 +87,7 @@ public abstract class DrillValuesRelBase extends Values implements DrillRelNode
* @param tuples list of constant values in a row-expression
* @return json representation of tuples
*/
- private static JSONOptions convertToJsonOptions(RelDataType rowType, ImmutableList<ImmutableList<RexLiteral>> tuples) {
+ private static JSONOptions convertToJsonOptions(RelDataType rowType, List<? extends List<RexLiteral>> tuples) {
try {
return new JSONOptions(convertToJsonNode(rowType, tuples), JsonLocation.NA);
} catch (IOException e) {
@@ -95,7 +95,7 @@ public abstract class DrillValuesRelBase extends Values implements DrillRelNode
}
}
- private static JsonNode convertToJsonNode(RelDataType rowType, ImmutableList<ImmutableList<RexLiteral>> tuples) throws IOException {
+ private static JsonNode convertToJsonNode(RelDataType rowType, List<? extends List<RexLiteral>> tuples) throws IOException {
TokenBuffer out = new TokenBuffer(MAPPER.getFactory().getCodec(), false);
JsonOutput json = new ExtendedJsonOutput(out);
json.writeStartArray();
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillValuesRel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillValuesRel.java
index fb66acd4c..492e6a39f 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillValuesRel.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillValuesRel.java
@@ -19,7 +19,6 @@ package org.apache.drill.exec.planner.logical;
import java.util.List;
-import com.google.common.collect.ImmutableList;
import org.apache.drill.common.JSONOptions;
import org.apache.drill.common.logical.data.LogicalOperator;
import org.apache.calcite.rel.RelNode;
@@ -36,11 +35,11 @@ import org.apache.drill.exec.planner.common.DrillValuesRelBase;
*/
public class DrillValuesRel extends DrillValuesRelBase implements DrillRel {
- public DrillValuesRel(RelOptCluster cluster, RelDataType rowType, ImmutableList<ImmutableList<RexLiteral>> tuples, RelTraitSet traits) {
+ public DrillValuesRel(RelOptCluster cluster, RelDataType rowType, List<? extends List<RexLiteral>> tuples, RelTraitSet traits) {
super(cluster, rowType, tuples, traits);
}
- public DrillValuesRel(RelOptCluster cluster, RelDataType rowType, ImmutableList<ImmutableList<RexLiteral>> tuples, RelTraitSet traits, JSONOptions content) {
+ public DrillValuesRel(RelOptCluster cluster, RelDataType rowType, List<? extends List<RexLiteral>> tuples, RelTraitSet traits, JSONOptions content) {
super(cluster, rowType, tuples, traits, content);
}
@@ -57,5 +56,4 @@ public class DrillValuesRel extends DrillValuesRelBase implements DrillRel {
.build();
}
-
}
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ValuesPrel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ValuesPrel.java
index 095519fa1..e464b1ad2 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ValuesPrel.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ValuesPrel.java
@@ -22,7 +22,6 @@ import java.util.Collections;
import java.util.Iterator;
import java.util.List;
-import com.google.common.collect.ImmutableList;
import org.apache.calcite.plan.RelOptCluster;
import org.apache.calcite.plan.RelTraitSet;
import org.apache.calcite.rel.RelNode;
@@ -40,11 +39,14 @@ import org.apache.drill.exec.record.BatchSchema.SelectionVectorMode;
*/
public class ValuesPrel extends DrillValuesRelBase implements Prel {
- public ValuesPrel(RelOptCluster cluster, RelDataType rowType, ImmutableList<ImmutableList<RexLiteral>> tuples, RelTraitSet traits) {
+ public ValuesPrel(RelOptCluster cluster, RelDataType rowType, List<? extends List<RexLiteral>> tuples, RelTraitSet traits) {
super(cluster, rowType, tuples, traits);
}
- public ValuesPrel(RelOptCluster cluster, RelDataType rowType, ImmutableList<ImmutableList<RexLiteral>> tuples, RelTraitSet traits, JSONOptions content) {
+ public ValuesPrel(RelOptCluster cluster,
+ RelDataType rowType,
+ List<? extends List<RexLiteral>> tuples, RelTraitSet traits,
+ JSONOptions content) {
super(cluster, rowType, tuples, traits, content);
}
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/schema/Field.java b/exec/java-exec/src/main/java/org/apache/drill/exec/schema/Field.java
index 7280ca3fa..5468df033 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/schema/Field.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/schema/Field.java
@@ -19,7 +19,7 @@ package org.apache.drill.exec.schema;
import org.apache.drill.common.types.TypeProtos.MajorType;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
import com.google.common.base.Strings;
public abstract class Field {
@@ -52,10 +52,10 @@ public abstract class Field {
this.read = read;
}
- protected abstract Objects.ToStringHelper addAttributesToHelper(Objects.ToStringHelper helper);
+ protected abstract MoreObjects.ToStringHelper addAttributesToHelper(MoreObjects.ToStringHelper helper);
- Objects.ToStringHelper getAttributesStringHelper() {
- return Objects.toStringHelper(this).add("type", fieldType)
+ MoreObjects.ToStringHelper getAttributesStringHelper() {
+ return MoreObjects.toStringHelper(this).add("type", fieldType)
.add("fullFieldName", getFullFieldName())
.add("schema", schema == null ? null : schema.toSchemaString()).omitNullValues();
}
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/schema/NamedField.java b/exec/java-exec/src/main/java/org/apache/drill/exec/schema/NamedField.java
index d6c4b6bdd..b37b53b1a 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/schema/NamedField.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/schema/NamedField.java
@@ -20,33 +20,33 @@ package org.apache.drill.exec.schema;
import org.apache.drill.common.types.TypeProtos.MajorType;
import org.apache.drill.exec.schema.json.jackson.JacksonHelper;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
public class NamedField extends Field {
- final MajorType keyType;
- String fieldName;
+ final MajorType keyType;
+ String fieldName;
- public NamedField(RecordSchema parentSchema, String prefixFieldName, String fieldName, MajorType fieldType) {
- this(parentSchema, prefixFieldName, fieldName, fieldType, JacksonHelper.STRING_TYPE);
- }
+ public NamedField(RecordSchema parentSchema, String prefixFieldName, String fieldName, MajorType fieldType) {
+ this(parentSchema, prefixFieldName, fieldName, fieldType, JacksonHelper.STRING_TYPE);
+ }
- public NamedField(RecordSchema parentSchema,
- String prefixFieldName,
- String fieldName,
- MajorType fieldType,
- MajorType keyType) {
- super(parentSchema, fieldType, prefixFieldName);
- this.fieldName = fieldName;
- this.keyType = keyType;
- }
+ public NamedField(RecordSchema parentSchema,
+ String prefixFieldName,
+ String fieldName,
+ MajorType fieldType,
+ MajorType keyType) {
+ super(parentSchema, fieldType, prefixFieldName);
+ this.fieldName = fieldName;
+ this.keyType = keyType;
+ }
- @Override
- public String getFieldName() {
- return fieldName;
- }
+ @Override
+ public String getFieldName() {
+ return fieldName;
+ }
- @Override
- protected Objects.ToStringHelper addAttributesToHelper(Objects.ToStringHelper helper) {
- return helper.add("keyType", keyType);
- }
+ @Override
+ protected MoreObjects.ToStringHelper addAttributesToHelper(MoreObjects.ToStringHelper helper) {
+ return helper.add("keyType", keyType);
+ }
}
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/schema/OrderedField.java b/exec/java-exec/src/main/java/org/apache/drill/exec/schema/OrderedField.java
index 5cc51faae..bd9cb9fae 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/schema/OrderedField.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/schema/OrderedField.java
@@ -19,26 +19,26 @@ package org.apache.drill.exec.schema;
import org.apache.drill.common.types.TypeProtos.MajorType;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
public class OrderedField extends Field {
- private final int index;
+ private final int index;
- public OrderedField(RecordSchema parentSchema,
- MajorType type,
- String prefixFieldName,
- int index) {
- super(parentSchema, type, prefixFieldName);
- this.index = index;
- }
+ public OrderedField(RecordSchema parentSchema,
+ MajorType type,
+ String prefixFieldName,
+ int index) {
+ super(parentSchema, type, prefixFieldName);
+ this.index = index;
+ }
- @Override
- public String getFieldName() {
- return "[" + index + "]";
- }
+ @Override
+ public String getFieldName() {
+ return "[" + index + "]";
+ }
- @Override
- protected Objects.ToStringHelper addAttributesToHelper(Objects.ToStringHelper helper) {
- return helper;
- }
+ @Override
+ protected MoreObjects.ToStringHelper addAttributesToHelper(MoreObjects.ToStringHelper helper) {
+ return helper;
+ }
}
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/WorkspaceSchemaFactory.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/WorkspaceSchemaFactory.java
index 1ff6324e2..3fb8cd211 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/WorkspaceSchemaFactory.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/WorkspaceSchemaFactory.java
@@ -17,8 +17,6 @@
*/
package org.apache.drill.exec.store.dfs;
-import static com.google.common.collect.Collections2.transform;
-import static com.google.common.collect.Sets.newHashSet;
import static java.util.Collections.unmodifiableList;
import java.io.FileNotFoundException;
@@ -34,6 +32,7 @@ import java.util.Queue;
import java.util.Set;
import java.util.concurrent.ThreadLocalRandom;
import java.util.regex.Pattern;
+import java.util.stream.Collectors;
import org.apache.calcite.rel.type.RelDataType;
import org.apache.calcite.rel.type.RelDataTypeFactory;
@@ -479,13 +478,9 @@ public class WorkspaceSchemaFactory {
}
private Set<String> rawTableNames() {
- return newHashSet(
- transform(tables.keySet(), new com.google.common.base.Function<TableInstance, String>() {
- @Override
- public String apply(TableInstance input) {
- return input.sig.name;
- }
- }));
+ return tables.keySet().stream()
+ .map(input -> input.sig.name)
+ .collect(Collectors.toSet());
}
@Override
@@ -501,12 +496,9 @@ public class WorkspaceSchemaFactory {
@Override
public List<Function> getFunctions(String name) {
List<TableSignature> sigs = optionExtractor.getTableSignatures(name);
- return Lists.transform(sigs, new com.google.common.base.Function<TableSignature, Function>() {
- @Override
- public Function apply(TableSignature input) {
- return new WithOptionsTableMacro(input, WorkspaceSchema.this);
- }
- });
+ return sigs.stream()
+ .map(input -> new WithOptionsTableMacro(input, WorkspaceSchema.this))
+ .collect(Collectors.toList());
}
private View getView(DotDrillFile f) throws IOException {
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/DrillSystemTestBase.java b/exec/java-exec/src/test/java/org/apache/drill/exec/DrillSystemTestBase.java
index 494549ebd..a421cde15 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/DrillSystemTestBase.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/DrillSystemTestBase.java
@@ -17,8 +17,6 @@
*/
package org.apache.drill.exec;
-import static com.google.common.base.Throwables.propagate;
-
import java.util.List;
import org.apache.drill.exec.exception.DrillbitStartupException;
@@ -44,7 +42,7 @@ public class DrillSystemTestBase extends TestWithZookeeper {
}
this.servers = servers.build();
} catch (DrillbitStartupException e) {
- propagate(e);
+ throw new RuntimeException(e);
}
}
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/RunRootExec.java b/exec/java-exec/src/test/java/org/apache/drill/exec/RunRootExec.java
index 5065a576c..36f8beebb 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/RunRootExec.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/RunRootExec.java
@@ -51,7 +51,7 @@ public class RunRootExec {
bit.run();
DrillbitContext bitContext = bit.getContext();
PhysicalPlanReader reader = bitContext.getPlanReader();
- PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(new File(path), Charsets.UTF_8));
+ PhysicalPlan plan = reader.readPhysicalPlan(Files.asCharSource(new File(path), Charsets.UTF_8).read());
FunctionImplementationRegistry registry = bitContext.getFunctionImplementationRegistry();
FragmentContextImpl context = new FragmentContextImpl(bitContext, PlanFragment.getDefaultInstance(), null, registry);
SimpleRootExec exec;
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/TestQueriesOnLargeFile.java b/exec/java-exec/src/test/java/org/apache/drill/exec/TestQueriesOnLargeFile.java
index d41eb92f2..eb6ce3961 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/TestQueriesOnLargeFile.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/TestQueriesOnLargeFile.java
@@ -17,7 +17,7 @@
*/
package org.apache.drill.exec;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertEquals;
import java.io.File;
import java.io.PrintWriter;
@@ -74,7 +74,7 @@ public class TestQueriesOnLargeFile extends BaseTestQuery {
}
BigIntVector countV = (BigIntVector) batchLoader.getValueAccessorById(BigIntVector.class, 0).getValueVector();
- assertTrue("Total of "+ NUM_RECORDS + " records expected in count", countV.getAccessor().get(0) == NUM_RECORDS);
+ assertEquals("Total of " + NUM_RECORDS + " records expected in count", countV.getAccessor().get(0), NUM_RECORDS);
batchLoader.clear();
batch.release();
@@ -83,8 +83,8 @@ public class TestQueriesOnLargeFile extends BaseTestQuery {
@Test
public void testMergingReceiver() throws Exception {
- String plan = Files.toString(DrillFileUtils.getResourceAsFile("/largefiles/merging_receiver_large_data.json"),
- Charsets.UTF_8).replace("#{TEST_FILE}", escapeJsonString(dataFile.getPath()));
+ String plan = Files.asCharSource(DrillFileUtils.getResourceAsFile("/largefiles/merging_receiver_large_data.json"),
+ Charsets.UTF_8).read().replace("#{TEST_FILE}", escapeJsonString(dataFile.getPath()));
List<QueryDataBatch> results = testPhysicalWithResults(plan);
int recordsInOutput = 0;
@@ -93,7 +93,7 @@ public class TestQueriesOnLargeFile extends BaseTestQuery {
batch.release();
}
- assertTrue(String.format("Number of records in output is wrong: expected=%d, actual=%s",
- NUM_RECORDS, recordsInOutput), NUM_RECORDS == recordsInOutput);
+ assertEquals(String.format("Number of records in output is wrong: expected=%d, actual=%s",
+ NUM_RECORDS, recordsInOutput), NUM_RECORDS, recordsInOutput);
}
}
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/ZookeeperHelper.java b/exec/java-exec/src/test/java/org/apache/drill/exec/ZookeeperHelper.java
index 5c4f83fd3..44ec483f5 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/ZookeeperHelper.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/ZookeeperHelper.java
@@ -17,8 +17,6 @@
*/
package org.apache.drill.exec;
-import static com.google.common.base.Throwables.propagate;
-
import java.io.File;
import java.io.IOException;
import java.lang.management.ManagementFactory;
@@ -107,7 +105,7 @@ public class ZookeeperHelper {
zkUrl = "localhost:" + zkCluster.getClientPort();
}
} catch (IOException | InterruptedException e) {
- propagate(e);
+ throw new RuntimeException(e);
}
}
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/client/DumpCatTest.java b/exec/java-exec/src/test/java/org/apache/drill/exec/client/DumpCatTest.java
index e6578a2b7..5fc28eb73 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/client/DumpCatTest.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/client/DumpCatTest.java
@@ -63,7 +63,7 @@ public class DumpCatTest extends ExecTest {
final UserClientConnection connection = Mockito.mock(UserClientConnection.class);
final PhysicalPlanReader reader = defaultPhysicalPlanReader(c);
- final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(DrillFileUtils.getResourceAsFile("/trace/simple_trace.json"), Charsets.UTF_8));
+ final PhysicalPlan plan = reader.readPhysicalPlan(Files.asCharSource(DrillFileUtils.getResourceAsFile("/trace/simple_trace.json"), Charsets.UTF_8).read());
final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(c);
final FragmentContextImpl context = new FragmentContextImpl(bitContext, PlanFragment.getDefaultInstance(), connection, registry);
final SimpleRootExec exec = new SimpleRootExec(ImplCreator.getExec(context, (FragmentRoot) plan.getSortedOperators(false).iterator().next()));
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestAggregateFunction.java b/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestAggregateFunction.java
index 975675aac..8225c4542 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestAggregateFunction.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestAggregateFunction.java
@@ -52,7 +52,7 @@ public class TestAggregateFunction extends PopUnitTestBase {
bit.run();
client.connect();
List<QueryDataBatch> results = client.runQuery(QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile(planPath), Charsets.UTF_8).replace("#{TEST_FILE}", dataPath));
+ Files.asCharSource(DrillFileUtils.getResourceAsFile(planPath), Charsets.UTF_8).read().replace("#{TEST_FILE}", dataPath));
RecordBatchLoader batchLoader = new RecordBatchLoader(bit.getContext().getAllocator());
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestDateFunctions.java b/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestDateFunctions.java
index 240b3a70f..8c8f1e9a4 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestDateFunctions.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestDateFunctions.java
@@ -54,7 +54,7 @@ public class TestDateFunctions extends PopUnitTestBase {
bit.run();
client.connect();
List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile(physicalPlan), Charsets.UTF_8)
+ Files.asCharSource(DrillFileUtils.getResourceAsFile(physicalPlan), Charsets.UTF_8).read()
.replace("#{TEST_FILE}", resourceFile));
RecordBatchLoader batchLoader = new RecordBatchLoader(bit.getContext().getAllocator());
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestMathFunctions.java b/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestMathFunctions.java
index ba9eb0449..01696d1d0 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestMathFunctions.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestMathFunctions.java
@@ -58,7 +58,7 @@ public class TestMathFunctions extends ExecTest {
final UserClientConnection connection = Mockito.mock(UserClientConnection.class);
final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(c);
- final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(DrillFileUtils.getResourceAsFile("/functions/simple_math_functions.json"), Charsets.UTF_8));
+ final PhysicalPlan plan = reader.readPhysicalPlan(Files.asCharSource(DrillFileUtils.getResourceAsFile("/functions/simple_math_functions.json"), Charsets.UTF_8).read());
final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(c);
final FragmentContextImpl context = new FragmentContextImpl(bitContext, BitControl.PlanFragment.getDefaultInstance(), connection, registry);
final SimpleRootExec exec = new SimpleRootExec(ImplCreator.getExec(context, (FragmentRoot) plan.getSortedOperators(false).iterator().next()));
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestMultiInputAdd.java b/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestMultiInputAdd.java
index 8fb64a54c..4d706c7e4 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestMultiInputAdd.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestMultiInputAdd.java
@@ -51,7 +51,7 @@ public class TestMultiInputAdd extends PopUnitTestBase {
bit.run();
client.connect();
List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile("/functions/multi_input_add_test.json"), Charsets.UTF_8));
+ Files.asCharSource(DrillFileUtils.getResourceAsFile("/functions/multi_input_add_test.json"), Charsets.UTF_8).read());
RecordBatchLoader batchLoader = new RecordBatchLoader(bit.getContext().getAllocator());
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestNewAggregateFunctions.java b/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestNewAggregateFunctions.java
index 1b3327f1c..32ea24e55 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestNewAggregateFunctions.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestNewAggregateFunctions.java
@@ -55,8 +55,8 @@ public class TestNewAggregateFunctions extends PopUnitTestBase {
client.connect();
List<QueryDataBatch> results = client.runQuery(
QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile(physicalPlan),
- Charsets.UTF_8).replace("#{TEST_FILE}",
+ Files.asCharSource(DrillFileUtils.getResourceAsFile(physicalPlan),
+ Charsets.UTF_8).read().replace("#{TEST_FILE}",
inputDataFile));
RecordBatchLoader batchLoader = new RecordBatchLoader(bit
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestRepeatedFunction.java b/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestRepeatedFunction.java
index f45c28a67..53a29a717 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestRepeatedFunction.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestRepeatedFunction.java
@@ -57,7 +57,7 @@ public class TestRepeatedFunction extends ExecTest {
final UserClientConnection connection = Mockito.mock(UserClientConnection.class);
final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(c);
- final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(DrillFileUtils.getResourceAsFile("/physical_repeated_1.json"), Charsets.UTF_8));
+ final PhysicalPlan plan = reader.readPhysicalPlan(Files.asCharSource(DrillFileUtils.getResourceAsFile("/physical_repeated_1.json"), Charsets.UTF_8).read());
final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(c);
final FragmentContextImpl context = new FragmentContextImpl(bitContext, PlanFragment.getDefaultInstance(), connection, registry);
final SimpleRootExec exec = new SimpleRootExec(ImplCreator.getExec(context, (FragmentRoot) plan.getSortedOperators(false).iterator().next()));
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/impersonation/TestInboundImpersonationPrivileges.java b/exec/java-exec/src/test/java/org/apache/drill/exec/impersonation/TestInboundImpersonationPrivileges.java
index c83adc936..57cc1c05f 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/impersonation/TestInboundImpersonationPrivileges.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/impersonation/TestInboundImpersonationPrivileges.java
@@ -31,7 +31,7 @@ import org.junit.experimental.categories.Category;
import java.io.IOException;
-import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertEquals;
@Category(SecurityTest.class)
public class TestInboundImpersonationPrivileges extends BaseTestImpersonation {
@@ -43,8 +43,8 @@ public class TestInboundImpersonationPrivileges extends BaseTestImpersonation {
static {
try {
- IMPERSONATION_POLICIES = Files.toString(DrillFileUtils.getResourceAsFile("/inbound_impersonation_policies.json"),
- Charsets.UTF_8);
+ IMPERSONATION_POLICIES = Files.asCharSource(DrillFileUtils.getResourceAsFile("/inbound_impersonation_policies.json"),
+ Charsets.UTF_8).read();
} catch (final IOException e) {
throw new RuntimeException("Cannot load impersonation policies.", e);
}
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/memory/TestAllocators.java b/exec/java-exec/src/test/java/org/apache/drill/exec/memory/TestAllocators.java
index 315bc299a..97983b6d7 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/memory/TestAllocators.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/memory/TestAllocators.java
@@ -202,8 +202,8 @@ public class TestAllocators extends DrillTest {
// Get a few physical operators. Easiest way is to read a physical plan.
PhysicalPlanReader planReader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(bitContext,
storageRegistry);
- PhysicalPlan plan = planReader.readPhysicalPlan(Files.toString(DrillFileUtils.getResourceAsFile(planFile),
- Charsets.UTF_8));
+ PhysicalPlan plan = planReader.readPhysicalPlan(Files.asCharSource(DrillFileUtils.getResourceAsFile(planFile),
+ Charsets.UTF_8).read());
List<PhysicalOperator> physicalOperators = plan.getSortedOperators();
Iterator<PhysicalOperator> physicalOperatorIterator = physicalOperators.iterator();
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/config/TestParsePhysicalPlan.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/config/TestParsePhysicalPlan.java
index 54d05cc6e..255c8996d 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/config/TestParsePhysicalPlan.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/config/TestParsePhysicalPlan.java
@@ -49,7 +49,7 @@ public class TestParsePhysicalPlan extends ExecTest {
PhysicalPlanReader reader = new PhysicalPlanReader(c, scanResult, lpp, CoordinationProtos.DrillbitEndpoint.getDefaultInstance(), null);
ObjectReader r = lpp.getMapper().reader(PhysicalPlan.class);
ObjectWriter writer = lpp.getMapper().writer();
- PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(DrillFileUtils.getResourceAsFile("/physical_test1.json"), Charsets.UTF_8));
+ PhysicalPlan plan = reader.readPhysicalPlan(Files.asCharSource(DrillFileUtils.getResourceAsFile("/physical_test1.json"), Charsets.UTF_8).read());
plan.unparse(writer);
}
}
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestBroadcastExchange.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestBroadcastExchange.java
index 39e08f5a4..36ccfd0a7 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestBroadcastExchange.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestBroadcastExchange.java
@@ -50,8 +50,8 @@ public class TestBroadcastExchange extends PopUnitTestBase {
bit2.run();
client.connect();
- String physicalPlan = Files.toString(
- DrillFileUtils.getResourceAsFile("/sender/broadcast_exchange.json"), Charsets.UTF_8)
+ String physicalPlan = Files.asCharSource(
+ DrillFileUtils.getResourceAsFile("/sender/broadcast_exchange.json"), Charsets.UTF_8).read()
.replace("#{LEFT_FILE}", DrillFileUtils.getResourceAsFile("/join/merge_single_batch.left.json").toURI().toString())
.replace("#{RIGHT_FILE}", DrillFileUtils.getResourceAsFile("/join/merge_single_batch.right.json").toURI().toString());
List<QueryDataBatch> results = client.runQuery(QueryType.PHYSICAL, physicalPlan);
@@ -78,8 +78,8 @@ public class TestBroadcastExchange extends PopUnitTestBase {
bit2.run();
client.connect();
- String physicalPlan = Files.toString(
- DrillFileUtils.getResourceAsFile("/sender/broadcast_exchange_long_run.json"), Charsets.UTF_8);
+ String physicalPlan = Files.asCharSource(
+ DrillFileUtils.getResourceAsFile("/sender/broadcast_exchange_long_run.json"), Charsets.UTF_8).read();
List<QueryDataBatch> results = client.runQuery(QueryType.PHYSICAL, physicalPlan);
int count = 0;
for (QueryDataBatch b : results) {
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestCastFunctions.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestCastFunctions.java
index 71f83c7df..de2b3f0db 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestCastFunctions.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestCastFunctions.java
@@ -70,7 +70,7 @@ public class TestCastFunctions extends PopUnitTestBase {
final UserClientConnection connection = Mockito.mock(UserClientConnection.class);
final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(CONFIG);
- final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(DrillFileUtils.getResourceAsFile("/functions/cast/testCastBigInt.json"), Charsets.UTF_8));
+ final PhysicalPlan plan = reader.readPhysicalPlan(Files.asCharSource(DrillFileUtils.getResourceAsFile("/functions/cast/testCastBigInt.json"), Charsets.UTF_8).read());
final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(CONFIG);
final FragmentContextImpl context = new FragmentContextImpl(bitContext, PlanFragment.getDefaultInstance(), connection, registry);
final SimpleRootExec exec = new SimpleRootExec(ImplCreator.getExec(context, (FragmentRoot) plan.getSortedOperators(false).iterator().next()));
@@ -107,7 +107,7 @@ public class TestCastFunctions extends PopUnitTestBase {
final UserClientConnection connection = Mockito.mock(UserClientConnection.class);
final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(CONFIG);
- final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(DrillFileUtils.getResourceAsFile("/functions/cast/testCastInt.json"), Charsets.UTF_8));
+ final PhysicalPlan plan = reader.readPhysicalPlan(Files.asCharSource(DrillFileUtils.getResourceAsFile("/functions/cast/testCastInt.json"), Charsets.UTF_8).read());
final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(CONFIG);
final FragmentContextImpl context = new FragmentContextImpl(bitContext, PlanFragment.getDefaultInstance(), connection, registry);
final SimpleRootExec exec = new SimpleRootExec(ImplCreator.getExec(context, (FragmentRoot) plan.getSortedOperators(false).iterator().next()));
@@ -143,7 +143,7 @@ public class TestCastFunctions extends PopUnitTestBase {
final UserClientConnection connection = Mockito.mock(UserClientConnection.class);
final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(CONFIG);
- final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(DrillFileUtils.getResourceAsFile("/functions/cast/testCastFloat4.json"), Charsets.UTF_8));
+ final PhysicalPlan plan = reader.readPhysicalPlan(Files.asCharSource(DrillFileUtils.getResourceAsFile("/functions/cast/testCastFloat4.json"), Charsets.UTF_8).read());
final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(CONFIG);
final FragmentContextImpl context = new FragmentContextImpl(bitContext, PlanFragment.getDefaultInstance(), connection, registry);
final SimpleRootExec exec = new SimpleRootExec(ImplCreator.getExec(context, (FragmentRoot) plan.getSortedOperators(false).iterator().next()));
@@ -180,7 +180,7 @@ public class TestCastFunctions extends PopUnitTestBase {
final UserClientConnection connection = Mockito.mock(UserClientConnection.class);
final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(CONFIG);
- final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(DrillFileUtils.getResourceAsFile("/functions/cast/testCastFloat8.json"), Charsets.UTF_8));
+ final PhysicalPlan plan = reader.readPhysicalPlan(Files.asCharSource(DrillFileUtils.getResourceAsFile("/functions/cast/testCastFloat8.json"), Charsets.UTF_8).read());
final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(CONFIG);
final FragmentContextImpl context = new FragmentContextImpl(bitContext, PlanFragment.getDefaultInstance(), connection, registry);
final SimpleRootExec exec = new SimpleRootExec(ImplCreator.getExec(context, (FragmentRoot) plan.getSortedOperators(false).iterator().next()));
@@ -217,7 +217,7 @@ public class TestCastFunctions extends PopUnitTestBase {
final UserClientConnection connection = Mockito.mock(UserClientConnection.class);
final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(CONFIG);
- final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(DrillFileUtils.getResourceAsFile("/functions/cast/testCastVarChar.json"), Charsets.UTF_8));
+ final PhysicalPlan plan = reader.readPhysicalPlan(Files.asCharSource(DrillFileUtils.getResourceAsFile("/functions/cast/testCastVarChar.json"), Charsets.UTF_8).read());
final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(CONFIG);
final FragmentContextImpl context = new FragmentContextImpl(bitContext, PlanFragment.getDefaultInstance(), connection, registry);
final SimpleRootExec exec = new SimpleRootExec(ImplCreator.getExec(context, (FragmentRoot) plan.getSortedOperators(false).iterator().next()));
@@ -253,7 +253,7 @@ public class TestCastFunctions extends PopUnitTestBase {
final UserClientConnection connection = Mockito.mock(UserClientConnection.class);
final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(CONFIG);
- final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(DrillFileUtils.getResourceAsFile("/functions/cast/testCastVarBinary.json"), Charsets.UTF_8));
+ final PhysicalPlan plan = reader.readPhysicalPlan(Files.asCharSource(DrillFileUtils.getResourceAsFile("/functions/cast/testCastVarBinary.json"), Charsets.UTF_8).read());
final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(CONFIG);
final FragmentContextImpl context = new FragmentContextImpl(bitContext, PlanFragment.getDefaultInstance(), connection, registry);
final SimpleRootExec exec = new SimpleRootExec(ImplCreator.getExec(context, (FragmentRoot) plan.getSortedOperators(false).iterator().next()));
@@ -289,7 +289,7 @@ public class TestCastFunctions extends PopUnitTestBase {
final UserClientConnection connection = Mockito.mock(UserClientConnection.class);
final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(CONFIG);
- final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(DrillFileUtils.getResourceAsFile("/functions/cast/testCastNested.json"), Charsets.UTF_8));
+ final PhysicalPlan plan = reader.readPhysicalPlan(Files.asCharSource(DrillFileUtils.getResourceAsFile("/functions/cast/testCastNested.json"), Charsets.UTF_8).read());
final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(CONFIG);
final FragmentContextImpl context = new FragmentContextImpl(bitContext, PlanFragment.getDefaultInstance(), connection, registry);
final SimpleRootExec exec = new SimpleRootExec(ImplCreator.getExec(context, (FragmentRoot) plan.getSortedOperators(false).iterator().next()));
@@ -326,7 +326,7 @@ public class TestCastFunctions extends PopUnitTestBase {
final UserClientConnection connection = Mockito.mock(UserClientConnection.class);
final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(CONFIG);
- final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(DrillFileUtils.getResourceAsFile("/functions/cast/testCastNumException.json"), Charsets.UTF_8));
+ final PhysicalPlan plan = reader.readPhysicalPlan(Files.asCharSource(DrillFileUtils.getResourceAsFile("/functions/cast/testCastNumException.json"), Charsets.UTF_8).read());
final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(CONFIG);
final FragmentContextImpl context = new FragmentContextImpl(bitContext, PlanFragment.getDefaultInstance(), connection, registry);
final SimpleRootExec exec = new SimpleRootExec(ImplCreator.getExec(context, (FragmentRoot) plan.getSortedOperators(false).iterator().next()));
@@ -354,7 +354,7 @@ public class TestCastFunctions extends PopUnitTestBase {
client.connect();
final List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile("/functions/cast/testCastVarCharNull.json"), Charsets.UTF_8).replace("#{TEST_FILE}", "/jsoninput/input1.json"));
+ Files.asCharSource(DrillFileUtils.getResourceAsFile("/functions/cast/testCastVarCharNull.json"), Charsets.UTF_8).read().replace("#{TEST_FILE}", "/jsoninput/input1.json"));
final QueryDataBatch batch = results.get(0);
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestCastVarCharToBigInt.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestCastVarCharToBigInt.java
index 1f4ad008f..6c7c97f0d 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestCastVarCharToBigInt.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestCastVarCharToBigInt.java
@@ -50,8 +50,8 @@ public class TestCastVarCharToBigInt extends PopUnitTestBase {
bit.run();
client.connect();
List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile("/functions/cast/test_cast_varchar_to_bigint.json"), Charsets.UTF_8)
- .replace("#{TEST_FILE}", "/scan_json_test_cast.json")
+ Files.asCharSource(DrillFileUtils.getResourceAsFile("/functions/cast/test_cast_varchar_to_bigint.json"), Charsets.UTF_8)
+ .read().replace("#{TEST_FILE}", "/scan_json_test_cast.json")
);
RecordBatchLoader batchLoader = new RecordBatchLoader(bit.getContext().getAllocator());
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestDecimal.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestDecimal.java
index 0f47b802c..bca327b50 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestDecimal.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestDecimal.java
@@ -58,8 +58,8 @@ public class TestDecimal extends PopUnitTestBase {
bit.run();
client.connect();
List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile("/decimal/cast_simple_decimal.json"), Charsets.UTF_8)
- .replace("#{TEST_FILE}", "/input_simple_decimal.json")
+ Files.asCharSource(DrillFileUtils.getResourceAsFile("/decimal/cast_simple_decimal.json"), Charsets.UTF_8)
+ .read().replace("#{TEST_FILE}", "/input_simple_decimal.json")
);
RecordBatchLoader batchLoader = new RecordBatchLoader(bit.getContext().getAllocator());
@@ -103,8 +103,8 @@ public class TestDecimal extends PopUnitTestBase {
bit.run();
client.connect();
List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile("/decimal/cast_float_decimal.json"), Charsets.UTF_8)
- .replace("#{TEST_FILE}", "/input_simple_decimal.json")
+ Files.asCharSource(DrillFileUtils.getResourceAsFile("/decimal/cast_float_decimal.json"), Charsets.UTF_8)
+ .read().replace("#{TEST_FILE}", "/input_simple_decimal.json")
);
RecordBatchLoader batchLoader = new RecordBatchLoader(bit.getContext().getAllocator());
@@ -148,8 +148,8 @@ public class TestDecimal extends PopUnitTestBase {
bit.run();
client.connect();
List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile("/decimal/simple_decimal_arithmetic.json"), Charsets.UTF_8)
- .replace("#{TEST_FILE}", "/input_simple_decimal.json")
+ Files.asCharSource(DrillFileUtils.getResourceAsFile("/decimal/simple_decimal_arithmetic.json"), Charsets.UTF_8)
+ .read().replace("#{TEST_FILE}", "/input_simple_decimal.json")
);
RecordBatchLoader batchLoader = new RecordBatchLoader(bit.getContext().getAllocator());
@@ -199,8 +199,8 @@ public class TestDecimal extends PopUnitTestBase {
bit.run();
client.connect();
List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile("/decimal/test_decimal_complex.json"), Charsets.UTF_8)
- .replace("#{TEST_FILE}", "/input_complex_decimal.json")
+ Files.asCharSource(DrillFileUtils.getResourceAsFile("/decimal/test_decimal_complex.json"), Charsets.UTF_8)
+ .read().replace("#{TEST_FILE}", "/input_complex_decimal.json")
);
RecordBatchLoader batchLoader = new RecordBatchLoader(bit.getContext().getAllocator());
@@ -242,8 +242,8 @@ public class TestDecimal extends PopUnitTestBase {
bit.run();
client.connect();
List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile("/decimal/test_decimal_sort_complex.json"), Charsets.UTF_8)
- .replace("#{TEST_FILE}", "/input_sort_complex_decimal.json")
+ Files.asCharSource(DrillFileUtils.getResourceAsFile("/decimal/test_decimal_sort_complex.json"), Charsets.UTF_8)
+ .read().replace("#{TEST_FILE}", "/input_sort_complex_decimal.json")
);
RecordBatchLoader batchLoader = new RecordBatchLoader(bit.getContext().getAllocator());
@@ -291,8 +291,8 @@ public class TestDecimal extends PopUnitTestBase {
bit.run();
client.connect();
List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile("/decimal/simple_decimal_math.json"), Charsets.UTF_8)
- .replace("#{TEST_FILE}", "/input_simple_decimal.json")
+ Files.asCharSource(DrillFileUtils.getResourceAsFile("/decimal/simple_decimal_math.json"), Charsets.UTF_8)
+ .read().replace("#{TEST_FILE}", "/input_simple_decimal.json")
);
RecordBatchLoader batchLoader = new RecordBatchLoader(bit.getContext().getAllocator());
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestDistributedFragmentRun.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestDistributedFragmentRun.java
index 8030573a2..1aad9f4ca 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestDistributedFragmentRun.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestDistributedFragmentRun.java
@@ -47,7 +47,7 @@ public class TestDistributedFragmentRun extends PopUnitTestBase{
DrillClient client = new DrillClient(CONFIG, serviceSet.getCoordinator())) {
bit1.run();
client.connect();
- List<QueryDataBatch> results = client.runQuery(QueryType.PHYSICAL, Files.toString(DrillFileUtils.getResourceAsFile("/physical_single_exchange.json"), Charsets.UTF_8));
+ List<QueryDataBatch> results = client.runQuery(QueryType.PHYSICAL, Files.asCharSource(DrillFileUtils.getResourceAsFile("/physical_single_exchange.json"), Charsets.UTF_8).read());
int count = 0;
for(QueryDataBatch b : results){
count += b.getHeader().getRowCount();
@@ -68,7 +68,7 @@ public class TestDistributedFragmentRun extends PopUnitTestBase{
DrillClient client = new DrillClient(CONFIG, serviceSet.getCoordinator())) {
bit1.run();
client.connect();
- List<QueryDataBatch> results = client.runQuery(QueryType.PHYSICAL, Files.toString(DrillFileUtils.getResourceAsFile("/physical_single_exchange_double_entry.json"), Charsets.UTF_8));
+ List<QueryDataBatch> results = client.runQuery(QueryType.PHYSICAL, Files.asCharSource(DrillFileUtils.getResourceAsFile("/physical_single_exchange_double_entry.json"), Charsets.UTF_8).read());
int count = 0;
for(QueryDataBatch b : results){
count += b.getHeader().getRowCount();
@@ -88,7 +88,7 @@ public class TestDistributedFragmentRun extends PopUnitTestBase{
DrillClient client = new DrillClient(CONFIG, serviceSet.getCoordinator())) {
bit1.run();
client.connect();
- List<QueryDataBatch> results = client.runQuery(QueryType.LOGICAL, Files.toString(DrillFileUtils.getResourceAsFile("/scan_screen_logical.json"), Charsets.UTF_8));
+ List<QueryDataBatch> results = client.runQuery(QueryType.LOGICAL, Files.asCharSource(DrillFileUtils.getResourceAsFile("/scan_screen_logical.json"), Charsets.UTF_8).read());
int count = 0;
for (QueryDataBatch b : results) {
count += b.getHeader().getRowCount();
@@ -110,7 +110,7 @@ public class TestDistributedFragmentRun extends PopUnitTestBase{
bit1.run();
bit2.run();
client.connect();
- List<QueryDataBatch> results = client.runQuery(QueryType.PHYSICAL, Files.toString(DrillFileUtils.getResourceAsFile("/physical_single_exchange_double_entry.json"), Charsets.UTF_8));
+ List<QueryDataBatch> results = client.runQuery(QueryType.PHYSICAL, Files.asCharSource(DrillFileUtils.getResourceAsFile("/physical_single_exchange_double_entry.json"), Charsets.UTF_8).read());
int count = 0;
for(QueryDataBatch b : results){
count += b.getHeader().getRowCount();
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestExtractFunctions.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestExtractFunctions.java
index 4cc5d5120..9d6bb9fe1 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestExtractFunctions.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestExtractFunctions.java
@@ -112,10 +112,11 @@ public class TestExtractFunctions extends PopUnitTestBase {
bit.run();
client.connect();
List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile("/functions/extractFrom.json"), Charsets.UTF_8)
- .replace("#{TEST_TYPE}", fromType)
- .replace("#{TEST_FILE}", testDataFile)
- .replace("#{COLUMN_NAME}", columnName));
+ Files.asCharSource(DrillFileUtils.getResourceAsFile("/functions/extractFrom.json"), Charsets.UTF_8)
+ .read()
+ .replace("#{TEST_TYPE}", fromType)
+ .replace("#{TEST_FILE}", testDataFile)
+ .replace("#{COLUMN_NAME}", columnName));
RecordBatchLoader batchLoader = new RecordBatchLoader(bit.getContext().getAllocator());
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestHashToRandomExchange.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestHashToRandomExchange.java
index 410cce0b8..9bcf13d84 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestHashToRandomExchange.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestHashToRandomExchange.java
@@ -50,8 +50,8 @@ public class TestHashToRandomExchange extends PopUnitTestBase {
bit2.run();
client.connect();
List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile("/sender/hash_exchange.json"),
- Charsets.UTF_8));
+ Files.asCharSource(DrillFileUtils.getResourceAsFile("/sender/hash_exchange.json"),
+ Charsets.UTF_8).read());
int count = 0;
for (QueryDataBatch b : results) {
if (b.getHeader().getRowCount() != 0) {
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestReverseImplicitCast.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestReverseImplicitCast.java
index 8f8f316b4..19048ce6b 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestReverseImplicitCast.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestReverseImplicitCast.java
@@ -51,7 +51,7 @@ public class TestReverseImplicitCast extends PopUnitTestBase {
bit.run();
client.connect();
List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile("/functions/cast/two_way_implicit_cast.json"), Charsets.UTF_8));
+ Files.asCharSource(DrillFileUtils.getResourceAsFile("/functions/cast/two_way_implicit_cast.json"), Charsets.UTF_8).read());
RecordBatchLoader batchLoader = new RecordBatchLoader(bit.getContext().getAllocator());
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestSimpleFragmentRun.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestSimpleFragmentRun.java
index de36e609b..64b9843ec 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestSimpleFragmentRun.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestSimpleFragmentRun.java
@@ -52,7 +52,7 @@ public class TestSimpleFragmentRun extends PopUnitTestBase {
bit.run();
client.connect();
final String path = "/physical_test2.json";
- final List<QueryDataBatch> results = client.runQuery(QueryType.PHYSICAL, Files.toString(DrillFileUtils.getResourceAsFile(path), Charsets.UTF_8));
+ final List<QueryDataBatch> results = client.runQuery(QueryType.PHYSICAL, Files.asCharSource(DrillFileUtils.getResourceAsFile(path), Charsets.UTF_8).read());
// look at records
final RecordBatchLoader batchLoader = new RecordBatchLoader(client.getAllocator());
@@ -116,7 +116,7 @@ public class TestSimpleFragmentRun extends PopUnitTestBase {
bit.run();
client.connect();
final List<QueryDataBatch> results = client.runQuery(QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile("/physical_json_scan_test1.json"), Charsets.UTF_8)
+ Files.asCharSource(DrillFileUtils.getResourceAsFile("/physical_json_scan_test1.json"), Charsets.UTF_8).read()
.replace("#{TEST_FILE}", DrillFileUtils.getResourceAsFile("/scan_json_test_1.json").toURI().toString())
);
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestSimpleFunctions.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestSimpleFunctions.java
index 06583d168..8cf633be7 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestSimpleFunctions.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestSimpleFunctions.java
@@ -122,7 +122,7 @@ public class TestSimpleFunctions extends ExecTest {
final UserClientConnection connection = Mockito.mock(UserClientConnection.class);
final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(c);
- final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(DrillFileUtils.getResourceAsFile("/functions/testSubstring.json"), Charsets.UTF_8));
+ final PhysicalPlan plan = reader.readPhysicalPlan(Files.asCharSource(DrillFileUtils.getResourceAsFile("/functions/testSubstring.json"), Charsets.UTF_8).read());
final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(c);
final FragmentContextImpl context = new FragmentContextImpl(bitContext, PlanFragment.getDefaultInstance(), connection, registry);
final SimpleRootExec exec = new SimpleRootExec(ImplCreator.getExec(context, (FragmentRoot) plan.getSortedOperators(false).iterator().next()));
@@ -155,7 +155,7 @@ public class TestSimpleFunctions extends ExecTest {
final UserClientConnection connection = Mockito.mock(UserClientConnection.class);
final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(c);
- final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(DrillFileUtils.getResourceAsFile("/functions/testSubstringNegative.json"), Charsets.UTF_8));
+ final PhysicalPlan plan = reader.readPhysicalPlan(Files.asCharSource(DrillFileUtils.getResourceAsFile("/functions/testSubstringNegative.json"), Charsets.UTF_8).read());
final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(c);
final FragmentContextImpl context = new FragmentContextImpl(bitContext, PlanFragment.getDefaultInstance(), connection, registry);
final SimpleRootExec exec = new SimpleRootExec(ImplCreator.getExec(context, (FragmentRoot) plan.getSortedOperators(false).iterator().next()));
@@ -189,7 +189,7 @@ public class TestSimpleFunctions extends ExecTest {
final UserClientConnection connection = Mockito.mock(UserClientConnection.class);
final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(c);
- final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(DrillFileUtils.getResourceAsFile("/functions/testByteSubstring.json"), Charsets.UTF_8));
+ final PhysicalPlan plan = reader.readPhysicalPlan(Files.asCharSource(DrillFileUtils.getResourceAsFile("/functions/testByteSubstring.json"), Charsets.UTF_8).read());
final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(c);
final FragmentContextImpl context = new FragmentContextImpl(bitContext, PlanFragment.getDefaultInstance(), connection, registry);
final SimpleRootExec exec = new SimpleRootExec(ImplCreator.getExec(context, (FragmentRoot) plan.getSortedOperators(false).iterator().next()));
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestUnionExchange.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestUnionExchange.java
index 7c796019a..e34598cd0 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestUnionExchange.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestUnionExchange.java
@@ -44,14 +44,14 @@ public class TestUnionExchange extends PopUnitTestBase {
try (Drillbit bit1 = new Drillbit(CONFIG, serviceSet);
Drillbit bit2 = new Drillbit(CONFIG, serviceSet);
- DrillClient client = new DrillClient(CONFIG, serviceSet.getCoordinator());) {
+ DrillClient client = new DrillClient(CONFIG, serviceSet.getCoordinator())) {
bit1.run();
bit2.run();
client.connect();
List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile("/sender/union_exchange.json"),
- Charsets.UTF_8));
+ Files.asCharSource(DrillFileUtils.getResourceAsFile("/sender/union_exchange.json"),
+ Charsets.UTF_8).read());
int count = 0;
for (QueryDataBatch b : results) {
if (b.getHeader().getRowCount() != 0) {
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/agg/TestAgg.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/agg/TestAgg.java
index df9853c51..5b6343aba 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/agg/TestAgg.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/agg/TestAgg.java
@@ -56,7 +56,7 @@ public class TestAgg extends ExecTest {
final UserClientConnection connection = Mockito.mock(UserClientConnection.class);
final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(c);
- final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(DrillFileUtils.getResourceAsFile(file), Charsets.UTF_8));
+ final PhysicalPlan plan = reader.readPhysicalPlan(Files.asCharSource(DrillFileUtils.getResourceAsFile(file), Charsets.UTF_8).read());
final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(c);
final FragmentContextImpl context = new FragmentContextImpl(bitContext, PlanFragment.getDefaultInstance(), connection, registry);
final SimpleRootExec exec = new SimpleRootExec(ImplCreator.getExec(context, (FragmentRoot) plan.getSortedOperators(false).iterator().next()));
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/filter/TestSimpleFilter.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/filter/TestSimpleFilter.java
index 2d57e8b09..726463048 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/filter/TestSimpleFilter.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/filter/TestSimpleFilter.java
@@ -54,7 +54,7 @@ public class TestSimpleFilter extends ExecTest {
final UserClientConnection connection = Mockito.mock(UserClientConnection.class);
final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(c);
- final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(DrillFileUtils.getResourceAsFile("/filter/test1.json"), Charsets.UTF_8));
+ final PhysicalPlan plan = reader.readPhysicalPlan(Files.asCharSource(DrillFileUtils.getResourceAsFile("/filter/test1.json"), Charsets.UTF_8).read());
final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(c);
final FragmentContextImpl context = new FragmentContextImpl(bitContext, PlanFragment.getDefaultInstance(), connection, registry);
final SimpleRootExec exec = new SimpleRootExec(ImplCreator.getExec(context, (FragmentRoot) plan.getSortedOperators(false).iterator().next()));
@@ -77,7 +77,7 @@ public class TestSimpleFilter extends ExecTest {
final UserClientConnection connection = Mockito.mock(UserClientConnection.class);
final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(c);
- final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(DrillFileUtils.getResourceAsFile("/filter/test_sv4.json"), Charsets.UTF_8));
+ final PhysicalPlan plan = reader.readPhysicalPlan(Files.asCharSource(DrillFileUtils.getResourceAsFile("/filter/test_sv4.json"), Charsets.UTF_8).read());
final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(c);
final FragmentContextImpl context = new FragmentContextImpl(bitContext, PlanFragment.getDefaultInstance(), connection, registry);
final SimpleRootExec exec = new SimpleRootExec(ImplCreator.getExec(context, (FragmentRoot) plan.getSortedOperators(false).iterator().next()));
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestHashJoin.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestHashJoin.java
index c569ef71f..1f5629864 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestHashJoin.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestHashJoin.java
@@ -70,7 +70,7 @@ public class TestHashJoin extends PopUnitTestBase {
final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(c);
- final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(DrillFileUtils.getResourceAsFile(physicalPlan), Charsets.UTF_8));
+ final PhysicalPlan plan = reader.readPhysicalPlan(Files.asCharSource(DrillFileUtils.getResourceAsFile(physicalPlan), Charsets.UTF_8).read());
final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(c);
final FragmentContextImpl context = new FragmentContextImpl(bitContext, PlanFragment.getDefaultInstance(), connection, registry);
final SimpleRootExec exec = new SimpleRootExec(ImplCreator.getExec(context, (FragmentRoot) plan.getSortedOperators(false).iterator().next()));
@@ -116,7 +116,7 @@ public class TestHashJoin extends PopUnitTestBase {
bit.run();
client.connect();
List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile("/join/hash_join.json"), Charsets.UTF_8)
+ Files.asCharSource(DrillFileUtils.getResourceAsFile("/join/hash_join.json"), Charsets.UTF_8).read()
.replace("#{TEST_FILE_1}", DrillFileUtils.getResourceAsFile("/build_side_input.json").toURI().toString())
.replace("#{TEST_FILE_2}", DrillFileUtils.getResourceAsFile("/probe_side_input.json").toURI().toString()));
@@ -157,7 +157,7 @@ public class TestHashJoin extends PopUnitTestBase {
bit.run();
client.connect();
final List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile("/join/hj_exchanges.json"), Charsets.UTF_8));
+ Files.asCharSource(DrillFileUtils.getResourceAsFile("/join/hj_exchanges.json"), Charsets.UTF_8).read());
int count = 0;
for (final QueryDataBatch b : results) {
@@ -182,7 +182,7 @@ public class TestHashJoin extends PopUnitTestBase {
bit.run();
client.connect();
final List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile("/join/hj_multi_condition_join.json"), Charsets.UTF_8)
+ Files.asCharSource(DrillFileUtils.getResourceAsFile("/join/hj_multi_condition_join.json"), Charsets.UTF_8).read()
.replace("#{TEST_FILE_1}", DrillFileUtils.getResourceAsFile("/build_side_input.json").toURI().toString())
.replace("#{TEST_FILE_2}", DrillFileUtils.getResourceAsFile("/probe_side_input.json").toURI().toString()));
@@ -226,7 +226,7 @@ public class TestHashJoin extends PopUnitTestBase {
bit.run();
client.connect();
final List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile("/join/hj_exchanges1.json"), Charsets.UTF_8));
+ Files.asCharSource(DrillFileUtils.getResourceAsFile("/join/hj_exchanges1.json"), Charsets.UTF_8).read());
int count = 0;
for (final QueryDataBatch b : results) {
@@ -245,12 +245,12 @@ public class TestHashJoin extends PopUnitTestBase {
final RemoteServiceSet serviceSet = RemoteServiceSet.getLocalServiceSet();
try (final Drillbit bit1 = new Drillbit(CONFIG, serviceSet);
- final DrillClient client = new DrillClient(CONFIG, serviceSet.getCoordinator());) {
+ final DrillClient client = new DrillClient(CONFIG, serviceSet.getCoordinator())) {
bit1.run();
client.connect();
final List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile("/join/hashJoinExpr.json"), Charsets.UTF_8));
+ Files.asCharSource(DrillFileUtils.getResourceAsFile("/join/hashJoinExpr.json"), Charsets.UTF_8).read());
int count = 0;
for (final QueryDataBatch b : results) {
if (b.getHeader().getRowCount() != 0) {
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestMergeJoin.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestMergeJoin.java
index 756bd7f5e..ba64176e5 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestMergeJoin.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestMergeJoin.java
@@ -68,7 +68,7 @@ public class TestMergeJoin extends PopUnitTestBase {
final UserClientConnection connection = Mockito.mock(UserClientConnection.class);
final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(c);
- final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(DrillFileUtils.getResourceAsFile("/join/merge_join.json"), Charsets.UTF_8));
+ final PhysicalPlan plan = reader.readPhysicalPlan(Files.asCharSource(DrillFileUtils.getResourceAsFile("/join/merge_join.json"), Charsets.UTF_8).read());
final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(c);
final FragmentContextImpl context = new FragmentContextImpl(bitContext, PlanFragment.getDefaultInstance(), connection, registry);
final SimpleRootExec exec = new SimpleRootExec(ImplCreator.getExec(context, (FragmentRoot) plan.getSortedOperators(false).iterator().next()));
@@ -119,8 +119,8 @@ public class TestMergeJoin extends PopUnitTestBase {
final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(c,
new StoragePluginRegistryImpl(bitContext));
final PhysicalPlan plan = reader.readPhysicalPlan(
- Files.toString(
- DrillFileUtils.getResourceAsFile("/join/merge_single_batch.json"), Charsets.UTF_8)
+ Files.asCharSource(
+ DrillFileUtils.getResourceAsFile("/join/merge_single_batch.json"), Charsets.UTF_8).read()
.replace("#{LEFT_FILE}", DrillFileUtils.getResourceAsFile("/join/merge_single_batch.left.json").toURI().toString())
.replace("#{RIGHT_FILE}", DrillFileUtils.getResourceAsFile("/join/merge_single_batch.right.json").toURI().toString()));
final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(c);
@@ -173,8 +173,8 @@ public class TestMergeJoin extends PopUnitTestBase {
final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(c,
new StoragePluginRegistryImpl(bitContext));
final PhysicalPlan plan = reader.readPhysicalPlan(
- Files.toString(
- DrillFileUtils.getResourceAsFile("/join/merge_inner_single_batch.json"), Charsets.UTF_8)
+ Files.asCharSource(
+ DrillFileUtils.getResourceAsFile("/join/merge_inner_single_batch.json"), Charsets.UTF_8).read()
.replace("#{LEFT_FILE}", DrillFileUtils.getResourceAsFile("/join/merge_single_batch.left.json").toURI().toString())
.replace("#{RIGHT_FILE}", DrillFileUtils.getResourceAsFile("/join/merge_single_batch.right.json").toURI().toString()));
final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(c);
@@ -225,8 +225,8 @@ public class TestMergeJoin extends PopUnitTestBase {
final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(c,
new StoragePluginRegistryImpl(bitContext));
final PhysicalPlan plan = reader.readPhysicalPlan(
- Files.toString(
- DrillFileUtils.getResourceAsFile("/join/merge_multi_batch.json"), Charsets.UTF_8)
+ Files.asCharSource(
+ DrillFileUtils.getResourceAsFile("/join/merge_multi_batch.json"), Charsets.UTF_8).read()
.replace("#{LEFT_FILE}", DrillFileUtils.getResourceAsFile("/join/merge_multi_batch.left.json").toURI().toString())
.replace("#{RIGHT_FILE}", DrillFileUtils.getResourceAsFile("/join/merge_multi_batch.right.json").toURI().toString()));
final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(c);
@@ -273,7 +273,7 @@ public class TestMergeJoin extends PopUnitTestBase {
final UserClientConnection connection = Mockito.mock(UserClientConnection.class);
final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(c);
- final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(DrillFileUtils.getResourceAsFile("/join/join_batchsize.json"), Charsets.UTF_8));
+ final PhysicalPlan plan = reader.readPhysicalPlan(Files.asCharSource(DrillFileUtils.getResourceAsFile("/join/join_batchsize.json"), Charsets.UTF_8).read());
final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(c);
final FragmentContextImpl context = new FragmentContextImpl(bitContext, PlanFragment.getDefaultInstance(), connection, registry);
final SimpleRootExec exec = new SimpleRootExec(ImplCreator.getExec(context, (FragmentRoot) plan.getSortedOperators(false).iterator().next()));
@@ -298,8 +298,8 @@ public class TestMergeJoin extends PopUnitTestBase {
bit1.run();
client.connect();
final List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile("/join/merge_join_empty_batch.json"),
- Charsets.UTF_8)
+ Files.asCharSource(DrillFileUtils.getResourceAsFile("/join/merge_join_empty_batch.json"),
+ Charsets.UTF_8).read()
.replace("${JOIN_TYPE}", "INNER"));
int count = 0;
for (final QueryDataBatch b : results) {
@@ -322,8 +322,8 @@ public class TestMergeJoin extends PopUnitTestBase {
bit1.run();
client.connect();
final List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile("/join/merge_join_empty_batch.json"),
- Charsets.UTF_8)
+ Files.asCharSource(DrillFileUtils.getResourceAsFile("/join/merge_join_empty_batch.json"),
+ Charsets.UTF_8).read()
.replace("${JOIN_TYPE}", "LEFT"));
int count = 0;
for (final QueryDataBatch b : results) {
@@ -346,8 +346,8 @@ public class TestMergeJoin extends PopUnitTestBase {
bit1.run();
client.connect();
final List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile("/join/merge_join_empty_batch.json"),
- Charsets.UTF_8)
+ Files.asCharSource(DrillFileUtils.getResourceAsFile("/join/merge_join_empty_batch.json"),
+ Charsets.UTF_8).read()
.replace("${JOIN_TYPE}", "RIGHT"));
int count = 0;
for (final QueryDataBatch b : results) {
@@ -370,7 +370,7 @@ public class TestMergeJoin extends PopUnitTestBase {
bit1.run();
client.connect();
final List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile("/join/mergeJoinExpr.json"), Charsets.UTF_8));
+ Files.asCharSource(DrillFileUtils.getResourceAsFile("/join/mergeJoinExpr.json"), Charsets.UTF_8).read());
int count = 0;
for (final QueryDataBatch b : results) {
if (b.getHeader().getRowCount() != 0) {
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestMergeJoinMulCondition.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestMergeJoinMulCondition.java
index f24c986b1..6c25c13ff 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestMergeJoinMulCondition.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestMergeJoinMulCondition.java
@@ -55,13 +55,13 @@ public class TestMergeJoinMulCondition extends PopUnitTestBase {
RemoteServiceSet serviceSet = RemoteServiceSet.getLocalServiceSet();
try (Drillbit bit1 = new Drillbit(CONFIG, serviceSet);
- DrillClient client = new DrillClient(CONFIG, serviceSet.getCoordinator());) {
+ DrillClient client = new DrillClient(CONFIG, serviceSet.getCoordinator())) {
bit1.run();
client.connect();
List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile("/join/mj_multi_condition.json"),
- Charsets.UTF_8));
+ Files.asCharSource(DrillFileUtils.getResourceAsFile("/join/mj_multi_condition.json"),
+ Charsets.UTF_8).read());
int count = 0;
for (QueryDataBatch b : results) {
if (b.getHeader().getRowCount() != 0) {
@@ -81,11 +81,11 @@ public class TestMergeJoinMulCondition extends PopUnitTestBase {
RemoteServiceSet serviceSet = RemoteServiceSet.getLocalServiceSet();
try (Drillbit bit1 = new Drillbit(CONFIG, serviceSet);
- DrillClient client = new DrillClient(CONFIG, serviceSet.getCoordinator());) {
+ DrillClient client = new DrillClient(CONFIG, serviceSet.getCoordinator())) {
bit1.run();
client.connect();
List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile("/join/merge_join_nullkey.json"), Charsets.UTF_8).replace("${JOIN_TYPE}", "INNER"));
+ Files.asCharSource(DrillFileUtils.getResourceAsFile("/join/merge_join_nullkey.json"), Charsets.UTF_8).read().replace("${JOIN_TYPE}", "INNER"));
int count = 0;
for (QueryDataBatch b : results) {
if (b.getHeader().getRowCount() != 0) {
@@ -105,12 +105,12 @@ public class TestMergeJoinMulCondition extends PopUnitTestBase {
RemoteServiceSet serviceSet = RemoteServiceSet.getLocalServiceSet();
try (Drillbit bit1 = new Drillbit(CONFIG, serviceSet);
- DrillClient client = new DrillClient(CONFIG, serviceSet.getCoordinator());) {
+ DrillClient client = new DrillClient(CONFIG, serviceSet.getCoordinator())) {
bit1.run();
client.connect();
List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile("/join/merge_join_nullkey.json"), Charsets.UTF_8).replace("${JOIN_TYPE}", "LEFT"));
+ Files.asCharSource(DrillFileUtils.getResourceAsFile("/join/merge_join_nullkey.json"), Charsets.UTF_8).read().replace("${JOIN_TYPE}", "LEFT"));
int count = 0;
for (QueryDataBatch b : results) {
if (b.getHeader().getRowCount() != 0) {
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/limit/TestSimpleLimit.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/limit/TestSimpleLimit.java
index f43d1141c..7900eb63a 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/limit/TestSimpleLimit.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/limit/TestSimpleLimit.java
@@ -85,7 +85,7 @@ public class TestSimpleLimit extends ExecTest {
private void verifyLimitCount(DrillbitContext bitContext, UserClientConnection connection, String testPlan, int expectedCount) throws Throwable {
final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(c);
- final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(DrillFileUtils.getResourceAsFile("/limit/" + testPlan), Charsets.UTF_8));
+ final PhysicalPlan plan = reader.readPhysicalPlan(Files.asCharSource(DrillFileUtils.getResourceAsFile("/limit/" + testPlan), Charsets.UTF_8).read());
final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(c);
final FragmentContextImpl context = new FragmentContextImpl(bitContext, PlanFragment.getDefaultInstance(), connection, registry);
final SimpleRootExec exec = new SimpleRootExec(ImplCreator.getExec(context, (FragmentRoot) plan.getSortedOperators(false).iterator().next()));
@@ -105,7 +105,7 @@ public class TestSimpleLimit extends ExecTest {
private void verifySum(DrillbitContext bitContext, UserClientConnection connection, String testPlan, int expectedCount, long expectedSum) throws Throwable {
final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(c);
- final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(DrillFileUtils.getResourceAsFile("/limit/" + testPlan), Charsets.UTF_8));
+ final PhysicalPlan plan = reader.readPhysicalPlan(Files.asCharSource(DrillFileUtils.getResourceAsFile("/limit/" + testPlan), Charsets.UTF_8).read());
final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(c);
final FragmentContextImpl context = new FragmentContextImpl(bitContext, PlanFragment.getDefaultInstance(), connection, registry);
final SimpleRootExec exec = new SimpleRootExec(ImplCreator.getExec(context, (FragmentRoot) plan.getSortedOperators(false).iterator().next()));
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/mergereceiver/TestMergingReceiver.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/mergereceiver/TestMergingReceiver.java
index f40a49c5d..a0d20c11e 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/mergereceiver/TestMergingReceiver.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/mergereceiver/TestMergingReceiver.java
@@ -56,8 +56,8 @@ public class TestMergingReceiver extends PopUnitTestBase {
bit2.run();
client.connect();
final List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile("/mergerecv/merging_receiver.json"),
- Charsets.UTF_8));
+ Files.asCharSource(DrillFileUtils.getResourceAsFile("/mergerecv/merging_receiver.json"),
+ Charsets.UTF_8).read());
int count = 0;
final RecordBatchLoader batchLoader = new RecordBatchLoader(client.getAllocator());
// print the results
@@ -87,8 +87,8 @@ public class TestMergingReceiver extends PopUnitTestBase {
client.connect();
final List<QueryDataBatch> results =
client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile("/mergerecv/multiple_providers.json"),
- Charsets.UTF_8));
+ Files.asCharSource(DrillFileUtils.getResourceAsFile("/mergerecv/multiple_providers.json"),
+ Charsets.UTF_8).read());
int count = 0;
final RecordBatchLoader batchLoader = new RecordBatchLoader(client.getAllocator());
// print the results
@@ -136,8 +136,8 @@ public class TestMergingReceiver extends PopUnitTestBase {
client.connect();
final List<QueryDataBatch> results =
client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile("/mergerecv/empty_batch.json"),
- Charsets.UTF_8));
+ Files.asCharSource(DrillFileUtils.getResourceAsFile("/mergerecv/empty_batch.json"),
+ Charsets.UTF_8).read());
int count = 0;
final RecordBatchLoader batchLoader = new RecordBatchLoader(client.getAllocator());
// print the results
@@ -166,8 +166,8 @@ public class TestMergingReceiver extends PopUnitTestBase {
client.connect();
final List<QueryDataBatch> results =
client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile("/mergerecv/empty_batch_noschema.json"),
- Charsets.UTF_8));
+ Files.asCharSource(DrillFileUtils.getResourceAsFile("/mergerecv/empty_batch_noschema.json"),
+ Charsets.UTF_8).read());
int count = 0;
final RecordBatchLoader batchLoader = new RecordBatchLoader(client.getAllocator());
// print the results
@@ -196,8 +196,8 @@ public class TestMergingReceiver extends PopUnitTestBase {
client.connect();
final List<QueryDataBatch> results =
client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile("/mergerecv/multiple_providers_empty_batches.json"),
- Charsets.UTF_8));
+ Files.asCharSource(DrillFileUtils.getResourceAsFile("/mergerecv/multiple_providers_empty_batches.json"),
+ Charsets.UTF_8).read());
int count = 0;
final RecordBatchLoader batchLoader = new RecordBatchLoader(client.getAllocator());
// print the results
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/orderedpartitioner/TestOrderedPartitionExchange.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/orderedpartitioner/TestOrderedPartitionExchange.java
index 806e9c71e..2a0b8fe4b 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/orderedpartitioner/TestOrderedPartitionExchange.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/orderedpartitioner/TestOrderedPartitionExchange.java
@@ -77,8 +77,8 @@ public class TestOrderedPartitionExchange extends PopUnitTestBase {
bit2.run();
client.connect();
List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile("/sender/ordered_exchange.json"),
- Charsets.UTF_8));
+ Files.asCharSource(DrillFileUtils.getResourceAsFile("/sender/ordered_exchange.json"),
+ Charsets.UTF_8).read());
int count = 0;
List<Integer> partitionRecordCounts = Lists.newArrayList();
for(QueryDataBatch b : results) {
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/project/TestSimpleProjection.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/project/TestSimpleProjection.java
index d71ac760f..f5d0b5e2e 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/project/TestSimpleProjection.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/project/TestSimpleProjection.java
@@ -57,7 +57,7 @@ public class TestSimpleProjection extends ExecTest {
final UserClientConnection connection = Mockito.mock(UserClientConnection.class);
final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(c);
- final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(DrillFileUtils.getResourceAsFile("/project/test1.json"), Charsets.UTF_8));
+ final PhysicalPlan plan = reader.readPhysicalPlan(Files.asCharSource(DrillFileUtils.getResourceAsFile("/project/test1.json"), Charsets.UTF_8).read());
final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(c);
final FragmentContextImpl context = new FragmentContextImpl(bitContext, PlanFragment.getDefaultInstance(), connection, registry);
final SimpleRootExec exec = new SimpleRootExec(ImplCreator.getExec(context, (FragmentRoot) plan.getSortedOperators(false).iterator().next()));
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/sort/TestSimpleSort.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/sort/TestSimpleSort.java
index 5ce9a73c1..0e99f8c38 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/sort/TestSimpleSort.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/sort/TestSimpleSort.java
@@ -59,7 +59,7 @@ public class TestSimpleSort extends ExecTest {
final UserClientConnection connection = Mockito.mock(UserClientConnection.class);
final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(c);
- final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(DrillFileUtils.getResourceAsFile("/sort/one_key_sort.json"), Charsets.UTF_8));
+ final PhysicalPlan plan = reader.readPhysicalPlan(Files.asCharSource(DrillFileUtils.getResourceAsFile("/sort/one_key_sort.json"), Charsets.UTF_8).read());
final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(c);
final FragmentContextImpl context = new FragmentContextImpl(bitContext, PlanFragment.getDefaultInstance(), connection, registry);
final SimpleRootExec exec = new SimpleRootExec(ImplCreator.getExec(context, (FragmentRoot) plan.getSortedOperators(false).iterator().next()));
@@ -96,7 +96,7 @@ public class TestSimpleSort extends ExecTest {
final UserClientConnection connection = Mockito.mock(UserClientConnection.class);
final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(c);
- final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(DrillFileUtils.getResourceAsFile("/sort/two_key_sort.json"), Charsets.UTF_8));
+ final PhysicalPlan plan = reader.readPhysicalPlan(Files.asCharSource(DrillFileUtils.getResourceAsFile("/sort/two_key_sort.json"), Charsets.UTF_8).read());
final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(c);
final FragmentContextImpl context = new FragmentContextImpl(bitContext, PlanFragment.getDefaultInstance(), connection, registry);
final SimpleRootExec exec = new SimpleRootExec(ImplCreator.getExec(context, (FragmentRoot) plan.getSortedOperators(false).iterator().next()));
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/trace/TestTraceMultiRecordBatch.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/trace/TestTraceMultiRecordBatch.java
index 98fb25af3..c21513e02 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/trace/TestTraceMultiRecordBatch.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/trace/TestTraceMultiRecordBatch.java
@@ -61,7 +61,7 @@ public class TestTraceMultiRecordBatch extends ExecTest {
final UserClientConnection connection = Mockito.mock(UserClientConnection.class);
final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(c);
- final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(DrillFileUtils.getResourceAsFile("/trace/multi_record_batch_trace.json"), Charsets.UTF_8));
+ final PhysicalPlan plan = reader.readPhysicalPlan(Files.asCharSource(DrillFileUtils.getResourceAsFile("/trace/multi_record_batch_trace.json"), Charsets.UTF_8).read());
final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(c);
final FragmentContextImpl context = new FragmentContextImpl(bitContext, PlanFragment.getDefaultInstance(), connection, registry);
final SimpleRootExec exec = new SimpleRootExec(ImplCreator.getExec(context, (FragmentRoot) plan.getSortedOperators(false).iterator().next()));
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/trace/TestTraceOutputDump.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/trace/TestTraceOutputDump.java
index 3fd221f88..a266b0273 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/trace/TestTraceOutputDump.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/trace/TestTraceOutputDump.java
@@ -17,6 +17,8 @@
*/
package org.apache.drill.exec.physical.impl.trace;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import org.apache.drill.categories.OperatorTest;
@@ -75,7 +77,7 @@ public class TestTraceOutputDump extends ExecTest {
final UserClientConnection connection = Mockito.mock(UserClientConnection.class);
final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(c);
- final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(DrillFileUtils.getResourceAsFile("/trace/simple_trace.json"), Charsets.UTF_8));
+ final PhysicalPlan plan = reader.readPhysicalPlan(Files.asCharSource(DrillFileUtils.getResourceAsFile("/trace/simple_trace.json"), Charsets.UTF_8).read());
final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(c);
final FragmentContextImpl context = new FragmentContextImpl(bitContext, PlanFragment.getDefaultInstance(), connection, registry);
final SimpleRootExec exec = new SimpleRootExec(ImplCreator.getExec(context, (FragmentRoot) plan.getSortedOperators(false).iterator().next()));
@@ -113,13 +115,13 @@ public class TestTraceOutputDump extends ExecTest {
final VectorAccessible container = wrap.get();
/* Assert there are no selection vectors */
- assertTrue(wrap.getSv2() == null);
+ assertNull(wrap.getSv2());
/* Assert there is only one record */
- assertTrue(container.getRecordCount() == 1);
+ assertEquals(1, container.getRecordCount());
/* Read the Integer value and ASSERT its Integer.MIN_VALUE */
final int value = (int) container.iterator().next().getValueVector().getAccessor().getObject(0);
- assertTrue(value == Integer.MIN_VALUE);
+ assertEquals(value, Integer.MIN_VALUE);
}
}
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/union/TestSimpleUnion.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/union/TestSimpleUnion.java
index 8cfd468d9..e0f060bc2 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/union/TestSimpleUnion.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/union/TestSimpleUnion.java
@@ -54,7 +54,7 @@ public class TestSimpleUnion extends ExecTest {
final UserClientConnection connection = Mockito.mock(UserClientConnection.class);
final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(c);
- final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(DrillFileUtils.getResourceAsFile("/union/test1.json"), Charsets.UTF_8));
+ final PhysicalPlan plan = reader.readPhysicalPlan(Files.asCharSource(DrillFileUtils.getResourceAsFile("/union/test1.json"), Charsets.UTF_8).read());
final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(c);
final FragmentContextImpl context = new FragmentContextImpl(bitContext, PlanFragment.getDefaultInstance(), connection, registry);
final SimpleRootExec exec = new SimpleRootExec(ImplCreator.getExec(context, (FragmentRoot) plan.getSortedOperators(false).iterator().next()));
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/writer/TestWriter.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/writer/TestWriter.java
index 4dc2b960d..a1f0fbed3 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/writer/TestWriter.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/writer/TestWriter.java
@@ -48,7 +48,7 @@ public class TestWriter extends BaseTestQuery {
public void simpleCsv() throws Exception {
File testDir = dirTestWatcher.makeRootSubDir(Paths.get("csvtest"));
- String plan = Files.toString(DrillFileUtils.getResourceAsFile("/writer/simple_csv_writer.json"), Charsets.UTF_8);
+ String plan = Files.asCharSource(DrillFileUtils.getResourceAsFile("/writer/simple_csv_writer.json"), Charsets.UTF_8).read();
plan = plan
.replace(ROOT_DIR_REPLACEMENT, dirTestWatcher.getRootDir().getAbsolutePath())
.replace(TMP_DIR_REPLACEMENT, dirTestWatcher.getTmpDir().getAbsolutePath())
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/planner/logical/DrillOptiqTest.java b/exec/java-exec/src/test/java/org/apache/drill/exec/planner/logical/DrillOptiqTest.java
index 57b746691..9ace637c0 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/planner/logical/DrillOptiqTest.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/planner/logical/DrillOptiqTest.java
@@ -17,6 +17,7 @@
*/
package org.apache.drill.exec.planner.logical;
+import org.apache.drill.common.util.GuavaUtils;
import com.google.common.collect.ImmutableList;
import org.apache.calcite.rel.RelNode;
import org.apache.calcite.rel.type.RelDataType;
@@ -55,8 +56,8 @@ public class DrillOptiqTest {
ImmutableList<RexFieldCollation> e = ImmutableList.copyOf(new RexFieldCollation[0]);
// create a dummy RexOver object.
- RexNode window = rex.makeOver(anyType, SqlStdOperatorTable.AVG, emptyList, emptyList, e, null, null, true,
- false, false, false);
+ RexNode window = rex.makeOver(anyType, SqlStdOperatorTable.AVG, emptyList, emptyList, GuavaUtils.convertToUnshadedImmutableList(e),
+ null, null, true, false, false, false);
DrillOptiq.toDrill(null, (RelNode) null, window);
} catch (UserException e) {
if (e.getMessage().contains(DrillOptiq.UNSUPPORTED_REX_NODE_ERROR)) {
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/pop/PopUnitTestBase.java b/exec/java-exec/src/test/java/org/apache/drill/exec/pop/PopUnitTestBase.java
index aabf9c4ed..33c840cee 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/pop/PopUnitTestBase.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/pop/PopUnitTestBase.java
@@ -68,7 +68,7 @@ public abstract class PopUnitTestBase extends ExecTest{
public static Fragment getRootFragment(PhysicalPlanReader reader, String file) throws FragmentSetupException,
IOException, ForemanSetupException {
- return getRootFragmentFromPlanString(reader, Files.toString(DrillFileUtils.getResourceAsFile(file), Charsets.UTF_8));
+ return getRootFragmentFromPlanString(reader, Files.asCharSource(DrillFileUtils.getResourceAsFile(file), Charsets.UTF_8).read());
}
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/pop/TestInjectionValue.java b/exec/java-exec/src/test/java/org/apache/drill/exec/pop/TestInjectionValue.java
index 64f70df72..0773bc61f 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/pop/TestInjectionValue.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/pop/TestInjectionValue.java
@@ -52,7 +52,7 @@ public class TestInjectionValue extends ExecTest {
@Test
public void testInjected() throws Exception{
PhysicalPlanReader r = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(config);
- PhysicalPlan p = r.readPhysicalPlan(Files.toString(DrillFileUtils.getResourceAsFile("/physical_screen.json"), Charsets.UTF_8));
+ PhysicalPlan p = r.readPhysicalPlan(Files.asCharSource(DrillFileUtils.getResourceAsFile("/physical_screen.json"), Charsets.UTF_8).read());
List<PhysicalOperator> o = p.getSortedOperators(false);
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/record/TestRecordIterator.java b/exec/java-exec/src/test/java/org/apache/drill/exec/record/TestRecordIterator.java
index 26e1d53f3..5106307fa 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/record/TestRecordIterator.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/record/TestRecordIterator.java
@@ -20,6 +20,7 @@ package org.apache.drill.exec.record;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import com.google.common.collect.Lists;
@@ -65,7 +66,7 @@ public class TestRecordIterator extends PopUnitTestBase {
final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(c);
- final String planStr = Files.toString(DrillFileUtils.getResourceAsFile("/record/test_recorditerator.json"), Charsets.UTF_8);
+ final String planStr = Files.asCharSource(DrillFileUtils.getResourceAsFile("/record/test_recorditerator.json"), Charsets.UTF_8).read();
final PhysicalPlan plan = reader.readPhysicalPlan(planStr);
final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(c);
@@ -107,11 +108,11 @@ public class TestRecordIterator extends PopUnitTestBase {
assertEquals(11112, totalRecords);
try {
iter.mark();
- assertTrue(false);
+ fail();
} catch (UnsupportedOperationException e) {}
try {
iter.reset();
- assertTrue(false);
+ fail();
} catch (UnsupportedOperationException e) {}
}
@@ -121,7 +122,7 @@ public class TestRecordIterator extends PopUnitTestBase {
final UserClientConnection connection = Mockito.mock(UserClientConnection.class);
final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(c);
- final String planStr = Files.toString(DrillFileUtils.getResourceAsFile("/record/test_recorditerator.json"), Charsets.UTF_8);
+ final String planStr = Files.asCharSource(DrillFileUtils.getResourceAsFile("/record/test_recorditerator.json"), Charsets.UTF_8).read();
final PhysicalPlan plan = reader.readPhysicalPlan(planStr);
final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(c);
@@ -135,7 +136,7 @@ public class TestRecordIterator extends PopUnitTestBase {
OperatorUtilities.getChildCount(dummyPop));
OperatorStats stats = exec.getContext().getStats().newOperatorStats(def, exec.getContext().getAllocator());
RecordIterator iter = new RecordIterator(singleBatch, null, exec.getContext().newOperatorContext(dummyPop, stats), 0, null);
- List<ValueVector> vectors = null;
+ List<ValueVector> vectors;
// batche sizes
// 1, 100, 10, 10000, 1, 1000
// total = 11112
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/record/vector/TestDateTypes.java b/exec/java-exec/src/test/java/org/apache/drill/exec/record/vector/TestDateTypes.java
index 4313ad025..24e646113 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/record/vector/TestDateTypes.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/record/vector/TestDateTypes.java
@@ -58,7 +58,7 @@ public class TestDateTypes extends PopUnitTestBase {
bit.run();
client.connect();
List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile("/record/vector/test_date.json"), Charsets.UTF_8)
+ Files.asCharSource(DrillFileUtils.getResourceAsFile("/record/vector/test_date.json"), Charsets.UTF_8).read()
.replace("#{TEST_FILE}", "/test_simple_date.json"));
RecordBatchLoader batchLoader = new RecordBatchLoader(bit.getContext().getAllocator());
@@ -92,7 +92,7 @@ public class TestDateTypes extends PopUnitTestBase {
bit.run();
client.connect();
List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile("/record/vector/test_sort_date.json"), Charsets.UTF_8)
+ Files.asCharSource(DrillFileUtils.getResourceAsFile("/record/vector/test_sort_date.json"), Charsets.UTF_8).read()
.replace("#{TEST_FILE}", "/test_simple_date.json"));
RecordBatchLoader batchLoader = new RecordBatchLoader(bit.getContext().getAllocator());
@@ -104,9 +104,9 @@ public class TestDateTypes extends PopUnitTestBase {
ValueVector.Accessor accessor = v.getValueVector().getAccessor();
- assertEquals((accessor.getObject(0).toString()), new String("1970-01-02"));
- assertEquals((accessor.getObject(1).toString()), new String("2000-02-27"));
- assertEquals((accessor.getObject(2).toString()), new String("2008-12-28"));
+ assertEquals((accessor.getObject(0).toString()), "1970-01-02");
+ assertEquals((accessor.getObject(1).toString()), "2000-02-27");
+ assertEquals((accessor.getObject(2).toString()), "2008-12-28");
}
batchLoader.clear();
@@ -126,7 +126,7 @@ public class TestDateTypes extends PopUnitTestBase {
bit.run();
client.connect();
List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile("/record/vector/test_timestamp.json"), Charsets.UTF_8)
+ Files.asCharSource(DrillFileUtils.getResourceAsFile("/record/vector/test_timestamp.json"), Charsets.UTF_8).read()
.replace("#{TEST_FILE}", "/test_simple_date.json"));
RecordBatchLoader batchLoader = new RecordBatchLoader(bit.getContext().getAllocator());
@@ -160,7 +160,7 @@ public class TestDateTypes extends PopUnitTestBase {
bit.run();
client.connect();
List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile("/record/vector/test_interval.json"), Charsets.UTF_8)
+ Files.asCharSource(DrillFileUtils.getResourceAsFile("/record/vector/test_interval.json"), Charsets.UTF_8).read()
.replace("#{TEST_FILE}", "/test_simple_interval.json"));
RecordBatchLoader batchLoader = new RecordBatchLoader(bit.getContext().getAllocator());
@@ -218,7 +218,7 @@ public class TestDateTypes extends PopUnitTestBase {
bit.run();
client.connect();
List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile("/record/vector/test_all_date_literals.json"), Charsets.UTF_8)
+ Files.asCharSource(DrillFileUtils.getResourceAsFile("/record/vector/test_all_date_literals.json"), Charsets.UTF_8).read()
.replace("#{TEST_FILE}", "/test_simple_date.json"));
RecordBatchLoader batchLoader = new RecordBatchLoader(bit.getContext().getAllocator());
@@ -257,7 +257,7 @@ public class TestDateTypes extends PopUnitTestBase {
bit.run();
client.connect();
List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile("/record/vector/test_date_add.json"), Charsets.UTF_8)
+ Files.asCharSource(DrillFileUtils.getResourceAsFile("/record/vector/test_date_add.json"), Charsets.UTF_8).read()
.replace("#{TEST_FILE}", "/test_simple_date.json"));
RecordBatchLoader batchLoader = new RecordBatchLoader(bit.getContext().getAllocator());
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/store/TestImplicitFileColumns.java b/exec/java-exec/src/test/java/org/apache/drill/exec/store/TestImplicitFileColumns.java
index 67cb6c5d8..4222958de 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/store/TestImplicitFileColumns.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/store/TestImplicitFileColumns.java
@@ -59,11 +59,11 @@ public class TestImplicitFileColumns extends BaseTestQuery {
public static void setup() throws Exception {
File files = dirTestWatcher.makeRootSubDir(FILES);
mainFile = new File(files, MAIN_FILE);
- Files.write(MAIN, mainFile, Charsets.UTF_8);
+ Files.asCharSink(mainFile, Charsets.UTF_8).write(MAIN);
File nestedFolder = new File(files, NESTED);
nestedFolder.mkdirs();
nestedFile = new File(nestedFolder, NESTED_FILE);
- Files.write(NESTED, nestedFile, Charsets.UTF_8);
+ Files.asCharSink(nestedFile, Charsets.UTF_8).write(NESTED);
dirTestWatcher.copyResourceToRoot(JSON_TBL);
dirTestWatcher.copyResourceToRoot(PARQUET_TBL);
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/ParquetRecordReaderTest.java b/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/ParquetRecordReaderTest.java
index 166486ea7..0c5fe5d0a 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/ParquetRecordReaderTest.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/ParquetRecordReaderTest.java
@@ -109,7 +109,7 @@ public class ParquetRecordReaderTest extends BaseTestQuery {
}
public String getPlanForFile(String pathFileName, String parquetFileName) throws IOException {
- return Files.toString(DrillFileUtils.getResourceAsFile(pathFileName), Charsets.UTF_8)
+ return Files.asCharSource(DrillFileUtils.getResourceAsFile(pathFileName), Charsets.UTF_8).read()
.replaceFirst("&REPLACED_IN_PARQUET_TEST&", parquetFileName);
}
@@ -127,8 +127,8 @@ public class ParquetRecordReaderTest extends BaseTestQuery {
}
}
- final String planText = Files.toString(DrillFileUtils.getResourceAsFile(
- "parquet/parquet_scan_screen_read_entry_replace.json"), Charsets.UTF_8).replaceFirst(
+ final String planText = Files.asCharSource(DrillFileUtils.getResourceAsFile(
+ "parquet/parquet_scan_screen_read_entry_replace.json"), Charsets.UTF_8).read().replaceFirst(
"&REPLACED_IN_PARQUET_TEST&", readEntries.toString());
testParquetFullEngineLocalText(planText, fileName, i, numberRowGroups, recordsPerRowGroup, true);
}
@@ -180,8 +180,8 @@ public class ParquetRecordReaderTest extends BaseTestQuery {
@Test
public void testFixedBinary() throws Exception {
final String readEntries = "\"tmp/drilltest/fixed_binary.parquet\"";
- final String planText = Files.toString(DrillFileUtils.getResourceAsFile(
- "parquet/parquet_scan_screen_read_entry_replace.json"), Charsets.UTF_8)
+ final String planText = Files.asCharSource(DrillFileUtils.getResourceAsFile(
+ "parquet/parquet_scan_screen_read_entry_replace.json"), Charsets.UTF_8).read()
.replaceFirst( "&REPLACED_IN_PARQUET_TEST&", readEntries);
testParquetFullEngineLocalText(planText, fileName, 1, 1, 1000000, false);
}
@@ -266,7 +266,7 @@ public class ParquetRecordReaderTest extends BaseTestQuery {
public void testParquetFullEngineLocalPath(String planFileName, String filename,
int numberOfTimesRead /* specified in json plan */,
int numberOfRowGroups, int recordsPerRowGroup) throws Exception {
- testParquetFullEngineLocalText(Files.toString(DrillFileUtils.getResourceAsFile(planFileName), Charsets.UTF_8), filename,
+ testParquetFullEngineLocalText(Files.asCharSource(DrillFileUtils.getResourceAsFile(planFileName), Charsets.UTF_8).read(), filename,
numberOfTimesRead, numberOfRowGroups, recordsPerRowGroup, true);
}
@@ -297,7 +297,7 @@ public class ParquetRecordReaderTest extends BaseTestQuery {
public void testParquetFullEngineLocalTextDistributed(String planName, String filename,
int numberOfTimesRead /* specified in json plan */,
int numberOfRowGroups, int recordsPerRowGroup) throws Exception {
- String planText = Files.toString(DrillFileUtils.getResourceAsFile(planName), Charsets.UTF_8);
+ String planText = Files.asCharSource(DrillFileUtils.getResourceAsFile(planName), Charsets.UTF_8).read();
testFull(QueryType.PHYSICAL, planText, filename, numberOfTimesRead, numberOfRowGroups, recordsPerRowGroup, true);
}
@@ -325,7 +325,7 @@ public class ParquetRecordReaderTest extends BaseTestQuery {
TestFileGenerator.populateFieldInfoMap(props);
final ParquetResultListener resultListener =
new ParquetResultListener(getAllocator(), props, numberOfTimesRead, true);
- testWithListener(QueryType.PHYSICAL, Files.toString(DrillFileUtils.getResourceAsFile(plan), Charsets.UTF_8), resultListener);
+ testWithListener(QueryType.PHYSICAL, Files.asCharSource(DrillFileUtils.getResourceAsFile(plan), Charsets.UTF_8).read(), resultListener);
resultListener.getResults();
}
@@ -669,7 +669,7 @@ public class ParquetRecordReaderTest extends BaseTestQuery {
final ParquetResultListener resultListener = new ParquetResultListener(getAllocator(), props, numberOfTimesRead, testValues);
final long C = System.nanoTime();
- String planText = Files.toString(DrillFileUtils.getResourceAsFile(plan), Charsets.UTF_8);
+ String planText = Files.asCharSource(DrillFileUtils.getResourceAsFile(plan), Charsets.UTF_8).read();
// substitute in the string for the read entries, allows reuse of the plan file for several tests
if (readEntries != null) {
planText = planText.replaceFirst( "&REPLACED_IN_PARQUET_TEST&", readEntries);
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/store/text/TextRecordReaderTest.java b/exec/java-exec/src/test/java/org/apache/drill/exec/store/text/TextRecordReaderTest.java
index c1e63a988..b660617ea 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/store/text/TextRecordReaderTest.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/store/text/TextRecordReaderTest.java
@@ -46,8 +46,8 @@ public class TextRecordReaderTest extends PopUnitTestBase {
bit1.run();
client.connect();
List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL,
- Files.toString(
- DrillFileUtils.getResourceAsFile("/store/text/test.json"), Charsets.UTF_8)
+ Files.asCharSource(
+ DrillFileUtils.getResourceAsFile("/store/text/test.json"), Charsets.UTF_8).read()
.replace("#{DATA_FILE}", DrillFileUtils.getResourceAsFile("/store/text/data/regions.csv").toURI().toString()));
int count = 0;
RecordBatchLoader loader = new RecordBatchLoader(bit1.getContext().getAllocator());
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestJsonReader.java b/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestJsonReader.java
index b20c7e24f..2e0029636 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestJsonReader.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestJsonReader.java
@@ -157,7 +157,7 @@ public class TestJsonReader extends BaseTestQuery {
logger.debug("===================");
logger.debug("source data in json");
logger.debug("===================");
- logger.debug(Files.toString(DrillFileUtils.getResourceAsFile(filename), Charsets.UTF_8));
+ logger.debug(Files.asCharSource(DrillFileUtils.getResourceAsFile(filename), Charsets.UTF_8).read());
int i = 0;
for (String query : queries) {
@@ -322,7 +322,7 @@ public class TestJsonReader extends BaseTestQuery {
// ensure that the project is filtering out the correct data in the scan alone
@Test
public void testProjectPushdown() throws Exception {
- String[] queries = {Files.toString(DrillFileUtils.getResourceAsFile("/store/json/project_pushdown_json_physical_plan.json"), Charsets.UTF_8)};
+ String[] queries = {Files.asCharSource(DrillFileUtils.getResourceAsFile("/store/json/project_pushdown_json_physical_plan.json"), Charsets.UTF_8).read()};
long[] rowCounts = {3};
String filename = "/store/json/schema_change_int_to_string.json";
test("alter system set `store.json.all_text_mode` = false");
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/work/batch/TestSpoolingBuffer.java b/exec/java-exec/src/test/java/org/apache/drill/exec/work/batch/TestSpoolingBuffer.java
index 6fa485a19..b01fcf710 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/work/batch/TestSpoolingBuffer.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/work/batch/TestSpoolingBuffer.java
@@ -42,13 +42,13 @@ public class TestSpoolingBuffer extends BaseTestQuery {
DrillConfig conf = DrillConfig.create("drill-spool-test-module.conf");
try(Drillbit bit1 = new Drillbit(conf, serviceSet);
- DrillClient client = new DrillClient(conf, serviceSet.getCoordinator());) {
+ DrillClient client = new DrillClient(conf, serviceSet.getCoordinator())) {
bit1.run();
client.connect();
List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL,
- Files.toString(DrillFileUtils.getResourceAsFile("/work/batch/multiple_exchange.json"),
- Charsets.UTF_8));
+ Files.asCharSource(DrillFileUtils.getResourceAsFile("/work/batch/multiple_exchange.json"),
+ Charsets.UTF_8).read());
int count = 0;
for(QueryDataBatch b : results) {
if (b.getHeader().getRowCount() != 0) {
diff --git a/exec/jdbc-all/pom.xml b/exec/jdbc-all/pom.xml
index 91ad39a5e..e5124f0d2 100644
--- a/exec/jdbc-all/pom.xml
+++ b/exec/jdbc-all/pom.xml
@@ -432,6 +432,15 @@
<exclude>codegen/**</exclude>
<exclude>bootstrap-storage-plugins.json</exclude>
<exclude>org/apache/parquet</exclude>
+ <exclude>org/apache/drill/shaded/com/google/common/math</exclude>
+ <exclude>org/apache/drill/shaded/com/google/common/graph</exclude>
+ <exclude>org/apache/drill/shaded/com/google/common/net</exclude>
+ <exclude>org/apache/drill/shaded/com/google/common/primitives</exclude>
+ <exclude>org/apache/drill/shaded/com/google/common/reflect</exclude>
+ <exclude>org/apache/drill/shaded/com/google/common/util</exclude>
+ <exclude>org/apache/drill/shaded/com/google/common/cache</exclude>
+ <exclude>org/apache/drill/shaded/com/google/common/collect/Tree*</exclude>
+ <exclude>org/apache/drill/shaded/com/google/common/collect/Standard*</exclude>
<exclude>com/google/common/math</exclude>
<exclude>com/google/common/net</exclude>
<exclude>com/google/common/primitives</exclude>
@@ -498,7 +507,7 @@
This is likely due to you adding new dependencies to a java-exec and not updating the excludes in this module. This is important as it minimizes the size of the dependency of Drill application users.
</message>
- <maxsize>36500000</maxsize>
+ <maxsize>39000000</maxsize>
<minsize>15000000</minsize>
<files>
<file>${project.build.directory}/drill-jdbc-all-${project.version}.jar</file>
@@ -558,7 +567,7 @@
This is likely due to you adding new dependencies to a java-exec and not updating the excludes in this module. This is important as it minimizes the size of the dependency of Drill application users.
</message>
- <maxsize>34000000</maxsize>
+ <maxsize>37000000</maxsize>
<minsize>15000000</minsize>
<files>
<file>${project.build.directory}/drill-jdbc-all-${project.version}.jar</file>
@@ -738,6 +747,15 @@
<exclude>codegen/**</exclude>
<exclude>bootstrap-storage-plugins.json</exclude>
<exclude>org/apache/parquet</exclude>
+ <exclude>org/apache/drill/shaded/com/google/common/math</exclude>
+ <exclude>org/apache/drill/shaded/com/google/common/graph</exclude>
+ <exclude>org/apache/drill/shaded/com/google/common/net</exclude>
+ <exclude>org/apache/drill/shaded/com/google/common/primitives</exclude>
+ <exclude>org/apache/drill/shaded/com/google/common/reflect</exclude>
+ <exclude>org/apache/drill/shaded/com/google/common/util</exclude>
+ <exclude>org/apache/drill/shaded/com/google/common/cache</exclude>
+ <exclude>org/apache/drill/shaded/com/google/common/collect/Tree*</exclude>
+ <exclude>org/apache/drill/shaded/com/google/common/collect/Standard*</exclude>
<exclude>com/google/common/math</exclude>
<exclude>com/google/common/net</exclude>
<exclude>com/google/common/primitives</exclude>
diff --git a/exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/DrillConnectionImpl.java b/exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/DrillConnectionImpl.java
index e005175e1..f504d0e1b 100644
--- a/exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/DrillConnectionImpl.java
+++ b/exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/DrillConnectionImpl.java
@@ -195,7 +195,7 @@ class DrillConnectionImpl extends AvaticaConnection
try {
return super.prepareAndExecuteInternal(statement, sql, maxRowCount);
} catch (RuntimeException e) {
- Throwables.propagateIfInstanceOf(e.getCause(), SQLException.class);
+ Throwables.throwIfInstanceOf(e.getCause(), SQLException.class);
throw e;
}
}
diff --git a/exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/DrillDatabaseMetaDataImpl.java b/exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/DrillDatabaseMetaDataImpl.java
index b7617b290..67cd7931c 100644
--- a/exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/DrillDatabaseMetaDataImpl.java
+++ b/exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/DrillDatabaseMetaDataImpl.java
@@ -172,7 +172,7 @@ class DrillDatabaseMetaDataImpl extends AvaticaDatabaseMetaData
if (cause == null) {
throw new AssertionError("Something unknown happened", e);
}
- Throwables.propagateIfPossible(cause);
+ Throwables.throwIfUnchecked(cause);
throw new SQLException("Error when getting server meta", cause);
}
}
@@ -1141,7 +1141,7 @@ class DrillDatabaseMetaDataImpl extends AvaticaDatabaseMetaData
try {
return super.getTables(catalog, schemaPattern,tableNamePattern, types);
} catch(DrillRuntimeException e) {
- Throwables.propagateIfInstanceOf(e.getCause(), SQLException.class);
+ Throwables.throwIfInstanceOf(e.getCause(), SQLException.class);
throw e;
}
}
@@ -1153,7 +1153,7 @@ class DrillDatabaseMetaDataImpl extends AvaticaDatabaseMetaData
try {
return super.getSchemas();
} catch(DrillRuntimeException e) {
- Throwables.propagateIfInstanceOf(e.getCause(), SQLException.class);
+ Throwables.throwIfInstanceOf(e.getCause(), SQLException.class);
throw e;
}
}
@@ -1164,7 +1164,7 @@ class DrillDatabaseMetaDataImpl extends AvaticaDatabaseMetaData
try {
return super.getCatalogs();
} catch(DrillRuntimeException e) {
- Throwables.propagateIfInstanceOf(e.getCause(), SQLException.class);
+ Throwables.throwIfInstanceOf(e.getCause(), SQLException.class);
throw e;
}
}
@@ -1182,7 +1182,7 @@ class DrillDatabaseMetaDataImpl extends AvaticaDatabaseMetaData
try {
return super.getColumns(catalog, schema, table, columnNamePattern);
} catch(DrillRuntimeException e) {
- Throwables.propagateIfInstanceOf(e.getCause(), SQLException.class);
+ Throwables.throwIfInstanceOf(e.getCause(), SQLException.class);
throw e;
}
}
diff --git a/logical/src/main/java/org/apache/drill/common/expression/NullExpression.java b/logical/src/main/java/org/apache/drill/common/expression/NullExpression.java
index b36f3e669..7b1f7f299 100644
--- a/logical/src/main/java/org/apache/drill/common/expression/NullExpression.java
+++ b/logical/src/main/java/org/apache/drill/common/expression/NullExpression.java
@@ -17,6 +17,7 @@
*/
package org.apache.drill.common.expression;
+import java.util.Collections;
import java.util.Iterator;
import org.apache.drill.common.expression.visitors.ExprVisitor;
@@ -24,8 +25,6 @@ import org.apache.drill.common.types.TypeProtos.MajorType;
import org.apache.drill.common.types.TypeProtos.MinorType;
import org.apache.drill.common.types.Types;
-import com.google.common.collect.Iterators;
-
public class NullExpression implements LogicalExpression{
static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(NullExpression.class);
@@ -50,7 +49,7 @@ public class NullExpression implements LogicalExpression{
@Override
public Iterator<LogicalExpression> iterator() {
- return Iterators.emptyIterator();
+ return Collections.emptyIterator();
}
public int getSelfCost() { return 0; }
diff --git a/logical/src/main/java/org/apache/drill/common/expression/TypedNullConstant.java b/logical/src/main/java/org/apache/drill/common/expression/TypedNullConstant.java
index 675dc66dc..3e773ffbe 100644
--- a/logical/src/main/java/org/apache/drill/common/expression/TypedNullConstant.java
+++ b/logical/src/main/java/org/apache/drill/common/expression/TypedNullConstant.java
@@ -17,6 +17,7 @@
*/
package org.apache.drill.common.expression;
+import java.util.Collections;
import java.util.Iterator;
import org.apache.drill.common.expression.visitors.ExprVisitor;
@@ -24,8 +25,6 @@ import org.apache.drill.common.types.TypeProtos;
import org.apache.drill.common.types.TypeProtos.DataMode;
import org.apache.drill.common.types.TypeProtos.MajorType;
-import com.google.common.collect.Iterators;
-
public class TypedNullConstant extends LogicalExpressionBase {
private final MajorType type;
@@ -48,7 +47,7 @@ public class TypedNullConstant extends LogicalExpressionBase {
@Override
public Iterator<LogicalExpression> iterator() {
- return Iterators.emptyIterator();
+ return Collections.emptyIterator();
}
}
diff --git a/logical/src/main/java/org/apache/drill/common/expression/ValueExpressions.java b/logical/src/main/java/org/apache/drill/common/expression/ValueExpressions.java
index 538e6c844..7bbdca2c9 100644
--- a/logical/src/main/java/org/apache/drill/common/expression/ValueExpressions.java
+++ b/logical/src/main/java/org/apache/drill/common/expression/ValueExpressions.java
@@ -29,8 +29,6 @@ import org.apache.drill.common.types.TypeProtos.MajorType;
import org.apache.drill.common.types.TypeProtos.MinorType;
import org.apache.drill.common.types.Types;
-import com.google.common.collect.Iterators;
-
public class ValueExpressions {
public static LogicalExpression getBigInt(long l){
@@ -140,7 +138,7 @@ public class ValueExpressions {
@Override
public Iterator<LogicalExpression> iterator() {
- return Iterators.emptyIterator();
+ return Collections.emptyIterator();
}
}
@@ -201,7 +199,7 @@ public class ValueExpressions {
@Override
public Iterator<LogicalExpression> iterator() {
- return Iterators.emptyIterator();
+ return Collections.emptyIterator();
}
}
@@ -233,7 +231,7 @@ public class ValueExpressions {
@Override
public Iterator<LogicalExpression> iterator() {
- return Iterators.emptyIterator();
+ return Collections.emptyIterator();
}
}
@@ -276,7 +274,7 @@ public class ValueExpressions {
@Override
public Iterator<LogicalExpression> iterator() {
- return Iterators.emptyIterator();
+ return Collections.emptyIterator();
}
}
@@ -318,7 +316,7 @@ public class ValueExpressions {
@Override
public Iterator<LogicalExpression> iterator() {
- return Iterators.emptyIterator();
+ return Collections.emptyIterator();
}
}
@@ -349,7 +347,7 @@ public class ValueExpressions {
@Override
public Iterator<LogicalExpression> iterator() {
- return Iterators.emptyIterator();
+ return Collections.emptyIterator();
}
}
@@ -449,7 +447,7 @@ public class ValueExpressions {
@Override
public Iterator<LogicalExpression> iterator() {
- return Iterators.emptyIterator();
+ return Collections.emptyIterator();
}
}
@@ -485,7 +483,7 @@ public class ValueExpressions {
@Override
public Iterator<LogicalExpression> iterator() {
- return Iterators.emptyIterator();
+ return Collections.emptyIterator();
}
}
@@ -522,7 +520,7 @@ public class ValueExpressions {
@Override
public Iterator<LogicalExpression> iterator() {
- return Iterators.emptyIterator();
+ return Collections.emptyIterator();
}
}
@@ -559,7 +557,7 @@ public class ValueExpressions {
@Override
public Iterator<LogicalExpression> iterator() {
- return Iterators.emptyIterator();
+ return Collections.emptyIterator();
}
}
@@ -595,7 +593,7 @@ public class ValueExpressions {
@Override
public Iterator<LogicalExpression> iterator() {
- return Iterators.emptyIterator();
+ return Collections.emptyIterator();
}
}
@@ -631,7 +629,7 @@ public class ValueExpressions {
@Override
public Iterator<LogicalExpression> iterator() {
- return Iterators.emptyIterator();
+ return Collections.emptyIterator();
}
}
@@ -674,7 +672,7 @@ public class ValueExpressions {
@Override
public Iterator<LogicalExpression> iterator() {
- return Iterators.emptyIterator();
+ return Collections.emptyIterator();
}
}
diff --git a/logical/src/main/java/org/apache/drill/common/logical/data/SourceOperator.java b/logical/src/main/java/org/apache/drill/common/logical/data/SourceOperator.java
index 17f78ebcf..5c4a112cf 100644
--- a/logical/src/main/java/org/apache/drill/common/logical/data/SourceOperator.java
+++ b/logical/src/main/java/org/apache/drill/common/logical/data/SourceOperator.java
@@ -17,10 +17,9 @@
*/
package org.apache.drill.common.logical.data;
+import java.util.Collections;
import java.util.Iterator;
-import com.google.common.collect.Iterators;
-
/**
* An operator that produces data without any parents. (zero input operator)
@@ -29,7 +28,7 @@ public abstract class SourceOperator extends LogicalOperatorBase{
@Override
public Iterator<LogicalOperator> iterator() {
- return Iterators.emptyIterator();
+ return Collections.emptyIterator();
}
}
diff --git a/pom.xml b/pom.xml
index bf9cf1088..5bb908fa6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -42,7 +42,8 @@
<proto.cas.path>${project.basedir}/src/main/protobuf/</proto.cas.path>
<dep.junit.version>4.12</dep.junit.version>
<dep.slf4j.version>1.7.6</dep.slf4j.version>
- <dep.guava.version>18.0</dep.guava.version>
+ <shaded.guava.version>23.0</shaded.guava.version>
+ <guava.version>19.0</guava.version>
<forkCount>2</forkCount>
<parquet.version>1.10.0</parquet.version>
<calcite.version>1.17.0-drill-r0</calcite.version>
@@ -884,9 +885,8 @@
</dependency>
<dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <version>${dep.guava.version}</version>
+ <groupId>org.apache.drill</groupId>
+ <artifactId>drill-shaded-guava</artifactId>
</dependency>
<dependency>
@@ -993,6 +993,16 @@
<dependencyManagement>
<dependencies>
<dependency>
+ <groupId>org.apache.drill</groupId>
+ <artifactId>drill-shaded-guava</artifactId>
+ <version>${shaded.guava.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>${guava.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.calcite.avatica</groupId>
<artifactId>avatica</artifactId>
<version>${avatica.version}</version>
diff --git a/src/main/resources/checkstyle-config.xml b/src/main/resources/checkstyle-config.xml
index 1ee487845..b4b1cbc1c 100644
--- a/src/main/resources/checkstyle-config.xml
+++ b/src/main/resources/checkstyle-config.xml
@@ -29,8 +29,9 @@
<module name="TreeWalker">
<module name="UnusedImports"/>
<module name="IllegalImport">
- <!-- For "org.apache.commons.lang.*" classes use the corresponding class from "org.apache.commons.lang3.*" -->
- <property name="illegalPkgs" value="com.google.hive12,com.beust.jcommander.internal,jersey.repackaged,org.apache.commons.lang"/>
+ <!-- For "org.apache.commons.lang.*" classes use the corresponding class from "org.apache.commons.lang3.*".
+ For com.google.common.* classes use shaded ones from org.apache.drill.shaded.guava.com.google.common.*-->
+ <property name="illegalPkgs" value="com.google.hive12,com.beust.jcommander.internal,jersey.repackaged,org.apache.commons.lang,com.google.common"/>
</module>
<module name="AvoidStarImport"/>