Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove import of Builder #232

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com.google.common.base.VerifyException;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMap.Builder;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
Expand Down Expand Up @@ -725,7 +724,7 @@ public void createTable(ConnectorSession session, ConnectorTableMetadata tableMe

private Map<String, String> getEmptyTableProperties(ConnectorTableMetadata tableMetadata, boolean partitioned, HdfsContext hdfsContext)
{
Builder<String, String> tableProperties = ImmutableMap.builder();
ImmutableMap.Builder<String, String> tableProperties = ImmutableMap.builder();

// Hook point for extended versions of the Hive Plugin
tableProperties.putAll(tableParameterCodec.encode(tableMetadata.getProperties()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
package io.prestosql.plugin.hive;

import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
import io.airlift.slice.Slice;
import io.prestosql.spi.predicate.Domain;
import io.prestosql.spi.predicate.Range;
Expand All @@ -30,8 +31,6 @@

import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkState;
import static com.google.common.collect.ImmutableList.Builder;
Copy link
Member Author

@findepi findepi Feb 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know both are valid Java:

import static com.google.common.collect.ImmutableList.Builder;
import        com.google.common.collect.ImmutableList.Builder;

import static com.google.common.collect.ImmutableList.builder;
import static com.google.common.collect.Iterables.getOnlyElement;
import static io.prestosql.spi.type.BigintType.BIGINT;
import static io.prestosql.spi.type.BooleanType.BOOLEAN;
Expand Down Expand Up @@ -89,7 +88,7 @@ public String buildSql(List<HiveColumnHandle> columns, TupleDomain<HiveColumnHan

private List<String> toConjuncts(List<HiveColumnHandle> columns, TupleDomain<HiveColumnHandle> tupleDomain)
{
Builder<String> builder = builder();
ImmutableList.Builder<String> builder = ImmutableList.builder();
for (HiveColumnHandle column : columns) {
Type type = column.getHiveType().getType(typeManager);
if (tupleDomain.getDomains().isPresent() && isSupported(type)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableList.Builder;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Maps;
Expand Down Expand Up @@ -199,7 +198,7 @@ else if (HISTORY_SCHEMA_NAME.equals(schema)) {

private List<SchemaTableName> listJmxTables()
{
Builder<SchemaTableName> tableNames = ImmutableList.builder();
ImmutableList.Builder<SchemaTableName> tableNames = ImmutableList.builder();
for (ObjectName objectName : mbeanServer.queryNames(WILDCARD, null)) {
// todo remove lower case when presto supports mixed case names
tableNames.add(new SchemaTableName(JMX_SCHEMA_NAME, objectName.getCanonicalName().toLowerCase(ENGLISH)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@
import com.google.common.collect.ImmutableBiMap;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMap.Builder;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSetMultimap;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
import com.google.common.collect.SetMultimap;
import com.google.common.primitives.Ints;
import io.airlift.log.Logger;
import io.airlift.units.DataSize;
import io.prestosql.Session;
import io.prestosql.SystemSessionProperties;
Expand Down Expand Up @@ -285,8 +283,6 @@

public class LocalExecutionPlanner
{
private static final Logger log = Logger.get(LocalExecutionPlanner.class);

private final Metadata metadata;
private final SqlParser sqlParser;
private final Optional<ExplainAnalyzeContext> explainAnalyzeContext;
Expand Down Expand Up @@ -1281,7 +1277,7 @@ private RowExpression toRowExpression(Expression expression, Map<NodeRef<Express

private Map<Integer, Type> getInputTypes(Map<Symbol, Integer> layout, List<Type> types)
{
Builder<Integer, Type> inputTypes = ImmutableMap.builder();
ImmutableMap.Builder<Integer, Type> inputTypes = ImmutableMap.builder();
for (Integer input : ImmutableSet.copyOf(layout.values())) {
Type type = types.get(input);
inputTypes.put(input, type);
Expand Down Expand Up @@ -1392,7 +1388,7 @@ private ImmutableMap<Symbol, Integer> makeLayout(PlanNode node)

private ImmutableMap<Symbol, Integer> makeLayoutFromOutputSymbols(List<Symbol> outputSymbols)
{
Builder<Symbol, Integer> outputMappings = ImmutableMap.builder();
ImmutableMap.Builder<Symbol, Integer> outputMappings = ImmutableMap.builder();
int channel = 0;
for (Symbol symbol : outputSymbols) {
outputMappings.put(symbol, channel);
Expand Down Expand Up @@ -2121,7 +2117,7 @@ private OptionalInt getJoinOperatorsCountForSpill(LocalExecutionPlanContext cont

private Map<Symbol, Integer> createJoinSourcesLayout(Map<Symbol, Integer> lookupSourceLayout, Map<Symbol, Integer> probeSourceLayout)
{
Builder<Symbol, Integer> joinSourcesLayout = ImmutableMap.builder();
ImmutableMap.Builder<Symbol, Integer> joinSourcesLayout = ImmutableMap.builder();
joinSourcesLayout.putAll(lookupSourceLayout);
for (Map.Entry<Symbol, Integer> probeLayoutEntry : probeSourceLayout.entrySet()) {
joinSourcesLayout.put(probeLayoutEntry.getKey(), probeLayoutEntry.getValue() + lookupSourceLayout.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableList.Builder;
import com.google.common.collect.ImmutableSet;
import io.prestosql.cost.StatsAndCosts;
import io.prestosql.operator.StageExecutionDescriptor;
Expand Down Expand Up @@ -194,7 +193,7 @@ private static void findSources(PlanNode node, Set<PlanNodeId> nodeIds, Immutabl
}
}

private static void findRemoteSourceNodes(PlanNode node, Builder<RemoteSourceNode> builder)
private static void findRemoteSourceNodes(PlanNode node, ImmutableList.Builder<RemoteSourceNode> builder)
{
for (PlanNode source : node.getSources()) {
findRemoteSourceNodes(source, builder);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import java.util.Map;

import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.collect.ImmutableMap.builder;
import static io.airlift.slice.Slices.utf8Slice;
import static io.prestosql.SessionTestUtils.TEST_SESSION;
import static io.prestosql.spi.function.OperatorType.HASH_CODE;
Expand Down Expand Up @@ -379,7 +378,7 @@ public void testJsonToMap()

assertFunction("CAST(JSON '{\"k1\": 5, \"k2\": 3.14, \"k3\":[1, 2, 3], \"k4\":\"e\", \"k5\":{\"a\": \"b\"}, \"k6\":null, \"k7\":\"null\", \"k8\":[null]}' AS MAP<VARCHAR, JSON>)",
mapType(VARCHAR, JSON),
builder()
ImmutableMap.builder()
.put("k1", "5")
.put("k2", "3.14")
.put("k3", "[1,2,3]")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import com.google.common.collect.ContiguousSet;
import com.google.common.collect.DiscreteDomain;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableList.Builder;
import com.google.common.collect.Range;
import io.prestosql.spi.type.CharType;
import io.prestosql.spi.type.DecimalType;
Expand Down Expand Up @@ -457,7 +456,7 @@ private static List<Double> doubleSequence(double start, double step, int items)

private static List<Float> floatSequence(float start, float step, int items)
{
Builder<Float> values = ImmutableList.builder();
ImmutableList.Builder<Float> values = ImmutableList.builder();
float nextValue = start;
for (int i = 0; i < items; i++) {
values.add(nextValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import static io.prestosql.execution.TestQueryRunnerUtil.waitForQueryState;
import static io.prestosql.spi.StandardErrorCode.EXCEEDED_CPU_LIMIT;
import static io.prestosql.spi.StandardErrorCode.GENERIC_INTERNAL_ERROR;
import static io.prestosql.tests.tpch.TpchQueryRunnerBuilder.builder;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.fail;
Expand Down Expand Up @@ -93,7 +92,7 @@ public void testFailQuery()
public void testQueryCpuLimit()
throws Exception
{
try (DistributedQueryRunner queryRunner = builder().setSingleExtraProperty("query.max-cpu-time", "1ms").build()) {
try (DistributedQueryRunner queryRunner = TpchQueryRunnerBuilder.builder().setSingleExtraProperty("query.max-cpu-time", "1ms").build()) {
QueryId queryId = createQuery(queryRunner, TEST_SESSION, "SELECT COUNT(*) FROM lineitem");
waitForQueryState(queryRunner, queryId, FAILED);
QueryManager queryManager = queryRunner.getCoordinator().getQueryManager();
Expand Down