Skip to content

Commit

Permalink
Cleanup code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
electrum committed Oct 31, 2018
1 parent 07aa455 commit 362a1f6
Show file tree
Hide file tree
Showing 97 changed files with 327 additions and 245 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,11 @@ public void getColumnMetadata()
@Test(expectedExceptions = PrestoException.class)
public void testCreateTable()
{
metadata.createTable(SESSION, new ConnectorTableMetadata(
new SchemaTableName("example", "foo"),
ImmutableList.of(new ColumnMetadata("text", VARCHAR))),
metadata.createTable(
SESSION,
new ConnectorTableMetadata(
new SchemaTableName("example", "foo"),
ImmutableList.of(new ColumnMetadata("text", VARCHAR))),
false);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ CassandraTable getTable(SchemaTableName schemaTableName)

/**
* Get the list of partitions matching the given filters on partition keys.
*
* @param table the table to get partitions from
* @param filterPrefix the list of possible values for each partition key.
* Order of values should match {@link CassandraTable#getPartitionKeyColumns()}
* Order of values should match {@link CassandraTable#getPartitionKeyColumns()}
* @return list of {@link CassandraPartition}
*/
List<CassandraPartition> getPartitions(CassandraTable table, List<Set<Object>> filterPrefix);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
public class TestConsoleHistory
{
@Test
public void testNonExistingHomeFolder() throws Exception
public void testNonExistingHomeFolder()
throws Exception
{
File historyFile = new File("/?", ".history");
assertFalse(historyFile.canRead(), "historyFile is readable");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,11 @@ public void getColumnMetadata()
@Test(expectedExceptions = PrestoException.class)
public void testCreateTable()
{
metadata.createTable(SESSION, new ConnectorTableMetadata(
new SchemaTableName("example", "foo"),
ImmutableList.of(new ColumnMetadata("text", createUnboundedVarcharType()))),
metadata.createTable(
SESSION,
new ConnectorTableMetadata(
new SchemaTableName("example", "foo"),
ImmutableList.of(new ColumnMetadata("text", createUnboundedVarcharType()))),
false);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ private GeometryUtils() {}

/**
* Copy of com.esri.core.geometry.Interop.translateFromAVNaN
*
* <p>
* deserializeEnvelope needs to recognize custom NAN values generated by
* ESRI's serialization of empty geometries.
*/
Expand All @@ -44,7 +44,7 @@ private static double translateFromAVNaN(double n)

/**
* Copy of com.esri.core.geometry.Interop.translateToAVNaN
*
* <p>
* JtsGeometrySerde#serialize must serialize NaN's the same way ESRI library does to achieve binary compatibility
*/
public static double translateToAVNaN(double n)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ public boolean equals(Object other)
}

BingTile otherTile = (BingTile) other;
return this.x == otherTile.x
&& this.y == otherTile.y
&& this.zoomLevel == otherTile.zoomLevel;
return this.x == otherTile.x &&
this.y == otherTile.y &&
this.zoomLevel == otherTile.zoomLevel;
}

@Override
Expand All @@ -66,10 +66,10 @@ public int hashCode()
public String toString()
{
return toStringHelper(this)
.add("x", x)
.add("y", y)
.add("zoom_level", zoomLevel)
.toString();
.add("x", x)
.add("y", y)
.add("zoom_level", zoomLevel)
.toString();
}

@JsonCreator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ private static void checkGeometryToBingTilesLimits(OGCGeometry ogcGeometry, Enve
{
if (pointOrRectangle) {
checkCondition(tileCount <= 1_000_000, "The number of tiles covering input rectangle exceeds the limit of 1M. " +
"Number of tiles: %d. Rectangle: xMin=%.2f, yMin=%.2f, xMax=%.2f, yMax=%.2f. Zoom level: %d.",
"Number of tiles: %d. Rectangle: xMin=%.2f, yMin=%.2f, xMax=%.2f, yMax=%.2f. Zoom level: %d.",
tileCount, envelope.getXMin(), envelope.getYMin(), envelope.getXMax(), envelope.getYMax(), zoomLevel);
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -799,8 +799,7 @@ public static Slice stStartPoint(@SqlType(GEOMETRY_TYPE_NAME) Slice input)
@Description("Returns a \"simplified\" version of the given geometry")
@ScalarFunction("simplify_geometry")
@SqlType(GEOMETRY_TYPE_NAME)
public static Slice simplifyGeometry(@SqlType(GEOMETRY_TYPE_NAME) Slice input,
@SqlType(DOUBLE) double distanceTolerance)
public static Slice simplifyGeometry(@SqlType(GEOMETRY_TYPE_NAME) Slice input, @SqlType(DOUBLE) double distanceTolerance)
{
if (isNaN(distanceTolerance)) {
throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "distanceTolerance is NaN");
Expand Down Expand Up @@ -1413,7 +1412,8 @@ private interface EnvelopesPredicate
private static Iterable<Slice> getGeometrySlicesFromBlock(Block block)
{
requireNonNull(block, "block is null");
return () -> new Iterator<Slice>() {
return () -> new Iterator<Slice>()
{
private int iteratorPosition;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
public class ConvexHullAggregation
{
private static final Joiner OR_JOINER = Joiner.on(" or ");

private ConvexHullAggregation() {}

@InputFunction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ private void assertBingTilesAroundWithRadius(
double longitude,
int zoomLevel,
double radius,
String...expectedQuadKeys)
String... expectedQuadKeys)
{
assertFunction(
format("transform(bing_tiles_around(%s, %s, %s, %s), x -> bing_tile_quadkey(x))",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,8 @@ public void testBroadcastSpatialLeftJoin()

// Empty build side
assertQuery("SELECT a.name, b.name " +
"FROM (" + POLYGONS_SQL + ") AS a (wkt, name, id) LEFT JOIN (VALUES (null, 'null', 1)) AS b (wkt, name, id) " +
"ON ST_Intersects(ST_GeometryFromText(b.wkt), ST_GeometryFromText(a.wkt))",
"FROM (" + POLYGONS_SQL + ") AS a (wkt, name, id) LEFT JOIN (VALUES (null, 'null', 1)) AS b (wkt, name, id) " +
"ON ST_Intersects(ST_GeometryFromText(b.wkt), ST_GeometryFromText(a.wkt))",
"SELECT * FROM VALUES ('a', null), ('b', null), ('c', null), ('d', null), ('empty', null), ('null', null)");

// Extra condition
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import com.facebook.presto.plugin.geospatial.GeometryType;
import com.facebook.presto.spi.Page;
import com.facebook.presto.spi.type.Type;
import com.facebook.presto.spi.type.TypeSignature;
import io.airlift.slice.Slice;
import org.testng.annotations.BeforeClass;

Expand All @@ -36,6 +35,7 @@

import static com.facebook.presto.metadata.FunctionExtractor.extractFunctions;
import static com.facebook.presto.operator.aggregation.AggregationTestUtils.assertAggregation;
import static com.facebook.presto.spi.type.TypeSignature.parseTypeSignature;

public abstract class AbstractTestGeoAggregationFunctions
extends AbstractTestFunctions
Expand All @@ -53,10 +53,11 @@ public void registerFunctions()
function = functionAssertions
.getMetadata()
.getFunctionRegistry()
.getAggregateFunctionImplementation(new Signature(getFunctionName(),
FunctionKind.AGGREGATE,
TypeSignature.parseTypeSignature(GeometryType.GEOMETRY_TYPE_NAME),
TypeSignature.parseTypeSignature(GeometryType.GEOMETRY_TYPE_NAME)));
.getAggregateFunctionImplementation(new Signature(
getFunctionName(),
FunctionKind.AGGREGATE,
parseTypeSignature(GeometryType.GEOMETRY_TYPE_NAME),
parseTypeSignature(GeometryType.GEOMETRY_TYPE_NAME)));
}

protected void assertAggregatedGeometries(String testDescription, String expectedWkt, String... wkts)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public void init()
{
factory = new GeometryStateFactory();
}

@Test
public void testCreateSingleStateEmpty()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public void testSerializeDeserialize()

assertEquals(state.getGeometry().asText(), "POINT (1 2)");
}

@Test
public void testSerializeDeserializeGrouped()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,8 @@ public Object[][] multipolygon()
{
"identity",
"MULTIPOLYGON (((4 2, 3 1, 5 1, 4 2)), ((14 12, 13 11, 15 11, 14 12)))",
new String[] {"MULTIPOLYGON(((4 2, 5 1, 3 1, 4 2)), ((14 12, 15 11, 13 11, 14 12)))", "MULTIPOLYGON(((4 2, 5 1, 3 1, 4 2)), ((14 12, 15 11, 13 11, 14 12)))"},
new String[] {"MULTIPOLYGON(((4 2, 5 1, 3 1, 4 2)), ((14 12, 15 11, 13 11, 14 12)))",
"MULTIPOLYGON(((4 2, 5 1, 3 1, 4 2)), ((14 12, 15 11, 13 11, 14 12)))"},
},
{
"empty with non-empty",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,7 @@ public Optional<List<String>> getPartitionNames(String databaseName, String tabl
* ['1','2','3'] or
* ['', '2', '']
* </pre>
*
* @param parts Full or partial list of partition values to filter on. Keys without filter will be empty strings.
* @return a list of partition names.
*/
Expand Down Expand Up @@ -636,6 +637,7 @@ private static List<String> buildPartitionNames(List<Column> partitionColumns, L
* Ex: Partition keys = ['a', 'b']
* Partition names = ['a=1/b=2', 'a=2/b=2']
* </pre>
*
* @param partitionNames List of full partition names
* @return Mapping of partition name to partition object
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ public static Optional<LocalDate> fromMetastoreDate(Date date)

/**
* Impala `COMPUTE STATS` will write -1 as the null count.
*
* @see <a href="https://issues.apache.org/jira/browse/IMPALA-7497">IMPALA-7497</a>
*/
public static OptionalLong fromMetastoreNullsCount(long nullsCount)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ public static com.facebook.presto.hive.metastore.Column getPrestoTestColumn()
private static final Consumer<Storage.Builder> STORAGE_CONSUMER = storage ->
{
storage.setStorageFormat(StorageFormat.create("SerdeLib", "InputFormat", "OutputFormat"))
.setLocation("/test-tbl")
.setBucketProperty(Optional.empty())
.setSerdeParameters(ImmutableMap.of());
.setLocation("/test-tbl")
.setBucketProperty(Optional.empty())
.setSerdeParameters(ImmutableMap.of());
};

private static String generateRandom()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ public void testParquetTupleDomainMap()
MessageType fileSchema = new MessageType("hive_schema",
new GroupType(OPTIONAL, "my_map",
new GroupType(REPEATED, "map",
new PrimitiveType(REQUIRED, INT32, "key"),
new PrimitiveType(OPTIONAL, INT32, "value"))));
new PrimitiveType(REQUIRED, INT32, "key"),
new PrimitiveType(OPTIONAL, INT32, "value"))));

Map<List<String>, RichColumnDescriptor> descriptorsByPath = getDescriptors(fileSchema, fileSchema);
TupleDomain<ColumnDescriptor> tupleDomain = getParquetTupleDomain(descriptorsByPath, domain);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ public void setupServer()
server = new TestingPrestoServer(
true,
ImmutableMap.<String, String>builder()
.put("testing-warning-collector.add-warnings", "true")
.put("testing-warning-collector.preloaded-warnings", String.valueOf(PRELOADED_WARNINGS))
.build(),
.put("testing-warning-collector.add-warnings", "true")
.put("testing-warning-collector.preloaded-warnings", String.valueOf(PRELOADED_WARNINGS))
.build(),
null,
null,
new SqlParserOptions(),
Expand Down Expand Up @@ -110,6 +110,7 @@ public void teardown()
closeQuietly(statement);
closeQuietly(connection);
}

@Test
public void testStatementWarnings()
throws SQLException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ public boolean advanceNextPosition()
}

nextRows = scanner.nextRows();
} while (!nextRows.hasNext());
}
while (!nextRows.hasNext());
log.debug("Fetched " + nextRows.getNumRows() + " rows");
}
catch (KuduException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ public interface StatsCalculator
{
/**
* Calculate stats for the {@code node}.
* @param node The node to compute stats for.
*
* @param node The node to compute stats for.
* @param sourceStats The stats provider for any child nodes' stats, if needed to compute stats for the {@code node}
* @param lookup Lookup to be used when resolving source nodes, allowing stats calculation to work within {@link IterativeOptimizer}
* @param types
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
public interface WarningCollector
{
WarningCollector NOOP =
new WarningCollector() {
new WarningCollector()
{
@Override
public void add(PrestoWarning warning) {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ MemoryTrackingContext getQueryMemoryContext()
/**
* Deadlock is possible for concurrent user and system allocations when updateSystemMemory()/updateUserMemory
* calls queryMemoryContext.getUserMemory()/queryMemoryContext.getSystemMemory(), respectively.
*
* @see this##updateSystemMemory(long) for details.
*/
private synchronized ListenableFuture<?> updateUserMemory(String allocationTag, long delta)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ public long[] getLogHistogramOutput()
return logHistogramOutput;
}

/** Estimated number of positions in on the build side */
/**
* Estimated number of positions in on the build side
*/
@JsonProperty
public Optional<Long> getLookupSourcePositions()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ public class JoinStatisticsCounter
// [2*bucket + 1] total count of rows that were produces by probe rows in this bucket.
private final long[] logHistogramCounters = new long[HISTOGRAM_BUCKETS * 2];

/** Estimated number of positions in on the build side */
/**
* Estimated number of positions in on the build side
*/
private Optional<Long> lookupSourcePositions = Optional.empty();

public JoinStatisticsCounter(JoinType joinType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
/**
* This page builder creates pages with dictionary blocks:
* normal dictionary blocks for the probe side and the original blocks for the build side.
*
* <p>
* TODO use dictionary blocks (probably extended kind) to avoid data copying for build side
*/
public class LookupJoinPageBuilder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public synchronized void probeOperatorFinished()
/**
* Called by {@link SpatialIndexBuilderOperator} to provide a
* {@link Supplier} of spatial indexes for {@link SpatialJoinOperator}s to use.
*
* <p>
* Returns a Future that completes once all the {@link SpatialJoinOperator}s have completed.
*/
public ListenableFuture<?> lendPagesSpatialIndex(Supplier<PagesSpatialIndex> pagesSpatialIndex)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
public interface ParametricImplementation
{
Signature getSignature();

boolean hasSpecializedTypeParameters();
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
/**
* This class represents set of three collections representing implementations of operators
* similar to partial template specialization from C++ allowing more optimized implementations to be provided for specific types.
*
* @param <T> type of implementation details
*/
public class ParametricImplementationsGroup<T extends ParametricImplementation>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public interface Work<T>
/**
* Call the method to do the work.
* The caller can keep calling this method until it returns true (i.e., the work is done).
*
* @return boolean to indicate if the work has finished.
*/
boolean process();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.List;

import static com.google.common.base.Verify.verify;

/**
* Instances of this state use a single PageBuilder for all groups.
*/
Expand Down
Loading

0 comments on commit 362a1f6

Please sign in to comment.