From 362a1f6d9deb0a5639d2dd79a536340446c17c0b Mon Sep 17 00:00:00 2001 From: David Phillips Date: Tue, 16 Oct 2018 18:10:50 -0700 Subject: [PATCH] Cleanup code formatting --- .../presto/plugin/jdbc/TestJdbcMetadata.java | 8 ++-- .../presto/cassandra/CassandraSession.java | 3 +- .../presto/cli/TestConsoleHistory.java | 3 +- .../presto/example/TestExampleMetadata.java | 8 ++-- .../presto/geospatial/GeometryUtils.java | 4 +- .../presto/plugin/geospatial/BingTile.java | 14 +++--- .../plugin/geospatial/BingTileFunctions.java | 2 +- .../plugin/geospatial/GeoFunctions.java | 6 +-- .../aggregation/ConvexHullAggregation.java | 1 + .../geospatial/TestBingTileFunctions.java | 2 +- .../plugin/geospatial/TestSpatialJoins.java | 4 +- .../AbstractTestGeoAggregationFunctions.java | 11 +++-- .../aggregation/TestGeometryStateFactory.java | 1 + .../TestGeometryStateSerializer.java | 1 + .../TestGeometryUnionGeoAggregation.java | 3 +- .../metastore/glue/GlueHiveMetastore.java | 2 + .../metastore/thrift/ThriftMetastoreUtil.java | 1 + .../glue/TestingMetastoreObjects.java | 6 +-- .../predicate/TestParquetPredicateUtils.java | 4 +- .../presto/jdbc/TestJdbcWarnings.java | 7 +-- .../presto/kudu/KuduRecordCursor.java | 3 +- .../facebook/presto/cost/StatsCalculator.java | 3 +- .../execution/warnings/WarningCollector.java | 3 +- .../presto/memory/DefaultQueryContext.java | 1 + .../presto/operator/JoinOperatorInfo.java | 4 +- .../operator/JoinStatisticsCounter.java | 4 +- .../operator/LookupJoinPageBuilder.java | 2 +- .../operator/PagesSpatialIndexFactory.java | 2 +- .../operator/ParametricImplementation.java | 1 + .../ParametricImplementationsGroup.java | 1 + .../com/facebook/presto/operator/Work.java | 1 + ...stractGroupCollectionAggregationState.java | 1 + .../aggregation/AccumulatorCompiler.java | 4 +- .../AggregationImplementation.java | 4 +- .../aggregation/RealAverageAggregation.java | 16 +++---- .../HistogramGroupImplementation.java | 3 +- .../aggregation/histogram/HistogramState.java | 1 + .../operator/scalar/MapZipWithFunction.java | 4 +- .../scalar/ScalarFunctionImplementation.java | 4 +- .../presto/server/protocol/Query.java | 3 +- .../server/remotetask/HttpRemoteTask.java | 12 ++--- .../planner/GroupingOperationRewriter.java | 11 ++--- .../presto/sql/planner/QueryPlanner.java | 4 +- .../presto/sql/planner/iterative/Lookup.java | 2 +- .../iterative/rule/ExtractSpatialJoins.java | 13 ++--- .../iterative/rule/GatherAndMergeWindows.java | 13 ++--- .../TransformCorrelatedScalarSubquery.java | 3 +- .../optimizations/AddLocalExchanges.java | 10 ++-- .../HashGenerationOptimizer.java | 4 +- .../optimizations/PlanNodeSearcher.java | 2 +- .../presto/testing/TestingEnvironment.java | 1 + .../presto/type/IpAddressOperators.java | 9 ++-- .../com/facebook/presto/util/Mergeable.java | 1 + .../presto/util/SpatialJoinUtils.java | 4 +- .../presto/block/AbstractTestBlock.java | 1 + .../presto/block/ColumnarTestUtils.java | 1 + .../presto/execution/TestPlannerWarnings.java | 1 + .../presto/execution/TestSetPathTask.java | 10 ++-- .../execution/TestSqlTaskExecution.java | 2 + .../metadata/TestFunctionInvokerProvider.java | 28 +++++++---- .../TestInformationSchemaMetadata.java | 14 +++--- .../operator/TestHashAggregationOperator.java | 20 ++++---- .../BenchmarkGroupedTypedHistogram.java | 6 +-- .../presto/split/MockSplitSource.java | 1 + .../presto/sql/analyzer/TestAnalyzer.java | 28 +++++------ .../TestLambdaCaptureDesugaringRewriter.java | 16 +++---- .../TestPruneCountAggregationOverScalar.java | 4 +- .../memory/context/LocalMemoryContext.java | 1 + .../context/MemoryReservationHandler.java | 1 + .../memory/context/MemoryTrackingContext.java | 8 ++-- .../com/facebook/presto/orc/OrcEncoding.java | 1 + .../presto/orc/OrcWriteValidation.java | 11 +++-- .../reader/SliceDictionaryStreamReader.java | 8 ++-- .../presto/orc/reader/StructStreamReader.java | 3 +- .../writer/SliceDictionaryColumnWriter.java | 3 +- .../com/facebook/presto/orc/OrcTester.java | 3 +- .../presto/orc/TestStructStreamReader.java | 48 +++++++++++++------ .../orc/metadata/TestDwrfMetadataReader.java | 20 ++++---- .../presto/orc/stream/TestLongDecode.java | 3 +- .../facebook/presto/sql/tree/CurrentPath.java | 1 + .../facebook/presto/sql/tree/CurrentUser.java | 1 + .../raptor/metadata/TestRaptorMetadata.java | 4 +- .../organization/TestShardOrganizerUtil.java | 12 ++--- .../TestShardMetadataRecordCursor.java | 32 +++++++------ .../facebook/presto/decoder/RowDecoder.java | 1 - .../presto/spi/ConnectorSplitSource.java | 2 +- .../presto/spi/block/ColumnarRow.java | 2 +- .../facebook/presto/spi/block/MapBlock.java | 2 +- .../spi/connector/ConnectorMetadata.java | 2 + .../presto/spi/function/Convention.java | 2 + .../ResourceGroupConfigurationManager.java | 2 +- .../presto/spi/session/ResourceEstimates.java | 2 +- .../com/facebook/presto/spi/type/MapType.java | 2 +- .../com/facebook/presto/spi/type/RowType.java | 4 +- .../com/facebook/presto/spi/type/Type.java | 2 +- .../BenchmarkInformationSchema.java | 9 ++-- .../presto/tests/TestMetadataManager.java | 3 +- 97 files changed, 327 insertions(+), 245 deletions(-) diff --git a/presto-base-jdbc/src/test/java/com/facebook/presto/plugin/jdbc/TestJdbcMetadata.java b/presto-base-jdbc/src/test/java/com/facebook/presto/plugin/jdbc/TestJdbcMetadata.java index b95f5466b06f..4ba63d9589ef 100644 --- a/presto-base-jdbc/src/test/java/com/facebook/presto/plugin/jdbc/TestJdbcMetadata.java +++ b/presto-base-jdbc/src/test/java/com/facebook/presto/plugin/jdbc/TestJdbcMetadata.java @@ -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); } diff --git a/presto-cassandra/src/main/java/com/facebook/presto/cassandra/CassandraSession.java b/presto-cassandra/src/main/java/com/facebook/presto/cassandra/CassandraSession.java index 2e515e45b541..214a0d0787b2 100644 --- a/presto-cassandra/src/main/java/com/facebook/presto/cassandra/CassandraSession.java +++ b/presto-cassandra/src/main/java/com/facebook/presto/cassandra/CassandraSession.java @@ -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 getPartitions(CassandraTable table, List> filterPrefix); diff --git a/presto-cli/src/test/java/com/facebook/presto/cli/TestConsoleHistory.java b/presto-cli/src/test/java/com/facebook/presto/cli/TestConsoleHistory.java index 3df31594852e..2a9f3e3eed9a 100644 --- a/presto-cli/src/test/java/com/facebook/presto/cli/TestConsoleHistory.java +++ b/presto-cli/src/test/java/com/facebook/presto/cli/TestConsoleHistory.java @@ -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"); diff --git a/presto-example-http/src/test/java/com/facebook/presto/example/TestExampleMetadata.java b/presto-example-http/src/test/java/com/facebook/presto/example/TestExampleMetadata.java index 09bb1ffeeaf8..4ca7e7343116 100644 --- a/presto-example-http/src/test/java/com/facebook/presto/example/TestExampleMetadata.java +++ b/presto-example-http/src/test/java/com/facebook/presto/example/TestExampleMetadata.java @@ -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); } diff --git a/presto-geospatial-toolkit/src/main/java/com/facebook/presto/geospatial/GeometryUtils.java b/presto-geospatial-toolkit/src/main/java/com/facebook/presto/geospatial/GeometryUtils.java index a48f06c0ce7e..066e1dbbcef7 100644 --- a/presto-geospatial-toolkit/src/main/java/com/facebook/presto/geospatial/GeometryUtils.java +++ b/presto-geospatial-toolkit/src/main/java/com/facebook/presto/geospatial/GeometryUtils.java @@ -33,7 +33,7 @@ private GeometryUtils() {} /** * Copy of com.esri.core.geometry.Interop.translateFromAVNaN - * + *

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

* JtsGeometrySerde#serialize must serialize NaN's the same way ESRI library does to achieve binary compatibility */ public static double translateToAVNaN(double n) diff --git a/presto-geospatial/src/main/java/com/facebook/presto/plugin/geospatial/BingTile.java b/presto-geospatial/src/main/java/com/facebook/presto/plugin/geospatial/BingTile.java index 986cffb6e11b..2d098271f633 100644 --- a/presto-geospatial/src/main/java/com/facebook/presto/plugin/geospatial/BingTile.java +++ b/presto-geospatial/src/main/java/com/facebook/presto/plugin/geospatial/BingTile.java @@ -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 @@ -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 diff --git a/presto-geospatial/src/main/java/com/facebook/presto/plugin/geospatial/BingTileFunctions.java b/presto-geospatial/src/main/java/com/facebook/presto/plugin/geospatial/BingTileFunctions.java index 088423968c87..c23877cb03c9 100644 --- a/presto-geospatial/src/main/java/com/facebook/presto/plugin/geospatial/BingTileFunctions.java +++ b/presto-geospatial/src/main/java/com/facebook/presto/plugin/geospatial/BingTileFunctions.java @@ -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 { diff --git a/presto-geospatial/src/main/java/com/facebook/presto/plugin/geospatial/GeoFunctions.java b/presto-geospatial/src/main/java/com/facebook/presto/plugin/geospatial/GeoFunctions.java index 37fe54097f32..de56cb48094e 100644 --- a/presto-geospatial/src/main/java/com/facebook/presto/plugin/geospatial/GeoFunctions.java +++ b/presto-geospatial/src/main/java/com/facebook/presto/plugin/geospatial/GeoFunctions.java @@ -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"); @@ -1413,7 +1412,8 @@ private interface EnvelopesPredicate private static Iterable getGeometrySlicesFromBlock(Block block) { requireNonNull(block, "block is null"); - return () -> new Iterator() { + return () -> new Iterator() + { private int iteratorPosition; @Override diff --git a/presto-geospatial/src/main/java/com/facebook/presto/plugin/geospatial/aggregation/ConvexHullAggregation.java b/presto-geospatial/src/main/java/com/facebook/presto/plugin/geospatial/aggregation/ConvexHullAggregation.java index b4e18a8ce877..4e90d076885f 100644 --- a/presto-geospatial/src/main/java/com/facebook/presto/plugin/geospatial/aggregation/ConvexHullAggregation.java +++ b/presto-geospatial/src/main/java/com/facebook/presto/plugin/geospatial/aggregation/ConvexHullAggregation.java @@ -44,6 +44,7 @@ public class ConvexHullAggregation { private static final Joiner OR_JOINER = Joiner.on(" or "); + private ConvexHullAggregation() {} @InputFunction diff --git a/presto-geospatial/src/test/java/com/facebook/presto/plugin/geospatial/TestBingTileFunctions.java b/presto-geospatial/src/test/java/com/facebook/presto/plugin/geospatial/TestBingTileFunctions.java index 7db745095b43..61bd55955100 100644 --- a/presto-geospatial/src/test/java/com/facebook/presto/plugin/geospatial/TestBingTileFunctions.java +++ b/presto-geospatial/src/test/java/com/facebook/presto/plugin/geospatial/TestBingTileFunctions.java @@ -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))", diff --git a/presto-geospatial/src/test/java/com/facebook/presto/plugin/geospatial/TestSpatialJoins.java b/presto-geospatial/src/test/java/com/facebook/presto/plugin/geospatial/TestSpatialJoins.java index 56f3c6cdf466..af372d5999a0 100644 --- a/presto-geospatial/src/test/java/com/facebook/presto/plugin/geospatial/TestSpatialJoins.java +++ b/presto-geospatial/src/test/java/com/facebook/presto/plugin/geospatial/TestSpatialJoins.java @@ -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 diff --git a/presto-geospatial/src/test/java/com/facebook/presto/plugin/geospatial/aggregation/AbstractTestGeoAggregationFunctions.java b/presto-geospatial/src/test/java/com/facebook/presto/plugin/geospatial/aggregation/AbstractTestGeoAggregationFunctions.java index 515135d397cf..80a303d74512 100644 --- a/presto-geospatial/src/test/java/com/facebook/presto/plugin/geospatial/aggregation/AbstractTestGeoAggregationFunctions.java +++ b/presto-geospatial/src/test/java/com/facebook/presto/plugin/geospatial/aggregation/AbstractTestGeoAggregationFunctions.java @@ -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; @@ -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 @@ -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) diff --git a/presto-geospatial/src/test/java/com/facebook/presto/plugin/geospatial/aggregation/TestGeometryStateFactory.java b/presto-geospatial/src/test/java/com/facebook/presto/plugin/geospatial/aggregation/TestGeometryStateFactory.java index 30d702126029..b8a6756b43b9 100644 --- a/presto-geospatial/src/test/java/com/facebook/presto/plugin/geospatial/aggregation/TestGeometryStateFactory.java +++ b/presto-geospatial/src/test/java/com/facebook/presto/plugin/geospatial/aggregation/TestGeometryStateFactory.java @@ -31,6 +31,7 @@ public void init() { factory = new GeometryStateFactory(); } + @Test public void testCreateSingleStateEmpty() { diff --git a/presto-geospatial/src/test/java/com/facebook/presto/plugin/geospatial/aggregation/TestGeometryStateSerializer.java b/presto-geospatial/src/test/java/com/facebook/presto/plugin/geospatial/aggregation/TestGeometryStateSerializer.java index 2332ca99ed85..f296412586d4 100644 --- a/presto-geospatial/src/test/java/com/facebook/presto/plugin/geospatial/aggregation/TestGeometryStateSerializer.java +++ b/presto-geospatial/src/test/java/com/facebook/presto/plugin/geospatial/aggregation/TestGeometryStateSerializer.java @@ -48,6 +48,7 @@ public void testSerializeDeserialize() assertEquals(state.getGeometry().asText(), "POINT (1 2)"); } + @Test public void testSerializeDeserializeGrouped() { diff --git a/presto-geospatial/src/test/java/com/facebook/presto/plugin/geospatial/aggregation/TestGeometryUnionGeoAggregation.java b/presto-geospatial/src/test/java/com/facebook/presto/plugin/geospatial/aggregation/TestGeometryUnionGeoAggregation.java index ea184b3ae4fe..f396eba5988b 100644 --- a/presto-geospatial/src/test/java/com/facebook/presto/plugin/geospatial/aggregation/TestGeometryUnionGeoAggregation.java +++ b/presto-geospatial/src/test/java/com/facebook/presto/plugin/geospatial/aggregation/TestGeometryUnionGeoAggregation.java @@ -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", diff --git a/presto-hive/src/main/java/com/facebook/presto/hive/metastore/glue/GlueHiveMetastore.java b/presto-hive/src/main/java/com/facebook/presto/hive/metastore/glue/GlueHiveMetastore.java index 6b656dc0c9e1..eb16d57deff1 100644 --- a/presto-hive/src/main/java/com/facebook/presto/hive/metastore/glue/GlueHiveMetastore.java +++ b/presto-hive/src/main/java/com/facebook/presto/hive/metastore/glue/GlueHiveMetastore.java @@ -587,6 +587,7 @@ public Optional> getPartitionNames(String databaseName, String tabl * ['1','2','3'] or * ['', '2', ''] * + * * @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. */ @@ -636,6 +637,7 @@ private static List buildPartitionNames(List partitionColumns, L * Ex: Partition keys = ['a', 'b'] * Partition names = ['a=1/b=2', 'a=2/b=2'] * + * * @param partitionNames List of full partition names * @return Mapping of partition name to partition object */ diff --git a/presto-hive/src/main/java/com/facebook/presto/hive/metastore/thrift/ThriftMetastoreUtil.java b/presto-hive/src/main/java/com/facebook/presto/hive/metastore/thrift/ThriftMetastoreUtil.java index 8923bd168f98..5f37700e801c 100644 --- a/presto-hive/src/main/java/com/facebook/presto/hive/metastore/thrift/ThriftMetastoreUtil.java +++ b/presto-hive/src/main/java/com/facebook/presto/hive/metastore/thrift/ThriftMetastoreUtil.java @@ -403,6 +403,7 @@ public static Optional fromMetastoreDate(Date date) /** * Impala `COMPUTE STATS` will write -1 as the null count. + * * @see IMPALA-7497 */ public static OptionalLong fromMetastoreNullsCount(long nullsCount) diff --git a/presto-hive/src/test/java/com/facebook/presto/hive/metastore/glue/TestingMetastoreObjects.java b/presto-hive/src/test/java/com/facebook/presto/hive/metastore/glue/TestingMetastoreObjects.java index ee13635e75a1..2bbbd6df7e37 100644 --- a/presto-hive/src/test/java/com/facebook/presto/hive/metastore/glue/TestingMetastoreObjects.java +++ b/presto-hive/src/test/java/com/facebook/presto/hive/metastore/glue/TestingMetastoreObjects.java @@ -141,9 +141,9 @@ public static com.facebook.presto.hive.metastore.Column getPrestoTestColumn() private static final Consumer 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() diff --git a/presto-hive/src/test/java/com/facebook/presto/hive/parquet/predicate/TestParquetPredicateUtils.java b/presto-hive/src/test/java/com/facebook/presto/hive/parquet/predicate/TestParquetPredicateUtils.java index f5baa47dfd63..43bf04e5e3be 100644 --- a/presto-hive/src/test/java/com/facebook/presto/hive/parquet/predicate/TestParquetPredicateUtils.java +++ b/presto-hive/src/test/java/com/facebook/presto/hive/parquet/predicate/TestParquetPredicateUtils.java @@ -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, RichColumnDescriptor> descriptorsByPath = getDescriptors(fileSchema, fileSchema); TupleDomain tupleDomain = getParquetTupleDomain(descriptorsByPath, domain); diff --git a/presto-jdbc/src/test/java/com/facebook/presto/jdbc/TestJdbcWarnings.java b/presto-jdbc/src/test/java/com/facebook/presto/jdbc/TestJdbcWarnings.java index 16bf7dd36eb5..2670c872f940 100644 --- a/presto-jdbc/src/test/java/com/facebook/presto/jdbc/TestJdbcWarnings.java +++ b/presto-jdbc/src/test/java/com/facebook/presto/jdbc/TestJdbcWarnings.java @@ -75,9 +75,9 @@ public void setupServer() server = new TestingPrestoServer( true, ImmutableMap.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(), @@ -110,6 +110,7 @@ public void teardown() closeQuietly(statement); closeQuietly(connection); } + @Test public void testStatementWarnings() throws SQLException diff --git a/presto-kudu/src/main/java/com/facebook/presto/kudu/KuduRecordCursor.java b/presto-kudu/src/main/java/com/facebook/presto/kudu/KuduRecordCursor.java index 7aba97f42665..df29f070f06f 100755 --- a/presto-kudu/src/main/java/com/facebook/presto/kudu/KuduRecordCursor.java +++ b/presto-kudu/src/main/java/com/facebook/presto/kudu/KuduRecordCursor.java @@ -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) { diff --git a/presto-main/src/main/java/com/facebook/presto/cost/StatsCalculator.java b/presto-main/src/main/java/com/facebook/presto/cost/StatsCalculator.java index 6486475f3044..0f58ab0bbf94 100644 --- a/presto-main/src/main/java/com/facebook/presto/cost/StatsCalculator.java +++ b/presto-main/src/main/java/com/facebook/presto/cost/StatsCalculator.java @@ -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 diff --git a/presto-main/src/main/java/com/facebook/presto/execution/warnings/WarningCollector.java b/presto-main/src/main/java/com/facebook/presto/execution/warnings/WarningCollector.java index b6e072fee783..ce69b66fb64d 100644 --- a/presto-main/src/main/java/com/facebook/presto/execution/warnings/WarningCollector.java +++ b/presto-main/src/main/java/com/facebook/presto/execution/warnings/WarningCollector.java @@ -21,7 +21,8 @@ public interface WarningCollector { WarningCollector NOOP = - new WarningCollector() { + new WarningCollector() + { @Override public void add(PrestoWarning warning) {} diff --git a/presto-main/src/main/java/com/facebook/presto/memory/DefaultQueryContext.java b/presto-main/src/main/java/com/facebook/presto/memory/DefaultQueryContext.java index 4f0e4d5102bb..1f11601a5eb4 100644 --- a/presto-main/src/main/java/com/facebook/presto/memory/DefaultQueryContext.java +++ b/presto-main/src/main/java/com/facebook/presto/memory/DefaultQueryContext.java @@ -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) diff --git a/presto-main/src/main/java/com/facebook/presto/operator/JoinOperatorInfo.java b/presto-main/src/main/java/com/facebook/presto/operator/JoinOperatorInfo.java index 91b5777b9c9d..913b5ba6f771 100644 --- a/presto-main/src/main/java/com/facebook/presto/operator/JoinOperatorInfo.java +++ b/presto-main/src/main/java/com/facebook/presto/operator/JoinOperatorInfo.java @@ -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 getLookupSourcePositions() { diff --git a/presto-main/src/main/java/com/facebook/presto/operator/JoinStatisticsCounter.java b/presto-main/src/main/java/com/facebook/presto/operator/JoinStatisticsCounter.java index 5ae226eab355..9169e28d23d6 100644 --- a/presto-main/src/main/java/com/facebook/presto/operator/JoinStatisticsCounter.java +++ b/presto-main/src/main/java/com/facebook/presto/operator/JoinStatisticsCounter.java @@ -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 lookupSourcePositions = Optional.empty(); public JoinStatisticsCounter(JoinType joinType) diff --git a/presto-main/src/main/java/com/facebook/presto/operator/LookupJoinPageBuilder.java b/presto-main/src/main/java/com/facebook/presto/operator/LookupJoinPageBuilder.java index d0aeba9fa0b0..e03fc938e190 100644 --- a/presto-main/src/main/java/com/facebook/presto/operator/LookupJoinPageBuilder.java +++ b/presto-main/src/main/java/com/facebook/presto/operator/LookupJoinPageBuilder.java @@ -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. - * + *

* TODO use dictionary blocks (probably extended kind) to avoid data copying for build side */ public class LookupJoinPageBuilder diff --git a/presto-main/src/main/java/com/facebook/presto/operator/PagesSpatialIndexFactory.java b/presto-main/src/main/java/com/facebook/presto/operator/PagesSpatialIndexFactory.java index afd4138121c9..f824e8dd2533 100644 --- a/presto-main/src/main/java/com/facebook/presto/operator/PagesSpatialIndexFactory.java +++ b/presto-main/src/main/java/com/facebook/presto/operator/PagesSpatialIndexFactory.java @@ -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. - * + *

* Returns a Future that completes once all the {@link SpatialJoinOperator}s have completed. */ public ListenableFuture lendPagesSpatialIndex(Supplier pagesSpatialIndex) diff --git a/presto-main/src/main/java/com/facebook/presto/operator/ParametricImplementation.java b/presto-main/src/main/java/com/facebook/presto/operator/ParametricImplementation.java index 70b1e17910fa..9096469172c8 100644 --- a/presto-main/src/main/java/com/facebook/presto/operator/ParametricImplementation.java +++ b/presto-main/src/main/java/com/facebook/presto/operator/ParametricImplementation.java @@ -18,5 +18,6 @@ public interface ParametricImplementation { Signature getSignature(); + boolean hasSpecializedTypeParameters(); } diff --git a/presto-main/src/main/java/com/facebook/presto/operator/ParametricImplementationsGroup.java b/presto-main/src/main/java/com/facebook/presto/operator/ParametricImplementationsGroup.java index 77827e95e62c..08cb36ad7435 100644 --- a/presto-main/src/main/java/com/facebook/presto/operator/ParametricImplementationsGroup.java +++ b/presto-main/src/main/java/com/facebook/presto/operator/ParametricImplementationsGroup.java @@ -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 type of implementation details */ public class ParametricImplementationsGroup diff --git a/presto-main/src/main/java/com/facebook/presto/operator/Work.java b/presto-main/src/main/java/com/facebook/presto/operator/Work.java index b9637dc3b238..40da0f2a88b3 100644 --- a/presto-main/src/main/java/com/facebook/presto/operator/Work.java +++ b/presto-main/src/main/java/com/facebook/presto/operator/Work.java @@ -22,6 +22,7 @@ public interface Work /** * 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(); diff --git a/presto-main/src/main/java/com/facebook/presto/operator/aggregation/AbstractGroupCollectionAggregationState.java b/presto-main/src/main/java/com/facebook/presto/operator/aggregation/AbstractGroupCollectionAggregationState.java index a76fcd6cbd50..095fb14a52f7 100644 --- a/presto-main/src/main/java/com/facebook/presto/operator/aggregation/AbstractGroupCollectionAggregationState.java +++ b/presto-main/src/main/java/com/facebook/presto/operator/aggregation/AbstractGroupCollectionAggregationState.java @@ -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. */ diff --git a/presto-main/src/main/java/com/facebook/presto/operator/aggregation/AccumulatorCompiler.java b/presto-main/src/main/java/com/facebook/presto/operator/aggregation/AccumulatorCompiler.java index b755a4c36f55..70f4186ede7f 100644 --- a/presto-main/src/main/java/com/facebook/presto/operator/aggregation/AccumulatorCompiler.java +++ b/presto-main/src/main/java/com/facebook/presto/operator/aggregation/AccumulatorCompiler.java @@ -148,8 +148,8 @@ private static Class generateAccumulatorClass( definition, callSiteBinder, stateDescriptors.stream() - .map(stateDescriptor -> stateDescriptor.getSerializer().getSerializedType()) - .collect(toImmutableList())); + .map(stateDescriptor -> stateDescriptor.getSerializer().getSerializedType()) + .collect(toImmutableList())); generateGetFinalType(definition, callSiteBinder, metadata.getOutputType()); diff --git a/presto-main/src/main/java/com/facebook/presto/operator/aggregation/AggregationImplementation.java b/presto-main/src/main/java/com/facebook/presto/operator/aggregation/AggregationImplementation.java index 801b507e112a..089527237f35 100644 --- a/presto-main/src/main/java/com/facebook/presto/operator/aggregation/AggregationImplementation.java +++ b/presto-main/src/main/java/com/facebook/presto/operator/aggregation/AggregationImplementation.java @@ -442,8 +442,8 @@ public List parseImplementationDependencies(Method inp inputFunction, annotation, typeParameters.stream() - .map(TypeParameter::value) - .collect(toImmutableSet()), + .map(TypeParameter::value) + .collect(toImmutableSet()), literalParameters); builder.add(createDependency(annotation, literalParameters)); }); diff --git a/presto-main/src/main/java/com/facebook/presto/operator/aggregation/RealAverageAggregation.java b/presto-main/src/main/java/com/facebook/presto/operator/aggregation/RealAverageAggregation.java index 567693c48b7e..c991205f61a6 100644 --- a/presto-main/src/main/java/com/facebook/presto/operator/aggregation/RealAverageAggregation.java +++ b/presto-main/src/main/java/com/facebook/presto/operator/aggregation/RealAverageAggregation.java @@ -85,14 +85,14 @@ public InternalAggregationFunction specialize(BoundVariables boundVariables, int COMBINE_FUNCTION, OUTPUT_FUNCTION, ImmutableList.of( - new AccumulatorStateDescriptor( - longStateInterface, - longStateSerializer, - StateCompiler.generateStateFactory(longStateInterface, classLoader)), - new AccumulatorStateDescriptor( - doubleStateInterface, - doubleStateSerializer, - StateCompiler.generateStateFactory(doubleStateInterface, classLoader))), + new AccumulatorStateDescriptor( + longStateInterface, + longStateSerializer, + StateCompiler.generateStateFactory(longStateInterface, classLoader)), + new AccumulatorStateDescriptor( + doubleStateInterface, + doubleStateSerializer, + StateCompiler.generateStateFactory(doubleStateInterface, classLoader))), REAL); GenericAccumulatorFactoryBinder factory = AccumulatorCompiler.generateAccumulatorFactoryBinder(metadata, classLoader); diff --git a/presto-main/src/main/java/com/facebook/presto/operator/aggregation/histogram/HistogramGroupImplementation.java b/presto-main/src/main/java/com/facebook/presto/operator/aggregation/histogram/HistogramGroupImplementation.java index b2039b17f94d..7af33df10e48 100644 --- a/presto-main/src/main/java/com/facebook/presto/operator/aggregation/histogram/HistogramGroupImplementation.java +++ b/presto-main/src/main/java/com/facebook/presto/operator/aggregation/histogram/HistogramGroupImplementation.java @@ -15,6 +15,5 @@ public enum HistogramGroupImplementation { - LEGACY, - NEW,; + LEGACY, NEW } diff --git a/presto-main/src/main/java/com/facebook/presto/operator/aggregation/histogram/HistogramState.java b/presto-main/src/main/java/com/facebook/presto/operator/aggregation/histogram/HistogramState.java index 24597d745718..8fdc6db11db9 100644 --- a/presto-main/src/main/java/com/facebook/presto/operator/aggregation/histogram/HistogramState.java +++ b/presto-main/src/main/java/com/facebook/presto/operator/aggregation/histogram/HistogramState.java @@ -24,6 +24,7 @@ public interface HistogramState { /** * will create an empty histogram if none exists + * * @return histogram based on the type of state (single, grouped). Note that empty histograms will serialize to null as required */ TypedHistogram get(); diff --git a/presto-main/src/main/java/com/facebook/presto/operator/scalar/MapZipWithFunction.java b/presto-main/src/main/java/com/facebook/presto/operator/scalar/MapZipWithFunction.java index 19595ca73dfa..072d27e14ab7 100644 --- a/presto-main/src/main/java/com/facebook/presto/operator/scalar/MapZipWithFunction.java +++ b/presto-main/src/main/java/com/facebook/presto/operator/scalar/MapZipWithFunction.java @@ -91,8 +91,8 @@ public ScalarFunctionImplementation specialize(BoundVariables boundVariables, in Type outputMapType = typeManager.getParameterizedType( StandardTypes.MAP, ImmutableList.of( - TypeSignatureParameter.of(keyType.getTypeSignature()), - TypeSignatureParameter.of(outputValueType.getTypeSignature()))); + TypeSignatureParameter.of(keyType.getTypeSignature()), + TypeSignatureParameter.of(outputValueType.getTypeSignature()))); return new ScalarFunctionImplementation( false, ImmutableList.of( diff --git a/presto-main/src/main/java/com/facebook/presto/operator/scalar/ScalarFunctionImplementation.java b/presto-main/src/main/java/com/facebook/presto/operator/scalar/ScalarFunctionImplementation.java index 164618bc746c..876b31b7205e 100644 --- a/presto-main/src/main/java/com/facebook/presto/operator/scalar/ScalarFunctionImplementation.java +++ b/presto-main/src/main/java/com/facebook/presto/operator/scalar/ScalarFunctionImplementation.java @@ -54,7 +54,7 @@ public ScalarFunctionImplementation( Optional instanceFactory, boolean deterministic) { - this (ImmutableList.of(new ScalarImplementationChoice(nullable, argumentProperties, methodHandle, instanceFactory)), deterministic); + this(ImmutableList.of(new ScalarImplementationChoice(nullable, argumentProperties, methodHandle, instanceFactory)), deterministic); } /** @@ -64,7 +64,7 @@ public ScalarFunctionImplementation( * The first choice is the default choice, which is the one used for legacy access methods. * The default choice must be usable under any context. (e.g. it must not use BLOCK_POSITION convention.) * - * @param choices the list of choices, ordered from generic to specific + * @param choices the list of choices, ordered from generic to specific */ public ScalarFunctionImplementation(List choices, boolean deterministic) { diff --git a/presto-main/src/main/java/com/facebook/presto/server/protocol/Query.java b/presto-main/src/main/java/com/facebook/presto/server/protocol/Query.java index b2407777c1a8..deca10a65730 100644 --- a/presto-main/src/main/java/com/facebook/presto/server/protocol/Query.java +++ b/presto-main/src/main/java/com/facebook/presto/server/protocol/Query.java @@ -728,7 +728,8 @@ private synchronized void submitQuery() } querySubmissionFuture = queryManager.createQuery(queryId, sessionContext, this.query); - Futures.addCallback(querySubmissionFuture, new FutureCallback() { + Futures.addCallback(querySubmissionFuture, new FutureCallback() + { @Override public void onSuccess(Object result) { diff --git a/presto-main/src/main/java/com/facebook/presto/server/remotetask/HttpRemoteTask.java b/presto-main/src/main/java/com/facebook/presto/server/remotetask/HttpRemoteTask.java index c1a146a24e4d..a80348e4ad30 100644 --- a/presto-main/src/main/java/com/facebook/presto/server/remotetask/HttpRemoteTask.java +++ b/presto-main/src/main/java/com/facebook/presto/server/remotetask/HttpRemoteTask.java @@ -726,12 +726,12 @@ private HttpUriBuilder getHttpUriBuilder(TaskStatus taskStatus) private static Backoff createCleanupBackoff() { return new Backoff(10, new Duration(10, TimeUnit.MINUTES), Ticker.systemTicker(), ImmutableList.builder() - .add(new Duration(0, MILLISECONDS)) - .add(new Duration(100, MILLISECONDS)) - .add(new Duration(500, MILLISECONDS)) - .add(new Duration(1, SECONDS)) - .add(new Duration(10, SECONDS)) - .build()); + .add(new Duration(0, MILLISECONDS)) + .add(new Duration(100, MILLISECONDS)) + .add(new Duration(500, MILLISECONDS)) + .add(new Duration(1, SECONDS)) + .add(new Duration(10, SECONDS)) + .build()); } @Override diff --git a/presto-main/src/main/java/com/facebook/presto/sql/planner/GroupingOperationRewriter.java b/presto-main/src/main/java/com/facebook/presto/sql/planner/GroupingOperationRewriter.java index dec2fedb6eae..8ad4290fc2ac 100644 --- a/presto-main/src/main/java/com/facebook/presto/sql/planner/GroupingOperationRewriter.java +++ b/presto-main/src/main/java/com/facebook/presto/sql/planner/GroupingOperationRewriter.java @@ -96,14 +96,13 @@ private static int translateFieldToInteger(FieldId fieldId, RelationId requiredO * grouping and 1 otherwise. For an example, see the SQL documentation for the * function. * - * @param columns The column arguments with which the function was - * invoked converted to ordinals with respect to the base table column - * ordering. + * @param columns The column arguments with which the function was invoked + * converted to ordinals with respect to the base table column ordering. * @param groupingSet A collection containing the ordinals of the - * columns present in the grouping. + * columns present in the grouping. * @return A bit set converted to decimal indicating which columns are present in - * the grouping. If a column is NOT present in the grouping its corresponding - * bit is set to 1 and to 0 if the column is present in the grouping. + * the grouping. If a column is NOT present in the grouping its corresponding + * bit is set to 1 and to 0 if the column is present in the grouping. */ static long calculateGrouping(Set groupingSet, List columns) { diff --git a/presto-main/src/main/java/com/facebook/presto/sql/planner/QueryPlanner.java b/presto-main/src/main/java/com/facebook/presto/sql/planner/QueryPlanner.java index 89820735058f..bc139cd50056 100644 --- a/presto-main/src/main/java/com/facebook/presto/sql/planner/QueryPlanner.java +++ b/presto-main/src/main/java/com/facebook/presto/sql/planner/QueryPlanner.java @@ -498,8 +498,8 @@ private PlanBuilder aggregate(PlanBuilder subPlan, QuerySpecification node) if (node.getGroupBy().get().isDistinct()) { columnOnlyGroupingSets = columnOnlyGroupingSets.stream() - .distinct() - .collect(toImmutableList()); + .distinct() + .collect(toImmutableList()); } // add in the complex expressions an turn materialize the grouping sets in terms of plan columns diff --git a/presto-main/src/main/java/com/facebook/presto/sql/planner/iterative/Lookup.java b/presto-main/src/main/java/com/facebook/presto/sql/planner/iterative/Lookup.java index e410308f08ac..d8acbd0214e8 100644 --- a/presto-main/src/main/java/com/facebook/presto/sql/planner/iterative/Lookup.java +++ b/presto-main/src/main/java/com/facebook/presto/sql/planner/iterative/Lookup.java @@ -43,7 +43,7 @@ default PlanNode resolve(PlanNode node) /** * Resolves nodes by materializing GroupReference nodes * representing symbolic references to other nodes. - *

+ * * @throws IllegalArgumentException if the node is not a GroupReference */ Stream resolveGroup(PlanNode node); diff --git a/presto-main/src/main/java/com/facebook/presto/sql/planner/iterative/rule/ExtractSpatialJoins.java b/presto-main/src/main/java/com/facebook/presto/sql/planner/iterative/rule/ExtractSpatialJoins.java index fd5f2c49bc2a..3f158c9544ad 100644 --- a/presto-main/src/main/java/com/facebook/presto/sql/planner/iterative/rule/ExtractSpatialJoins.java +++ b/presto-main/src/main/java/com/facebook/presto/sql/planner/iterative/rule/ExtractSpatialJoins.java @@ -103,10 +103,10 @@ *

* For example: *

    - *
  • SELECT ... FROM a, b WHERE ST_Contains(b.geometry, a.geometry)
  • - *
  • SELECT ... FROM a, b WHERE ST_Intersects(b.geometry, a.geometry)
  • - *
  • SELECT ... FROM a, b WHERE ST_Distance(b.geometry, a.geometry) <= 300
  • - *
  • SELECT ... FROM a, b WHERE 15.5 > ST_Distance(b.geometry, a.geometry)
  • + *
  • SELECT ... FROM a, b WHERE ST_Contains(b.geometry, a.geometry)
  • + *
  • SELECT ... FROM a, b WHERE ST_Intersects(b.geometry, a.geometry)
  • + *
  • SELECT ... FROM a, b WHERE ST_Distance(b.geometry, a.geometry) <= 300
  • + *
  • SELECT ... FROM a, b WHERE 15.5 > ST_Distance(b.geometry, a.geometry)
  • *
*

* Joins expressed via ST_Contains and ST_Intersects functions must match all of @@ -129,20 +129,21 @@ * arguments and radius into projections on top of join child nodes. *

* Examples: - *

+ *

  * Point-in-polygon inner join
  *      ST_Contains(ST_GeometryFromText(a.wkt), ST_Point(b.longitude, b.latitude))
  * becomes a spatial join
  *      ST_Contains(st_geometryfromtext, st_point)
  * with st_geometryfromtext -> 'ST_GeometryFromText(a.wkt)' and
  * st_point -> 'ST_Point(b.longitude, b.latitude)' projections on top of child nodes.
- * 

+ * * Distance query * ST_Distance(ST_Point(a.lon, a.lat), ST_Point(b.lon, b.lat)) <= 10 / (111.321 * cos(radians(b.lat))) * becomes a spatial join * ST_Distance(st_point_a, st_point_b) <= radius * with st_point_a -> 'ST_Point(a.lon, a.lat)', st_point_b -> 'ST_Point(b.lon, b.lat)' * and radius -> '10 / (111.321 * cos(radians(b.lat)))' projections on top of child nodes. + *

*/ public class ExtractSpatialJoins { diff --git a/presto-main/src/main/java/com/facebook/presto/sql/planner/iterative/rule/GatherAndMergeWindows.java b/presto-main/src/main/java/com/facebook/presto/sql/planner/iterative/rule/GatherAndMergeWindows.java index 73c634a0c5c6..b4aa55db2c23 100644 --- a/presto-main/src/main/java/com/facebook/presto/sql/planner/iterative/rule/GatherAndMergeWindows.java +++ b/presto-main/src/main/java/com/facebook/presto/sql/planner/iterative/rule/GatherAndMergeWindows.java @@ -58,12 +58,12 @@ public static Set> rules() // TODO convert to a pattern that allows for a sequence of ProjectNode, instead // of a canned number, once the pattern system supports it. return IntStream.range(0, 5) - .boxed() - .flatMap(numProjects -> - Stream.of( - new MergeAdjacentWindowsOverProjects(numProjects), - new SwapAdjacentWindowsBySpecifications(numProjects))) - .collect(toImmutableSet()); + .boxed() + .flatMap(numProjects -> + Stream.of( + new MergeAdjacentWindowsOverProjects(numProjects), + new SwapAdjacentWindowsBySpecifications(numProjects))) + .collect(toImmutableSet()); } private abstract static class ManipulateAdjacentWindowsOverProjects @@ -115,6 +115,7 @@ public Result apply(WindowNode parent, Captures captures, Context context) * Looks for the pattern (ProjectNode*)WindowNode, and rewrites it to WindowNode(ProjectNode*), * returning an empty option if it can't rewrite the projects, for example because they rely on * the output of the WindowNode. + * * @param projects the nodes above the target, bottom first. */ protected static Optional pullWindowNodeAboveProjects( diff --git a/presto-main/src/main/java/com/facebook/presto/sql/planner/iterative/rule/TransformCorrelatedScalarSubquery.java b/presto-main/src/main/java/com/facebook/presto/sql/planner/iterative/rule/TransformCorrelatedScalarSubquery.java index 9a7e953400bc..a2363fb0c2fe 100644 --- a/presto-main/src/main/java/com/facebook/presto/sql/planner/iterative/rule/TransformCorrelatedScalarSubquery.java +++ b/presto-main/src/main/java/com/facebook/presto/sql/planner/iterative/rule/TransformCorrelatedScalarSubquery.java @@ -73,8 +73,7 @@ * - non scalar subquery * *

- * - * This must be run after {@link TransformCorrelatedScalarAggregationToJoin} + * This must be run after {@link TransformCorrelatedScalarAggregationToJoin} */ public class TransformCorrelatedScalarSubquery implements Rule diff --git a/presto-main/src/main/java/com/facebook/presto/sql/planner/optimizations/AddLocalExchanges.java b/presto-main/src/main/java/com/facebook/presto/sql/planner/optimizations/AddLocalExchanges.java index ed55f1427e89..74e182db6743 100644 --- a/presto-main/src/main/java/com/facebook/presto/sql/planner/optimizations/AddLocalExchanges.java +++ b/presto-main/src/main/java/com/facebook/presto/sql/planner/optimizations/AddLocalExchanges.java @@ -389,21 +389,21 @@ public PlanWithProperties visitMarkDistinct(MarkDistinctNode node, StreamPreferr /** * Prune redundant distinct symbols to reduce CPU cost of hashing corresponding values and amount of memory * needed to store all the distinct values. - * + *

* Consider the following plan, - * + *

          *  - MarkDistinctNode (unique, c1, c2)
          *      - Join
          *          - AssignUniqueId (unique)
          *              - probe (c1, c2)
          *          - build
-         *
+         * 
* In this case MarkDistinctNode (unique, c1, c2) is equivalent to MarkDistinctNode (unique), * because if two rows match on `unique`, they must match on `c1` and `c2` as well. - * + *

* More generally, any distinct symbol that is functionally dependent on a subset of * other distinct symbols can be dropped. - * + *

* Ideally, this logic would be encapsulated in a separate rule, but currently no rule other * than AddLocalExchanges can reason about local properties. */ diff --git a/presto-main/src/main/java/com/facebook/presto/sql/planner/optimizations/HashGenerationOptimizer.java b/presto-main/src/main/java/com/facebook/presto/sql/planner/optimizations/HashGenerationOptimizer.java index e2d65e5640af..a8ccac5013bd 100644 --- a/presto-main/src/main/java/com/facebook/presto/sql/planner/optimizations/HashGenerationOptimizer.java +++ b/presto-main/src/main/java/com/facebook/presto/sql/planner/optimizations/HashGenerationOptimizer.java @@ -697,8 +697,8 @@ private PlanWithProperties planAndEnforce( .addAll(requiredHashes.getHashes()) .addAll(preferredHashes.getHashes()) .build(); - preferenceSatisfied = resultHashes.containsAll(requiredHashes.getHashes()) - && requiredAndPreferredHashes.containsAll(resultHashes); + preferenceSatisfied = resultHashes.containsAll(requiredHashes.getHashes()) && + requiredAndPreferredHashes.containsAll(resultHashes); } else { preferenceSatisfied = result.getHashSymbols().keySet().containsAll(requiredHashes.getHashes()); diff --git a/presto-main/src/main/java/com/facebook/presto/sql/planner/optimizations/PlanNodeSearcher.java b/presto-main/src/main/java/com/facebook/presto/sql/planner/optimizations/PlanNodeSearcher.java index 2827545f730b..982f0b7ed855 100644 --- a/presto-main/src/main/java/com/facebook/presto/sql/planner/optimizations/PlanNodeSearcher.java +++ b/presto-main/src/main/java/com/facebook/presto/sql/planner/optimizations/PlanNodeSearcher.java @@ -38,7 +38,7 @@ public static PlanNodeSearcher searchFrom(PlanNode node) /** * Use it in optimizer {@link com.facebook.presto.sql.planner.iterative.Rule} only if you truly do not have a better option - * + *

* TODO: replace it with a support for plan (physical) properties in rules pattern matching */ public static PlanNodeSearcher searchFrom(PlanNode node, Lookup lookup) diff --git a/presto-main/src/main/java/com/facebook/presto/testing/TestingEnvironment.java b/presto-main/src/main/java/com/facebook/presto/testing/TestingEnvironment.java index b1df2165899d..91c7ab677838 100644 --- a/presto-main/src/main/java/com/facebook/presto/testing/TestingEnvironment.java +++ b/presto-main/src/main/java/com/facebook/presto/testing/TestingEnvironment.java @@ -24,6 +24,7 @@ public class TestingEnvironment private TestingEnvironment() {} public static final TypeManager TYPE_MANAGER = new TypeRegistry(); + static { // wire TYPE_MANAGER with function registry new FunctionRegistry(TYPE_MANAGER, new BlockEncodingManager(TYPE_MANAGER), new FeaturesConfig()); diff --git a/presto-main/src/main/java/com/facebook/presto/type/IpAddressOperators.java b/presto-main/src/main/java/com/facebook/presto/type/IpAddressOperators.java index e8ffd80c78f9..3e5c31ee2fc2 100644 --- a/presto-main/src/main/java/com/facebook/presto/type/IpAddressOperators.java +++ b/presto-main/src/main/java/com/facebook/presto/type/IpAddressOperators.java @@ -187,10 +187,11 @@ public static Slice castFromIpAddressToVarbinary(@SqlType(StandardTypes.IPADDRES @ScalarOperator(IS_DISTINCT_FROM) @SqlType(StandardTypes.BOOLEAN) - public static boolean isDistinctFrom(@SqlType(StandardTypes.IPADDRESS) Slice left, - @IsNull boolean leftNull, - @SqlType(StandardTypes.IPADDRESS) Slice right, - @IsNull boolean rightNull) + public static boolean isDistinctFrom( + @SqlType(StandardTypes.IPADDRESS) Slice left, + @IsNull boolean leftNull, + @SqlType(StandardTypes.IPADDRESS) Slice right, + @IsNull boolean rightNull) { if (leftNull != rightNull) { return true; diff --git a/presto-main/src/main/java/com/facebook/presto/util/Mergeable.java b/presto-main/src/main/java/com/facebook/presto/util/Mergeable.java index bf904139a731..ea48388def43 100644 --- a/presto-main/src/main/java/com/facebook/presto/util/Mergeable.java +++ b/presto-main/src/main/java/com/facebook/presto/util/Mergeable.java @@ -19,6 +19,7 @@ public interface Mergeable { /** * Merges the current state with the state of the other instance, and returns the merged state. + * * @throws NullPointerException if other is null */ T mergeWith(T other); diff --git a/presto-main/src/main/java/com/facebook/presto/util/SpatialJoinUtils.java b/presto-main/src/main/java/com/facebook/presto/util/SpatialJoinUtils.java index 121c0051da3c..f93038aae0fa 100644 --- a/presto-main/src/main/java/com/facebook/presto/util/SpatialJoinUtils.java +++ b/presto-main/src/main/java/com/facebook/presto/util/SpatialJoinUtils.java @@ -44,7 +44,7 @@ private SpatialJoinUtils() {} * Returns a subset of conjuncts matching one of the following shapes: * - ST_Contains(...) * - ST_Intersects(...) - * + *

* Doesn't check or guarantee anything about function arguments. */ public static List extractSupportedSpatialFunctions(Expression filterExpression) @@ -68,7 +68,7 @@ private static boolean isSupportedSpatialFunction(FunctionCall functionCall) * - ST_Distance(...) < ... * - ... >= ST_Distance(...) * - ... > ST_Distance(...) - * + *

* Doesn't check or guarantee anything about ST_Distance functions arguments * or the other side of the comparison. */ diff --git a/presto-main/src/test/java/com/facebook/presto/block/AbstractTestBlock.java b/presto-main/src/test/java/com/facebook/presto/block/AbstractTestBlock.java index 7381740711ff..cda38e3eb93b 100644 --- a/presto-main/src/test/java/com/facebook/presto/block/AbstractTestBlock.java +++ b/presto-main/src/test/java/com/facebook/presto/block/AbstractTestBlock.java @@ -60,6 +60,7 @@ public abstract class AbstractTestBlock { private static final TypeManager TYPE_MANAGER = new TypeRegistry(); private static final BlockEncodingSerde BLOCK_ENCODING_SERDE = new BlockEncodingManager(TYPE_MANAGER); + static { // associate TYPE_MANAGER with a function registry new FunctionRegistry(TYPE_MANAGER, new BlockEncodingManager(TYPE_MANAGER), new FeaturesConfig()); diff --git a/presto-main/src/test/java/com/facebook/presto/block/ColumnarTestUtils.java b/presto-main/src/test/java/com/facebook/presto/block/ColumnarTestUtils.java index db9ffc80a784..f3d1fbca3a54 100644 --- a/presto-main/src/test/java/com/facebook/presto/block/ColumnarTestUtils.java +++ b/presto-main/src/test/java/com/facebook/presto/block/ColumnarTestUtils.java @@ -35,6 +35,7 @@ final class ColumnarTestUtils { private static final TypeManager TYPE_MANAGER = new TypeRegistry(); private static final BlockEncodingSerde BLOCK_ENCODING_SERDE = new BlockEncodingManager(TYPE_MANAGER); + static { // associate TYPE_MANAGER with a function registry new FunctionRegistry(TYPE_MANAGER, new BlockEncodingManager(TYPE_MANAGER), new FeaturesConfig()); diff --git a/presto-main/src/test/java/com/facebook/presto/execution/TestPlannerWarnings.java b/presto-main/src/test/java/com/facebook/presto/execution/TestPlannerWarnings.java index 5de349814d20..d49d094f2cea 100644 --- a/presto-main/src/test/java/com/facebook/presto/execution/TestPlannerWarnings.java +++ b/presto-main/src/test/java/com/facebook/presto/execution/TestPlannerWarnings.java @@ -125,6 +125,7 @@ private static Plan createPlan(LocalQueryRunner queryRunner, Session session, St return queryRunner.createPlan(session, sql, ImmutableList.of(optimizer), LogicalPlanner.Stage.OPTIMIZED_AND_VALIDATED, warningCollector); } + public static List createTestWarnings(int numberOfWarnings) { checkArgument(numberOfWarnings > 0, "numberOfWarnings must be > 0"); diff --git a/presto-main/src/test/java/com/facebook/presto/execution/TestSetPathTask.java b/presto-main/src/test/java/com/facebook/presto/execution/TestSetPathTask.java index 29a6186387bf..5cc5d0e48340 100644 --- a/presto-main/src/test/java/com/facebook/presto/execution/TestSetPathTask.java +++ b/presto-main/src/test/java/com/facebook/presto/execution/TestSetPathTask.java @@ -82,9 +82,8 @@ public void tearDown() @Test public void testSetPath() { - PathSpecification pathSpecification = new PathSpecification( - Optional.empty(), ImmutableList.of( - new PathElement(Optional.empty(), new Identifier("foo")))); + PathSpecification pathSpecification = new PathSpecification(Optional.empty(), ImmutableList.of( + new PathElement(Optional.empty(), new Identifier("foo")))); QueryStateMachine stateMachine = createQueryStateMachine("SET PATH foo"); executeSetPathTask(pathSpecification, stateMachine); @@ -95,9 +94,8 @@ public void testSetPath() @Test(expectedExceptions = PrestoException.class, expectedExceptionsMessageRegExp = "Catalog does not exist: .*") public void testSetPathInvalidCatalog() { - PathSpecification invalidPathSpecification = new PathSpecification( - Optional.empty(), ImmutableList.of( - new PathElement(Optional.of(new Identifier("invalidCatalog")), new Identifier("thisDoesNotMatter")))); + PathSpecification invalidPathSpecification = new PathSpecification(Optional.empty(), ImmutableList.of( + new PathElement(Optional.of(new Identifier("invalidCatalog")), new Identifier("thisDoesNotMatter")))); QueryStateMachine stateMachine = createQueryStateMachine("SET PATH invalidCatalog.thisDoesNotMatter"); executeSetPathTask(invalidPathSpecification, stateMachine); diff --git a/presto-main/src/test/java/com/facebook/presto/execution/TestSqlTaskExecution.java b/presto-main/src/test/java/com/facebook/presto/execution/TestSqlTaskExecution.java index f2f9c4ea145b..322522753e77 100644 --- a/presto-main/src/test/java/com/facebook/presto/execution/TestSqlTaskExecution.java +++ b/presto-main/src/test/java/com/facebook/presto/execution/TestSqlTaskExecution.java @@ -700,6 +700,8 @@ private ScheduledSplit newScheduledSplit(int sequenceId, PlanNodeId planNodeId, public static class Pauser { private volatile SettableFuture future = SettableFuture.create(); + + public Pauser() { future.set(null); } diff --git a/presto-main/src/test/java/com/facebook/presto/metadata/TestFunctionInvokerProvider.java b/presto-main/src/test/java/com/facebook/presto/metadata/TestFunctionInvokerProvider.java index 5835ac31a619..fef8148f8224 100644 --- a/presto-main/src/test/java/com/facebook/presto/metadata/TestFunctionInvokerProvider.java +++ b/presto-main/src/test/java/com/facebook/presto/metadata/TestFunctionInvokerProvider.java @@ -42,39 +42,51 @@ public class TestFunctionInvokerProvider public void testFunctionInvokerProvider() { assertTrue(checkChoice( - ImmutableList.of(new ArgumentProperty(VALUE_TYPE, Optional.of(USE_BOXED_TYPE), Optional.empty()), new ArgumentProperty(VALUE_TYPE, Optional.of(USE_BOXED_TYPE), Optional.empty())), + ImmutableList.of( + new ArgumentProperty(VALUE_TYPE, Optional.of(USE_BOXED_TYPE), Optional.empty()), + new ArgumentProperty(VALUE_TYPE, Optional.of(USE_BOXED_TYPE), Optional.empty())), true, false, Optional.of(new InvocationConvention(ImmutableList.of(BOXED_NULLABLE, BOXED_NULLABLE), InvocationReturnConvention.NULLABLE_RETURN, false)))); assertTrue(checkChoice( - ImmutableList.of(new ArgumentProperty(VALUE_TYPE, Optional.of(RETURN_NULL_ON_NULL), Optional.empty()), - new ArgumentProperty(VALUE_TYPE, Optional.of(BLOCK_AND_POSITION), Optional.empty()), new ArgumentProperty(VALUE_TYPE, Optional.of(BLOCK_AND_POSITION), Optional.empty())), + ImmutableList.of( + new ArgumentProperty(VALUE_TYPE, Optional.of(RETURN_NULL_ON_NULL), Optional.empty()), + new ArgumentProperty(VALUE_TYPE, Optional.of(BLOCK_AND_POSITION), Optional.empty()), + new ArgumentProperty(VALUE_TYPE, Optional.of(BLOCK_AND_POSITION), Optional.empty())), false, false, Optional.of(new InvocationConvention(ImmutableList.of(NEVER_NULL, BLOCK_POSITION, BLOCK_POSITION), InvocationReturnConvention.FAIL_ON_NULL, false)))); assertTrue(checkChoice( - ImmutableList.of(new ArgumentProperty(VALUE_TYPE, Optional.of(BLOCK_AND_POSITION), Optional.empty()), - new ArgumentProperty(VALUE_TYPE, Optional.of(USE_NULL_FLAG), Optional.empty()), new ArgumentProperty(VALUE_TYPE, Optional.of(BLOCK_AND_POSITION), Optional.empty())), + ImmutableList.of( + new ArgumentProperty(VALUE_TYPE, Optional.of(BLOCK_AND_POSITION), Optional.empty()), + new ArgumentProperty(VALUE_TYPE, Optional.of(USE_NULL_FLAG), Optional.empty()), + new ArgumentProperty(VALUE_TYPE, Optional.of(BLOCK_AND_POSITION), Optional.empty())), false, false, Optional.of(new InvocationConvention(ImmutableList.of(BLOCK_POSITION, NULL_FLAG, BLOCK_POSITION), InvocationReturnConvention.FAIL_ON_NULL, false)))); assertFalse(checkChoice( - ImmutableList.of(new ArgumentProperty(VALUE_TYPE, Optional.of(BLOCK_AND_POSITION), Optional.empty()), new ArgumentProperty(VALUE_TYPE, Optional.of(USE_BOXED_TYPE), Optional.empty())), + ImmutableList.of( + new ArgumentProperty(VALUE_TYPE, Optional.of(BLOCK_AND_POSITION), Optional.empty()), + new ArgumentProperty(VALUE_TYPE, Optional.of(USE_BOXED_TYPE), Optional.empty())), false, false, Optional.of(new InvocationConvention(ImmutableList.of(BLOCK_POSITION, BOXED_NULLABLE), InvocationReturnConvention.NULLABLE_RETURN, false)))); assertFalse(checkChoice( - ImmutableList.of(new ArgumentProperty(VALUE_TYPE, Optional.of(BLOCK_AND_POSITION), Optional.empty()), new ArgumentProperty(VALUE_TYPE, Optional.of(BLOCK_AND_POSITION), Optional.empty())), + ImmutableList.of( + new ArgumentProperty(VALUE_TYPE, Optional.of(BLOCK_AND_POSITION), Optional.empty()), + new ArgumentProperty(VALUE_TYPE, Optional.of(BLOCK_AND_POSITION), Optional.empty())), false, false, Optional.of(new InvocationConvention(ImmutableList.of(BLOCK_POSITION, NULL_FLAG), InvocationReturnConvention.NULLABLE_RETURN, false)))); assertFalse(checkChoice( - ImmutableList.of(new ArgumentProperty(VALUE_TYPE, Optional.of(USE_NULL_FLAG), Optional.empty()), new ArgumentProperty(VALUE_TYPE, Optional.of(USE_BOXED_TYPE), Optional.empty())), + ImmutableList.of( + new ArgumentProperty(VALUE_TYPE, Optional.of(USE_NULL_FLAG), Optional.empty()), + new ArgumentProperty(VALUE_TYPE, Optional.of(USE_BOXED_TYPE), Optional.empty())), true, false, Optional.of(new InvocationConvention(ImmutableList.of(BLOCK_POSITION, BOXED_NULLABLE), InvocationReturnConvention.FAIL_ON_NULL, false)))); diff --git a/presto-main/src/test/java/com/facebook/presto/metadata/TestInformationSchemaMetadata.java b/presto-main/src/test/java/com/facebook/presto/metadata/TestInformationSchemaMetadata.java index 3912252a6613..8cf42157b975 100644 --- a/presto-main/src/test/java/com/facebook/presto/metadata/TestInformationSchemaMetadata.java +++ b/presto-main/src/test/java/com/facebook/presto/metadata/TestInformationSchemaMetadata.java @@ -170,13 +170,13 @@ public void testInformationSchemaPredicatePushdownWithConstraintPredicate() private ConnectorSession createNewSession(TransactionId transactionId) { return testSessionBuilder() - .setCatalog("test_catalog") - .setSchema("information_schema") - .setClientCapabilities(stream(ClientCapabilities.values()) - .map(ClientCapabilities::toString) - .collect(toImmutableSet())) - .setTransactionId(transactionId) - .build() + .setCatalog("test_catalog") + .setSchema("information_schema") + .setClientCapabilities(stream(ClientCapabilities.values()) + .map(ClientCapabilities::toString) + .collect(toImmutableSet())) + .setTransactionId(transactionId) + .build() .toConnectorSession(); } } diff --git a/presto-main/src/test/java/com/facebook/presto/operator/TestHashAggregationOperator.java b/presto-main/src/test/java/com/facebook/presto/operator/TestHashAggregationOperator.java index b1fc1e8d46d6..4cd5631bfaf0 100644 --- a/presto-main/src/test/java/com/facebook/presto/operator/TestHashAggregationOperator.java +++ b/presto-main/src/test/java/com/facebook/presto/operator/TestHashAggregationOperator.java @@ -393,16 +393,16 @@ public void testMemoryReservationYield(Type type) { List input = createPagesWithDistinctHashKeys(type, 6_000, 600); OperatorFactory operatorFactory = new HashAggregationOperatorFactory( - 0, - new PlanNodeId("test"), - ImmutableList.of(type), - ImmutableList.of(0), - ImmutableList.of(), - Step.SINGLE, - ImmutableList.of(COUNT.bind(ImmutableList.of(0), Optional.empty())), - Optional.of(1), - Optional.empty(), - 1, + 0, + new PlanNodeId("test"), + ImmutableList.of(type), + ImmutableList.of(0), + ImmutableList.of(), + Step.SINGLE, + ImmutableList.of(COUNT.bind(ImmutableList.of(0), Optional.empty())), + Optional.of(1), + Optional.empty(), + 1, Optional.of(new DataSize(16, MEGABYTE)), joinCompiler, false); diff --git a/presto-main/src/test/java/com/facebook/presto/operator/aggregation/BenchmarkGroupedTypedHistogram.java b/presto-main/src/test/java/com/facebook/presto/operator/aggregation/BenchmarkGroupedTypedHistogram.java index 428ad578f88e..f4aac9375db1 100644 --- a/presto-main/src/test/java/com/facebook/presto/operator/aggregation/BenchmarkGroupedTypedHistogram.java +++ b/presto-main/src/test/java/com/facebook/presto/operator/aggregation/BenchmarkGroupedTypedHistogram.java @@ -80,7 +80,7 @@ public static class Data private float mainFillRatio; @Param("0.5f") // found slight benefit over 0.75, the canonical starting point private float valueStoreFillRatio; -// these must be manually set in each class now; the mechanism to change and test was removed; the enum was kept in case we want to revisit. Retesting showed linear was superior + // these must be manually set in each class now; the mechanism to change and test was removed; the enum was kept in case we want to revisit. Retesting showed linear was superior // // @Param({"LINEAR", "SUM_OF_COUNT", "SUM_OF_SQUARE"}) // @Param({"LINEAR"}) // found to be best, by about 10-15% // private ProbeType mainProbeTyepe; @@ -192,8 +192,6 @@ public static void main(String[] args) public enum ProbeType { - LINEAR, - SUM_OF_COUNT, - SUM_OF_SQUARE,; + LINEAR, SUM_OF_COUNT, SUM_OF_SQUARE } } diff --git a/presto-main/src/test/java/com/facebook/presto/split/MockSplitSource.java b/presto-main/src/test/java/com/facebook/presto/split/MockSplitSource.java index 6c3366d03853..6d3d379617bb 100644 --- a/presto-main/src/test/java/com/facebook/presto/split/MockSplitSource.java +++ b/presto-main/src/test/java/com/facebook/presto/split/MockSplitSource.java @@ -43,6 +43,7 @@ public class MockSplitSource { private static final Split SPLIT = new Split(new ConnectorId("test"), new ConnectorTransactionHandle() {}, new MockConnectorSplit()); private static final SettableFuture> COMPLETED_FUTURE = SettableFuture.create(); + static { COMPLETED_FUTURE.set(null); } diff --git a/presto-main/src/test/java/com/facebook/presto/sql/analyzer/TestAnalyzer.java b/presto-main/src/test/java/com/facebook/presto/sql/analyzer/TestAnalyzer.java index 1348bf092d21..31b19fd43a5f 100644 --- a/presto-main/src/test/java/com/facebook/presto/sql/analyzer/TestAnalyzer.java +++ b/presto-main/src/test/java/com/facebook/presto/sql/analyzer/TestAnalyzer.java @@ -1505,8 +1505,8 @@ public void setup() catalogManager.registerCatalog(createTestingCatalog(THIRD_CATALOG, THIRD_CONNECTOR_ID)); SchemaTableName table1 = new SchemaTableName("s1", "t1"); - inSetupTransaction(session -> metadata.createTable(session, TPCH_CATALOG, new ConnectorTableMetadata(table1, - ImmutableList.of( + inSetupTransaction(session -> metadata.createTable(session, TPCH_CATALOG, + new ConnectorTableMetadata(table1, ImmutableList.of( new ColumnMetadata("a", BIGINT), new ColumnMetadata("b", BIGINT), new ColumnMetadata("c", BIGINT), @@ -1514,15 +1514,15 @@ public void setup() false)); SchemaTableName table2 = new SchemaTableName("s1", "t2"); - inSetupTransaction(session -> metadata.createTable(session, TPCH_CATALOG, new ConnectorTableMetadata(table2, - ImmutableList.of( + inSetupTransaction(session -> metadata.createTable(session, TPCH_CATALOG, + new ConnectorTableMetadata(table2, ImmutableList.of( new ColumnMetadata("a", BIGINT), new ColumnMetadata("b", BIGINT))), false)); SchemaTableName table3 = new SchemaTableName("s1", "t3"); - inSetupTransaction(session -> metadata.createTable(session, TPCH_CATALOG, new ConnectorTableMetadata(table3, - ImmutableList.of( + inSetupTransaction(session -> metadata.createTable(session, TPCH_CATALOG, + new ConnectorTableMetadata(table3, ImmutableList.of( new ColumnMetadata("a", BIGINT), new ColumnMetadata("b", BIGINT), new ColumnMetadata("x", BIGINT, null, true))), @@ -1530,23 +1530,23 @@ public void setup() // table in different catalog SchemaTableName table4 = new SchemaTableName("s2", "t4"); - inSetupTransaction(session -> metadata.createTable(session, SECOND_CATALOG, new ConnectorTableMetadata(table4, - ImmutableList.of( + inSetupTransaction(session -> metadata.createTable(session, SECOND_CATALOG, + new ConnectorTableMetadata(table4, ImmutableList.of( new ColumnMetadata("a", BIGINT))), false)); // table with a hidden column SchemaTableName table5 = new SchemaTableName("s1", "t5"); - inSetupTransaction(session -> metadata.createTable(session, TPCH_CATALOG, new ConnectorTableMetadata(table5, - ImmutableList.of( + inSetupTransaction(session -> metadata.createTable(session, TPCH_CATALOG, + new ConnectorTableMetadata(table5, ImmutableList.of( new ColumnMetadata("a", BIGINT), new ColumnMetadata("b", BIGINT, null, true))), false)); // table with a varchar column SchemaTableName table6 = new SchemaTableName("s1", "t6"); - inSetupTransaction(session -> metadata.createTable(session, TPCH_CATALOG, new ConnectorTableMetadata(table6, - ImmutableList.of( + inSetupTransaction(session -> metadata.createTable(session, TPCH_CATALOG, + new ConnectorTableMetadata(table6, ImmutableList.of( new ColumnMetadata("a", BIGINT), new ColumnMetadata("b", VARCHAR), new ColumnMetadata("c", BIGINT), @@ -1555,8 +1555,8 @@ public void setup() // table with bigint, double, array of bigints and array of doubles column SchemaTableName table7 = new SchemaTableName("s1", "t7"); - inSetupTransaction(session -> metadata.createTable(session, TPCH_CATALOG, new ConnectorTableMetadata(table7, - ImmutableList.of( + inSetupTransaction(session -> metadata.createTable(session, TPCH_CATALOG, + new ConnectorTableMetadata(table7, ImmutableList.of( new ColumnMetadata("a", BIGINT), new ColumnMetadata("b", DOUBLE), new ColumnMetadata("c", new ArrayType(BIGINT)), diff --git a/presto-main/src/test/java/com/facebook/presto/sql/planner/iterative/rule/TestLambdaCaptureDesugaringRewriter.java b/presto-main/src/test/java/com/facebook/presto/sql/planner/iterative/rule/TestLambdaCaptureDesugaringRewriter.java index 36ec398d2267..acc192a98e57 100644 --- a/presto-main/src/test/java/com/facebook/presto/sql/planner/iterative/rule/TestLambdaCaptureDesugaringRewriter.java +++ b/presto-main/src/test/java/com/facebook/presto/sql/planner/iterative/rule/TestLambdaCaptureDesugaringRewriter.java @@ -42,13 +42,13 @@ public void testRewriteBasicLambda() final SymbolAllocator allocator = new SymbolAllocator(symbols); assertEquals(rewrite(expression("x -> a + x"), allocator.getTypes(), allocator), - new BindExpression( - ImmutableList.of(expression("a")), - new LambdaExpression( - Stream.of("a_0", "x") - .map(Identifier::new) - .map(LambdaArgumentDeclaration::new) - .collect(toList()), - expression("a_0 + x")))); + new BindExpression( + ImmutableList.of(expression("a")), + new LambdaExpression( + Stream.of("a_0", "x") + .map(Identifier::new) + .map(LambdaArgumentDeclaration::new) + .collect(toList()), + expression("a_0 + x")))); } } diff --git a/presto-main/src/test/java/com/facebook/presto/sql/planner/iterative/rule/TestPruneCountAggregationOverScalar.java b/presto-main/src/test/java/com/facebook/presto/sql/planner/iterative/rule/TestPruneCountAggregationOverScalar.java index 0f25bda2e537..b4bcb283c4da 100644 --- a/presto-main/src/test/java/com/facebook/presto/sql/planner/iterative/rule/TestPruneCountAggregationOverScalar.java +++ b/presto-main/src/test/java/com/facebook/presto/sql/planner/iterative/rule/TestPruneCountAggregationOverScalar.java @@ -119,9 +119,9 @@ public void testDoesNotFireOnNestedCountAggregateWithNonEmptyGroupBy() .source( p.aggregation(aggregationBuilder -> { aggregationBuilder - .source(p.tableScan(ImmutableList.of(), ImmutableMap.of())).groupingSets(singleGroupingSet(ImmutableList.of(p.symbol("orderkey")))); + .source(p.tableScan(ImmutableList.of(), ImmutableMap.of())).groupingSets(singleGroupingSet(ImmutableList.of(p.symbol("orderkey")))); aggregationBuilder - .source(p.tableScan(ImmutableList.of(), ImmutableMap.of())); + .source(p.tableScan(ImmutableList.of(), ImmutableMap.of())); })))) .doesNotFire(); } diff --git a/presto-memory-context/src/main/java/com/facebook/presto/memory/context/LocalMemoryContext.java b/presto-memory-context/src/main/java/com/facebook/presto/memory/context/LocalMemoryContext.java index 40fd27d9a947..33fb5a674484 100644 --- a/presto-memory-context/src/main/java/com/facebook/presto/memory/context/LocalMemoryContext.java +++ b/presto-memory-context/src/main/java/com/facebook/presto/memory/context/LocalMemoryContext.java @@ -34,6 +34,7 @@ public interface LocalMemoryContext * This method can return false when there is not enough memory available to satisfy a positive delta allocation * ({@code bytes} is greater than the bytes tracked by this LocalMemoryContext). *

+ * * @return true if the bytes tracked by this LocalMemoryContext can be set to {@code bytes}. */ boolean trySetBytes(long bytes); diff --git a/presto-memory-context/src/main/java/com/facebook/presto/memory/context/MemoryReservationHandler.java b/presto-memory-context/src/main/java/com/facebook/presto/memory/context/MemoryReservationHandler.java index 768bc898daad..9dcab1312f96 100644 --- a/presto-memory-context/src/main/java/com/facebook/presto/memory/context/MemoryReservationHandler.java +++ b/presto-memory-context/src/main/java/com/facebook/presto/memory/context/MemoryReservationHandler.java @@ -24,6 +24,7 @@ public interface MemoryReservationHandler /** * Try reserving the given number of bytes. + * * @return true if reservation is successful, false otherwise. */ boolean tryReserveMemory(String allocationTag, long delta); diff --git a/presto-memory-context/src/main/java/com/facebook/presto/memory/context/MemoryTrackingContext.java b/presto-memory-context/src/main/java/com/facebook/presto/memory/context/MemoryTrackingContext.java index 3d9e756a3dc8..80189a364e43 100644 --- a/presto-memory-context/src/main/java/com/facebook/presto/memory/context/MemoryTrackingContext.java +++ b/presto-memory-context/src/main/java/com/facebook/presto/memory/context/MemoryTrackingContext.java @@ -25,20 +25,20 @@ /** * This class is used to track memory usage at all levels (operator, driver, pipeline, etc.). - * + *

* At every level we have three aggregate and three local memory contexts. The local memory contexts * track the allocations in the current level while the aggregate memory contexts aggregate the memory * allocated by the leaf levels and the current level. - * + *

* The reason we have local memory contexts at every level is that not all the * allocations are done by the leaf levels (e.g., at the pipeline level exchange clients * can do system allocations directly, see the ExchangeOperator, another example is the buffers * doing system allocations at the task context level, etc.). - * + *

* As another example, at the pipeline level there will be system allocations initiated by the operator context * and there will be system allocations initiated by the exchange clients (local allocations). All these system * allocations will be visible in the systemAggregateMemoryContext. - * + *

* To perform local allocations clients should use localUserMemoryContext()/localSystemMemoryContext() * and get a reference to the local memory contexts. Clients can also use updateUserMemory()/tryReserveUserMemory() * to allocate memory (non-local allocations), which will be reflected to all ancestors of this context in the hierarchy. diff --git a/presto-orc/src/main/java/com/facebook/presto/orc/OrcEncoding.java b/presto-orc/src/main/java/com/facebook/presto/orc/OrcEncoding.java index f3f7a344c9ae..30df8e391198 100644 --- a/presto-orc/src/main/java/com/facebook/presto/orc/OrcEncoding.java +++ b/presto-orc/src/main/java/com/facebook/presto/orc/OrcEncoding.java @@ -50,5 +50,6 @@ public MetadataWriter createMetadataWriter() }; public abstract MetadataReader createMetadataReader(); + public abstract MetadataWriter createMetadataWriter(); } diff --git a/presto-orc/src/main/java/com/facebook/presto/orc/OrcWriteValidation.java b/presto-orc/src/main/java/com/facebook/presto/orc/OrcWriteValidation.java index b8382753b0b4..e44f11b18063 100644 --- a/presto-orc/src/main/java/com/facebook/presto/orc/OrcWriteValidation.java +++ b/presto-orc/src/main/java/com/facebook/presto/orc/OrcWriteValidation.java @@ -92,7 +92,8 @@ public class OrcWriteValidation { - public enum OrcWriteValidationMode { + public enum OrcWriteValidationMode + { HASHED, DETAILED, BOTH } @@ -260,10 +261,10 @@ public void validateRowGroupStatistics(OrcDataSourceId orcDataSourceId, long str private static RowGroupStatistics buildActualRowGroupStatistics(int rowGroupIndex, Map> actualRowGroupStatistics) { return new RowGroupStatistics( - BOTH, - IntStream.range(1, actualRowGroupStatistics.size() + 1) - .boxed() - .collect(toImmutableMap(identity(), columnIndex -> actualRowGroupStatistics.get(columnIndex).get(rowGroupIndex).getColumnStatistics()))); + BOTH, + IntStream.range(1, actualRowGroupStatistics.size() + 1) + .boxed() + .collect(toImmutableMap(identity(), columnIndex -> actualRowGroupStatistics.get(columnIndex).get(rowGroupIndex).getColumnStatistics()))); } public void validateRowGroupStatistics( diff --git a/presto-orc/src/main/java/com/facebook/presto/orc/reader/SliceDictionaryStreamReader.java b/presto-orc/src/main/java/com/facebook/presto/orc/reader/SliceDictionaryStreamReader.java index 914686915dbf..32b56cf65cbb 100644 --- a/presto-orc/src/main/java/com/facebook/presto/orc/reader/SliceDictionaryStreamReader.java +++ b/presto-orc/src/main/java/com/facebook/presto/orc/reader/SliceDictionaryStreamReader.java @@ -28,7 +28,6 @@ import com.facebook.presto.spi.block.VariableWidthBlock; import com.facebook.presto.spi.type.Type; import io.airlift.slice.Slice; -import io.airlift.slice.Slices; import org.openjdk.jol.info.ClassLayout; import javax.annotation.Nullable; @@ -50,6 +49,7 @@ import static com.google.common.base.MoreObjects.toStringHelper; import static com.google.common.base.Verify.verify; import static io.airlift.slice.SizeOf.sizeOf; +import static io.airlift.slice.Slices.wrappedBuffer; import static java.lang.Math.toIntExact; import static java.util.Objects.requireNonNull; @@ -79,7 +79,7 @@ public class SliceDictionaryStreamReader private byte[] stripeDictionaryData = EMPTY_DICTIONARY_DATA; private int[] stripeDictionaryOffsetVector = EMPTY_DICTIONARY_OFFSETS; - private VariableWidthBlock dictionaryBlock = new VariableWidthBlock(1, Slices.wrappedBuffer(EMPTY_DICTIONARY_DATA), EMPTY_DICTIONARY_OFFSETS, Optional.of(new boolean[] {true})); + private VariableWidthBlock dictionaryBlock = new VariableWidthBlock(1, wrappedBuffer(EMPTY_DICTIONARY_DATA), EMPTY_DICTIONARY_OFFSETS, Optional.of(new boolean[] {true})); private byte[] currentDictionaryData = EMPTY_DICTIONARY_DATA; private InputStreamSource stripeDictionaryLengthStreamSource = missingStreamSource(LongInputStream.class); @@ -202,7 +202,7 @@ private void setDictionaryBlockData(byte[] dictionaryData, int[] dictionaryOffse boolean[] isNullVector = new boolean[positionCount]; isNullVector[positionCount - 1] = true; dictionaryOffsets[positionCount] = dictionaryOffsets[positionCount - 1]; - dictionaryBlock = new VariableWidthBlock(positionCount, Slices.wrappedBuffer(dictionaryData), dictionaryOffsets, Optional.of(isNullVector)); + dictionaryBlock = new VariableWidthBlock(positionCount, wrappedBuffer(dictionaryData), dictionaryOffsets, Optional.of(isNullVector)); currentDictionaryData = dictionaryData; } } @@ -296,7 +296,7 @@ private static void readDictionary( Type type) throws IOException { - Slice slice = Slices.wrappedBuffer(data); + Slice slice = wrappedBuffer(data); // initialize the offset if necessary; // otherwise, use the previous offset diff --git a/presto-orc/src/main/java/com/facebook/presto/orc/reader/StructStreamReader.java b/presto-orc/src/main/java/com/facebook/presto/orc/reader/StructStreamReader.java index 18a49e145f36..fc3538f041d4 100644 --- a/presto-orc/src/main/java/com/facebook/presto/orc/reader/StructStreamReader.java +++ b/presto-orc/src/main/java/com/facebook/presto/orc/reader/StructStreamReader.java @@ -184,7 +184,8 @@ public String toString() .toString(); } - private Block[] getBlocksForType(Type type, int positionCount) throws IOException + private Block[] getBlocksForType(Type type, int positionCount) + throws IOException { RowType rowType = (RowType) type; diff --git a/presto-orc/src/main/java/com/facebook/presto/orc/writer/SliceDictionaryColumnWriter.java b/presto-orc/src/main/java/com/facebook/presto/orc/writer/SliceDictionaryColumnWriter.java index 905d5c0e3e52..872073b637c3 100644 --- a/presto-orc/src/main/java/com/facebook/presto/orc/writer/SliceDictionaryColumnWriter.java +++ b/presto-orc/src/main/java/com/facebook/presto/orc/writer/SliceDictionaryColumnWriter.java @@ -389,7 +389,8 @@ private static int[] getSortedDictionaryNullsLast(Block elementBlock) sortedPositions[i] = i; } - IntArrays.quickSort(sortedPositions, 0, sortedPositions.length, new AbstractIntComparator() { + IntArrays.quickSort(sortedPositions, 0, sortedPositions.length, new AbstractIntComparator() + { @Override public int compare(int left, int right) { diff --git a/presto-orc/src/test/java/com/facebook/presto/orc/OrcTester.java b/presto-orc/src/test/java/com/facebook/presto/orc/OrcTester.java index 0936fbd7e2a3..75987fcc9051 100644 --- a/presto-orc/src/test/java/com/facebook/presto/orc/OrcTester.java +++ b/presto-orc/src/test/java/com/facebook/presto/orc/OrcTester.java @@ -458,7 +458,8 @@ public void assertRoundTrip(Type type, List readValues) assertRoundTrip(type, type, readValues, readValues, true); } - public void assertRoundTrip(Type type, List readValues, boolean verifyWithHiveReader) throws Exception + public void assertRoundTrip(Type type, List readValues, boolean verifyWithHiveReader) + throws Exception { assertRoundTrip(type, type, readValues, readValues, verifyWithHiveReader); } diff --git a/presto-orc/src/test/java/com/facebook/presto/orc/TestStructStreamReader.java b/presto-orc/src/test/java/com/facebook/presto/orc/TestStructStreamReader.java index a95cd8683b59..d313ba9b0978 100644 --- a/presto-orc/src/test/java/com/facebook/presto/orc/TestStructStreamReader.java +++ b/presto-orc/src/test/java/com/facebook/presto/orc/TestStructStreamReader.java @@ -77,7 +77,8 @@ public void setUp() } @AfterMethod - public void tearDown() throws IOException + public void tearDown() + throws IOException { tempFile.close(); } @@ -86,7 +87,8 @@ public void tearDown() throws IOException * Reader and writer have the same fields. Checks that fields are read in correctly */ @Test - public void testValuesAreReadInCorrectly() throws IOException + public void testValuesAreReadInCorrectly() + throws IOException { List readerFields = new ArrayList<>(Arrays.asList("field_a", "field_b", "field_c")); List writerFields = new ArrayList<>(Arrays.asList("field_a", "field_b", "field_c")); @@ -108,7 +110,8 @@ public void testValuesAreReadInCorrectly() throws IOException * The writer has fields with upper case characters, reader has same names downcased. */ @Test - public void testReaderLowerCasesFieldNamesFromStream() throws IOException + public void testReaderLowerCasesFieldNamesFromStream() + throws IOException { List readerFields = new ArrayList<>(Arrays.asList("field_a", "field_b", "field_c")); List writerFields = new ArrayList<>(Arrays.asList("field_A", "field_B", "field_C")); @@ -130,7 +133,8 @@ public void testReaderLowerCasesFieldNamesFromStream() throws IOException * Reader has fields with upper case characters, writer has same names downcased. */ @Test - public void testReaderLowerCasesFieldNamesFromType() throws IOException + public void testReaderLowerCasesFieldNamesFromType() + throws IOException { List readerFields = new ArrayList<>(Arrays.asList("field_A", "field_B", "field_C")); List writerFields = new ArrayList<>(Arrays.asList("field_a", "field_b", "field_c")); @@ -150,7 +154,8 @@ public void testReaderLowerCasesFieldNamesFromType() throws IOException @Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "Missing struct field name in type row\\(varchar,varchar,varchar\\)") - public void testThrowsExceptionWhenFieldNameMissing() throws IOException + public void testThrowsExceptionWhenFieldNameMissing() + throws IOException { List readerFields = new ArrayList<>(Arrays.asList("field_a", "field_b", "field_c")); List writerFields = new ArrayList<>(Arrays.asList("field_a", "field_b", "field_c")); @@ -166,7 +171,8 @@ public void testThrowsExceptionWhenFieldNameMissing() throws IOException * The reader has a field that is missing from the ORC file */ @Test - public void testExtraFieldsInReader() throws IOException + public void testExtraFieldsInReader() + throws IOException { List readerFields = new ArrayList<>(Arrays.asList("field_a", "field_b", "field_c")); @@ -190,7 +196,8 @@ public void testExtraFieldsInReader() throws IOException * The ORC file has a field that is missing from the reader */ @Test - public void testExtraFieldsInWriter() throws IOException + public void testExtraFieldsInWriter() + throws IOException { // field_b is missing List readerFields = new ArrayList<>(Arrays.asList("field_a", "field_c")); @@ -208,14 +215,26 @@ public void testExtraFieldsInWriter() throws IOException assertEquals(actual.get(1), "field_c_value"); } - private void write(TempFile tempFile, Type writerType, List data) throws IOException + private void write(TempFile tempFile, Type writerType, List data) + throws IOException { OrcWriter writer = new OrcWriter( - new OutputStreamOrcDataSink( - new FileOutputStream(tempFile.getFile())), ImmutableList.of(STRUCT_COL_NAME), ImmutableList.of(writerType), ORC, NONE, - new OrcWriterOptions().withStripeMinSize(new DataSize(0, MEGABYTE)).withStripeMaxSize(new DataSize(32, MEGABYTE)).withStripeMaxRowCount(ORC_STRIPE_SIZE) - .withRowGroupMaxRowCount(ORC_ROW_GROUP_SIZE).withDictionaryMaxMemory(new DataSize(32, MEGABYTE)), - ImmutableMap.of(), HIVE_STORAGE_TIME_ZONE, true, BOTH, new OrcWriterStats()); + new OutputStreamOrcDataSink(new FileOutputStream(tempFile.getFile())), + ImmutableList.of(STRUCT_COL_NAME), + ImmutableList.of(writerType), + ORC, + NONE, + new OrcWriterOptions() + .withStripeMinSize(new DataSize(0, MEGABYTE)) + .withStripeMaxSize(new DataSize(32, MEGABYTE)) + .withStripeMaxRowCount(ORC_STRIPE_SIZE) + .withRowGroupMaxRowCount(ORC_ROW_GROUP_SIZE) + .withDictionaryMaxMemory(new DataSize(32, MEGABYTE)), + ImmutableMap.of(), + HIVE_STORAGE_TIME_ZONE, + true, + BOTH, + new OrcWriterStats()); // write down some data with unsorted streams Block[] fieldBlocks = new Block[data.size()]; @@ -239,7 +258,8 @@ private void write(TempFile tempFile, Type writerType, List data) throws writer.close(); } - private RowBlock read(TempFile tempFile, Type readerType) throws IOException + private RowBlock read(TempFile tempFile, Type readerType) + throws IOException { DataSize dataSize = new DataSize(1, MEGABYTE); OrcDataSource orcDataSource = new FileOrcDataSource(tempFile.getFile(), dataSize, dataSize, dataSize, true); diff --git a/presto-orc/src/test/java/com/facebook/presto/orc/metadata/TestDwrfMetadataReader.java b/presto-orc/src/test/java/com/facebook/presto/orc/metadata/TestDwrfMetadataReader.java index 59f6a81af176..e95376f35191 100644 --- a/presto-orc/src/test/java/com/facebook/presto/orc/metadata/TestDwrfMetadataReader.java +++ b/presto-orc/src/test/java/com/facebook/presto/orc/metadata/TestDwrfMetadataReader.java @@ -50,21 +50,21 @@ public void testToStringStatistics() for (boolean isRowGroup : ImmutableList.of(true, false)) { assertEquals( DwrfMetadataReader.toStringStatistics( - HiveWriterVersion.ORC_HIVE_8732, - DwrfProto.StringStatistics.newBuilder() - .setSum(45) - .build(), - isRowGroup), + HiveWriterVersion.ORC_HIVE_8732, + DwrfProto.StringStatistics.newBuilder() + .setSum(45) + .build(), + isRowGroup), new StringStatistics(null, null, 45)); } // and the ORIGINAL version row group stats (but not rolled up stats) assertEquals( DwrfMetadataReader.toStringStatistics( - HiveWriterVersion.ORIGINAL, - DwrfProto.StringStatistics.newBuilder() - .setSum(45) - .build(), - true), + HiveWriterVersion.ORIGINAL, + DwrfProto.StringStatistics.newBuilder() + .setSum(45) + .build(), + true), new StringStatistics(null, null, 45)); // having only a min or max should work diff --git a/presto-orc/src/test/java/com/facebook/presto/orc/stream/TestLongDecode.java b/presto-orc/src/test/java/com/facebook/presto/orc/stream/TestLongDecode.java index cca399bdac9b..3021a2b8e672 100644 --- a/presto-orc/src/test/java/com/facebook/presto/orc/stream/TestLongDecode.java +++ b/presto-orc/src/test/java/com/facebook/presto/orc/stream/TestLongDecode.java @@ -137,7 +137,8 @@ private static long readVulong(InputStream in) } result |= (0x7f & b) << offset; offset += 7; - } while (b >= 0x80); + } + while (b >= 0x80); return result; } diff --git a/presto-parser/src/main/java/com/facebook/presto/sql/tree/CurrentPath.java b/presto-parser/src/main/java/com/facebook/presto/sql/tree/CurrentPath.java index 03d52ef29937..1d7c03e7b09a 100644 --- a/presto-parser/src/main/java/com/facebook/presto/sql/tree/CurrentPath.java +++ b/presto-parser/src/main/java/com/facebook/presto/sql/tree/CurrentPath.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import com.google.common.collect.ImmutableList; import java.util.List; diff --git a/presto-parser/src/main/java/com/facebook/presto/sql/tree/CurrentUser.java b/presto-parser/src/main/java/com/facebook/presto/sql/tree/CurrentUser.java index b1e33233309e..3e7aa0850416 100644 --- a/presto-parser/src/main/java/com/facebook/presto/sql/tree/CurrentUser.java +++ b/presto-parser/src/main/java/com/facebook/presto/sql/tree/CurrentUser.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import com.google.common.collect.ImmutableList; import java.util.List; diff --git a/presto-raptor/src/test/java/com/facebook/presto/raptor/metadata/TestRaptorMetadata.java b/presto-raptor/src/test/java/com/facebook/presto/raptor/metadata/TestRaptorMetadata.java index dc08f64456c8..f344bf3c1235 100644 --- a/presto-raptor/src/test/java/com/facebook/presto/raptor/metadata/TestRaptorMetadata.java +++ b/presto-raptor/src/test/java/com/facebook/presto/raptor/metadata/TestRaptorMetadata.java @@ -155,8 +155,8 @@ public void testDropColumn() { assertNull(metadata.getTableHandle(SESSION, DEFAULT_TEST_ORDERS)); metadata.createTable(SESSION, buildTable(ImmutableMap.of(), tableMetadataBuilder(DEFAULT_TEST_ORDERS) - .column("orderkey", BIGINT) - .column("price", BIGINT)), + .column("orderkey", BIGINT) + .column("price", BIGINT)), false); ConnectorTableHandle tableHandle = metadata.getTableHandle(SESSION, DEFAULT_TEST_ORDERS); assertInstanceOf(tableHandle, RaptorTableHandle.class); diff --git a/presto-raptor/src/test/java/com/facebook/presto/raptor/storage/organization/TestShardOrganizerUtil.java b/presto-raptor/src/test/java/com/facebook/presto/raptor/storage/organization/TestShardOrganizerUtil.java index cb3f262a394a..df61e4f0a907 100644 --- a/presto-raptor/src/test/java/com/facebook/presto/raptor/storage/organization/TestShardOrganizerUtil.java +++ b/presto-raptor/src/test/java/com/facebook/presto/raptor/storage/organization/TestShardOrganizerUtil.java @@ -105,12 +105,12 @@ public void testGetOrganizationEligibleShards() SchemaTableName tableName = new SchemaTableName("default", "test"); metadata.createTable(SESSION, tableMetadataBuilder(tableName) - .column("orderkey", BIGINT) - .column("orderdate", DATE) - .column("orderstatus", createVarcharType(3)) - .property("ordering", ImmutableList.of("orderstatus", "orderkey")) - .property("temporal_column", "orderdate") - .build(), + .column("orderkey", BIGINT) + .column("orderdate", DATE) + .column("orderstatus", createVarcharType(3)) + .property("ordering", ImmutableList.of("orderstatus", "orderkey")) + .property("temporal_column", "orderdate") + .build(), false); Table tableInfo = metadataDao.getTableInformation(tableName.getSchemaName(), tableName.getTableName()); List tableColumns = metadataDao.listTableColumns(tableInfo.getTableId()); diff --git a/presto-raptor/src/test/java/com/facebook/presto/raptor/systemtables/TestShardMetadataRecordCursor.java b/presto-raptor/src/test/java/com/facebook/presto/raptor/systemtables/TestShardMetadataRecordCursor.java index 704cfbf0c731..2df831840b39 100644 --- a/presto-raptor/src/test/java/com/facebook/presto/raptor/systemtables/TestShardMetadataRecordCursor.java +++ b/presto-raptor/src/test/java/com/facebook/presto/raptor/systemtables/TestShardMetadataRecordCursor.java @@ -20,6 +20,7 @@ import com.facebook.presto.raptor.metadata.ShardManager; import com.facebook.presto.raptor.metadata.TableColumn; import com.facebook.presto.spi.ColumnMetadata; +import com.facebook.presto.spi.ConnectorTableMetadata; import com.facebook.presto.spi.RecordCursor; import com.facebook.presto.spi.SchemaTableName; import com.facebook.presto.spi.connector.ConnectorMetadata; @@ -81,12 +82,12 @@ public void setup() this.metadata = new RaptorMetadata("raptor", dbi, createShardManager(dbi)); // Create table - metadata.createTable(SESSION, tableMetadataBuilder(DEFAULT_TEST_ORDERS) + ConnectorTableMetadata table = tableMetadataBuilder(DEFAULT_TEST_ORDERS) .column("orderkey", BIGINT) .column("orderdate", DATE) .property("temporal_column", "orderdate") - .build(), - false); + .build(); + createTable(table); } @AfterMethod(alwaysRun = true) @@ -154,16 +155,14 @@ public void testSimple() public void testNoSchemaFilter() { // Create "orders" table in a different schema - metadata.createTable(SESSION, tableMetadataBuilder(new SchemaTableName("other", "orders")) + createTable(tableMetadataBuilder(new SchemaTableName("other", "orders")) .column("orderkey", BIGINT) - .build(), - false); + .build()); // Create another table that should not be selected - metadata.createTable(SESSION, tableMetadataBuilder(new SchemaTableName("schema1", "foo")) + createTable(tableMetadataBuilder(new SchemaTableName("schema1", "foo")) .column("orderkey", BIGINT) - .build(), - false); + .build()); TupleDomain tupleDomain = TupleDomain.withColumnDomains( ImmutableMap.builder() @@ -182,16 +181,14 @@ public void testNoSchemaFilter() public void testNoTableFilter() { // Create "orders" table in a different schema - metadata.createTable(SESSION, tableMetadataBuilder(new SchemaTableName("test", "orders2")) + createTable(tableMetadataBuilder(new SchemaTableName("test", "orders2")) .column("orderkey", BIGINT) - .build(), - false); + .build()); // Create another table that should not be selected - metadata.createTable(SESSION, tableMetadataBuilder(new SchemaTableName("schema1", "foo")) + createTable(tableMetadataBuilder(new SchemaTableName("schema1", "foo")) .column("orderkey", BIGINT) - .build(), - false); + .build()); TupleDomain tupleDomain = TupleDomain.withColumnDomains( ImmutableMap.builder() @@ -206,6 +203,11 @@ public void testNoTableFilter() assertEquals(actual, expected); } + private void createTable(ConnectorTableMetadata table) + { + metadata.createTable(SESSION, table, false); + } + private static List getMaterializedResults(RecordCursor cursor, List columns) { List types = columns.stream().map(ColumnMetadata::getType).collect(toList()); diff --git a/presto-record-decoder/src/main/java/com/facebook/presto/decoder/RowDecoder.java b/presto-record-decoder/src/main/java/com/facebook/presto/decoder/RowDecoder.java index ec7911d60b97..8c22308e5929 100644 --- a/presto-record-decoder/src/main/java/com/facebook/presto/decoder/RowDecoder.java +++ b/presto-record-decoder/src/main/java/com/facebook/presto/decoder/RowDecoder.java @@ -26,7 +26,6 @@ public interface RowDecoder * * @param data The row data to decode. * @param dataMap The row data as fields map - * * @return Returns mapping from column handle to decoded value. Unmapped columns will be reported as null. Optional.empty() signals decoding error. */ Optional> decodeRow( diff --git a/presto-spi/src/main/java/com/facebook/presto/spi/ConnectorSplitSource.java b/presto-spi/src/main/java/com/facebook/presto/spi/ConnectorSplitSource.java index 0510177b5fe9..dfdf9a43109c 100644 --- a/presto-spi/src/main/java/com/facebook/presto/spi/ConnectorSplitSource.java +++ b/presto-spi/src/main/java/com/facebook/presto/spi/ConnectorSplitSource.java @@ -31,7 +31,7 @@ public interface ConnectorSplitSource /** * Returns whether any more {@link ConnectorSplit} may be produced. - * + *

* This method should only be called when there has been no invocation of getNextBatch, * or result Future of previous getNextBatch is done. * Calling this method at other time is not useful because the contract of such an invocation diff --git a/presto-spi/src/main/java/com/facebook/presto/spi/block/ColumnarRow.java b/presto-spi/src/main/java/com/facebook/presto/spi/block/ColumnarRow.java index 488ab494ac99..36e9fd8c1a1b 100644 --- a/presto-spi/src/main/java/com/facebook/presto/spi/block/ColumnarRow.java +++ b/presto-spi/src/main/java/com/facebook/presto/spi/block/ColumnarRow.java @@ -125,7 +125,7 @@ public int getFieldCount() /** * Gets the specified field for all rows as a column. - * + *

* Note: A null row will not have an entry in the block, so the block * will be the size of the non-null rows. This block may still contain * null values when the row is non-null but the field value is null. diff --git a/presto-spi/src/main/java/com/facebook/presto/spi/block/MapBlock.java b/presto-spi/src/main/java/com/facebook/presto/spi/block/MapBlock.java index 516fc1830337..0a51354f1b46 100644 --- a/presto-spi/src/main/java/com/facebook/presto/spi/block/MapBlock.java +++ b/presto-spi/src/main/java/com/facebook/presto/spi/block/MapBlock.java @@ -98,7 +98,7 @@ public static MapBlock fromKeyValueBlock( /** * Create a map block directly without per element validations. - * + *

* Internal use by this package and com.facebook.presto.spi.Type only. * * @param keyType key type K diff --git a/presto-spi/src/main/java/com/facebook/presto/spi/connector/ConnectorMetadata.java b/presto-spi/src/main/java/com/facebook/presto/spi/connector/ConnectorMetadata.java index e4669cab77d2..e12d99c49b7c 100644 --- a/presto-spi/src/main/java/com/facebook/presto/spi/connector/ConnectorMetadata.java +++ b/presto-spi/src/main/java/com/facebook/presto/spi/connector/ConnectorMetadata.java @@ -117,6 +117,7 @@ default Optional getInfo(ConnectorTableLayoutHandle layoutHandle) /** * List table names, possibly filtered by schema. An empty list is returned if none match. + * * @deprecated replaced by {@link ConnectorMetadata#listTables(ConnectorSession, Optional)} */ @Deprecated @@ -373,6 +374,7 @@ default void dropView(ConnectorSession session, SchemaTableName viewName) /** * List view names, possibly filtered by schema. An empty list is returned if none match. + * * @deprecated replaced by {@link ConnectorMetadata#listViews(ConnectorSession, Optional)} */ @Deprecated diff --git a/presto-spi/src/main/java/com/facebook/presto/spi/function/Convention.java b/presto-spi/src/main/java/com/facebook/presto/spi/function/Convention.java index 2668e7266aba..bf58cae8796e 100644 --- a/presto-spi/src/main/java/com/facebook/presto/spi/function/Convention.java +++ b/presto-spi/src/main/java/com/facebook/presto/spi/function/Convention.java @@ -18,7 +18,9 @@ public @interface Convention { InvocationConvention.InvocationArgumentConvention[] arguments(); + InvocationConvention.InvocationReturnConvention result(); + boolean session() default false; boolean $notSpecified() default false; diff --git a/presto-spi/src/main/java/com/facebook/presto/spi/resourceGroups/ResourceGroupConfigurationManager.java b/presto-spi/src/main/java/com/facebook/presto/spi/resourceGroups/ResourceGroupConfigurationManager.java index 6593c58fb739..eb9aedf6b677 100644 --- a/presto-spi/src/main/java/com/facebook/presto/spi/resourceGroups/ResourceGroupConfigurationManager.java +++ b/presto-spi/src/main/java/com/facebook/presto/spi/resourceGroups/ResourceGroupConfigurationManager.java @@ -20,7 +20,7 @@ * and receives a {@link com.facebook.presto.spi.resourceGroups.SelectionContext} in return which * contains a fully-qualified {@link com.facebook.presto.spi.resourceGroups.ResourceGroupId}, * and a manager-specific data structure of type {@code C}. - * + *

* At a later time, the engine may decide to construct a resource group with that ID. To do so, * it will walk the tree to find the right position for the group, and then create it. It also * creates any necessary parent groups. Every time the engine creates a group it will diff --git a/presto-spi/src/main/java/com/facebook/presto/spi/session/ResourceEstimates.java b/presto-spi/src/main/java/com/facebook/presto/spi/session/ResourceEstimates.java index 89d4be228b3d..b86743f7320b 100644 --- a/presto-spi/src/main/java/com/facebook/presto/spi/session/ResourceEstimates.java +++ b/presto-spi/src/main/java/com/facebook/presto/spi/session/ResourceEstimates.java @@ -24,7 +24,7 @@ /** * Estimated resource usage for a query. - * + *

* This class is under active development and should be considered beta. */ public final class ResourceEstimates diff --git a/presto-spi/src/main/java/com/facebook/presto/spi/type/MapType.java b/presto-spi/src/main/java/com/facebook/presto/spi/type/MapType.java index 80e9ab8221e8..8a6e4b940f68 100644 --- a/presto-spi/src/main/java/com/facebook/presto/spi/type/MapType.java +++ b/presto-spi/src/main/java/com/facebook/presto/spi/type/MapType.java @@ -266,7 +266,7 @@ public Block createBlockFromKeyValue(Optional mapIsNull, int[] offset /** * Create a map block directly without per element validations. - * + *

* Internal use by com.facebook.presto.spi.Block only. */ public static Block createMapBlockInternal( diff --git a/presto-spi/src/main/java/com/facebook/presto/spi/type/RowType.java b/presto-spi/src/main/java/com/facebook/presto/spi/type/RowType.java index 79cdeff933eb..498063f219fe 100644 --- a/presto-spi/src/main/java/com/facebook/presto/spi/type/RowType.java +++ b/presto-spi/src/main/java/com/facebook/presto/spi/type/RowType.java @@ -45,8 +45,8 @@ private RowType(TypeSignature typeSignature, List fields) this.fields = fields; this.fieldTypes = fields.stream() - .map(Field::getType) - .collect(Collectors.toList()); + .map(Field::getType) + .collect(Collectors.toList()); } public static RowType from(List fields) diff --git a/presto-spi/src/main/java/com/facebook/presto/spi/type/Type.java b/presto-spi/src/main/java/com/facebook/presto/spi/type/Type.java index 5eecb317f44a..56e81be5df03 100644 --- a/presto-spi/src/main/java/com/facebook/presto/spi/type/Type.java +++ b/presto-spi/src/main/java/com/facebook/presto/spi/type/Type.java @@ -140,7 +140,7 @@ public interface Type /** * Are the values in the specified blocks at the specified positions equal? - * + *

* This method assumes input is not null. */ boolean equalTo(Block leftBlock, int leftPosition, Block rightBlock, int rightPosition); diff --git a/presto-tests/src/test/java/com/facebook/presto/connector/informationschema/BenchmarkInformationSchema.java b/presto-tests/src/test/java/com/facebook/presto/connector/informationschema/BenchmarkInformationSchema.java index 55e4d08ed950..f8b9fea37fbb 100644 --- a/presto-tests/src/test/java/com/facebook/presto/connector/informationschema/BenchmarkInformationSchema.java +++ b/presto-tests/src/test/java/com/facebook/presto/connector/informationschema/BenchmarkInformationSchema.java @@ -85,9 +85,9 @@ public static class BenchmarkData private QueryRunner queryRunner; private Session session = testSessionBuilder() - .setCatalog("test_catalog") - .setSchema("test_schema") - .build(); + .setCatalog("test_catalog") + .setSchema("test_schema") + .build(); private String query; @@ -96,7 +96,8 @@ public void setup() throws Exception { queryRunner = DistributedQueryRunner.builder(session).build(); - queryRunner.installPlugin(new Plugin() { + queryRunner.installPlugin(new Plugin() + { @Override public Iterable getConnectorFactories() { diff --git a/presto-tests/src/test/java/com/facebook/presto/tests/TestMetadataManager.java b/presto-tests/src/test/java/com/facebook/presto/tests/TestMetadataManager.java index 33a930fef9b4..e823b7e9ba1e 100644 --- a/presto-tests/src/test/java/com/facebook/presto/tests/TestMetadataManager.java +++ b/presto-tests/src/test/java/com/facebook/presto/tests/TestMetadataManager.java @@ -55,7 +55,8 @@ public void setUp() throws Exception { queryRunner = TpchQueryRunnerBuilder.builder().build(); - queryRunner.installPlugin(new Plugin() { + queryRunner.installPlugin(new Plugin() + { @Override public Iterable getConnectorFactories() {