diff --git a/core/trino-main/src/test/java/io/trino/TestHiddenColumns.java b/core/trino-main/src/test/java/io/trino/TestHiddenColumns.java index d3467c53fe7e..576facdd1cda 100644 --- a/core/trino-main/src/test/java/io/trino/TestHiddenColumns.java +++ b/core/trino-main/src/test/java/io/trino/TestHiddenColumns.java @@ -25,7 +25,6 @@ import org.junit.jupiter.api.parallel.Execution; import static io.trino.SessionTestUtils.TEST_SESSION; -import static io.trino.plugin.tpch.TpchConnectorFactory.TPCH_SPLITS_PER_NODE; import static io.trino.spi.type.VarcharType.VARCHAR; import static io.trino.testing.MaterializedResult.resultBuilder; import static org.assertj.core.api.Assertions.assertThat; @@ -44,7 +43,7 @@ public void setUp() { runner = new StandaloneQueryRunner(TEST_SESSION); runner.installPlugin(new TpchPlugin()); - runner.createCatalog(TEST_SESSION.getCatalog().get(), "tpch", ImmutableMap.of(TPCH_SPLITS_PER_NODE, "1")); + runner.createCatalog(TEST_SESSION.getCatalog().get(), "tpch", ImmutableMap.of("tpch.splits-per-node", "1")); assertions = new QueryAssertions(runner); } diff --git a/core/trino-main/src/test/java/io/trino/cost/StatsCalculatorTester.java b/core/trino-main/src/test/java/io/trino/cost/StatsCalculatorTester.java index f51d805c226f..9ff78160c86d 100644 --- a/core/trino-main/src/test/java/io/trino/cost/StatsCalculatorTester.java +++ b/core/trino-main/src/test/java/io/trino/cost/StatsCalculatorTester.java @@ -25,7 +25,6 @@ import java.util.function.Function; -import static io.trino.plugin.tpch.TpchConnectorFactory.TPCH_SPLITS_PER_NODE; import static io.trino.spi.transaction.IsolationLevel.READ_UNCOMMITTED; import static io.trino.testing.TestingSession.testSession; @@ -38,7 +37,7 @@ public StatsCalculatorTester(Session session) { queryRunner = new StandaloneQueryRunner(session); queryRunner.installPlugin(new TpchPlugin()); - queryRunner.createCatalog(session.getCatalog().orElseThrow(), "tpch", ImmutableMap.of(TPCH_SPLITS_PER_NODE, "1")); + queryRunner.createCatalog(session.getCatalog().orElseThrow(), "tpch", ImmutableMap.of("tpch.splits-per-node", "1")); } public StatsCalculatorAssertion assertStatsFor(Function planProvider) diff --git a/core/trino-main/src/test/java/io/trino/cost/TestStatsCalculator.java b/core/trino-main/src/test/java/io/trino/cost/TestStatsCalculator.java index 02217f097e9e..dea3609cced4 100644 --- a/core/trino-main/src/test/java/io/trino/cost/TestStatsCalculator.java +++ b/core/trino-main/src/test/java/io/trino/cost/TestStatsCalculator.java @@ -27,7 +27,6 @@ import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.parallel.Execution; -import static io.trino.plugin.tpch.TpchConnectorFactory.TPCH_SPLITS_PER_NODE; import static io.trino.sql.planner.assertions.PlanMatchPattern.anyTree; import static io.trino.sql.planner.assertions.PlanMatchPattern.node; import static io.trino.testing.TestingHandles.TEST_CATALOG_NAME; @@ -53,7 +52,7 @@ public void setUp() queryRunner.createCatalog( queryRunner.getDefaultSession().getCatalog().get(), "tpch", - ImmutableMap.of(TPCH_SPLITS_PER_NODE, "1")); + ImmutableMap.of("tpch.splits-per-node", "1")); } @AfterAll diff --git a/core/trino-main/src/test/java/io/trino/sql/planner/BenchmarkPlanner.java b/core/trino-main/src/test/java/io/trino/sql/planner/BenchmarkPlanner.java index 833ffc2a874b..bd965861419f 100644 --- a/core/trino-main/src/test/java/io/trino/sql/planner/BenchmarkPlanner.java +++ b/core/trino-main/src/test/java/io/trino/sql/planner/BenchmarkPlanner.java @@ -56,8 +56,6 @@ import static io.trino.execution.querystats.PlanOptimizersStatsCollector.createPlanOptimizersStatsCollector; import static io.trino.execution.warnings.WarningCollector.NOOP; import static io.trino.jmh.Benchmarks.benchmark; -import static io.trino.plugin.tpch.TpchConnectorFactory.TPCH_COLUMN_NAMING_PROPERTY; -import static io.trino.plugin.tpch.TpchConnectorFactory.TPCH_SPLITS_PER_NODE; import static io.trino.spi.type.VarcharType.VARCHAR; import static io.trino.sql.planner.BenchmarkPlanner.Queries.TPCH; import static io.trino.sql.planner.LogicalPlanner.Stage.OPTIMIZED; @@ -103,8 +101,8 @@ public void setup() planTester = PlanTester.create(session); planTester.installPlugin(new TpchPlugin()); planTester.createCatalog(tpch, "tpch", ImmutableMap.builder() - .put(TPCH_SPLITS_PER_NODE, "4") - .put(TPCH_COLUMN_NAMING_PROPERTY, ColumnNaming.STANDARD.name()) + .put("tpch.splits-per-node", "4") + .put("tpch.column-naming", ColumnNaming.STANDARD.name()) .buildOrThrow()); planTester.installPlugin(new MockConnectorPlugin(MockConnectorFactory.builder() diff --git a/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/BenchmarkReorderChainedJoins.java b/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/BenchmarkReorderChainedJoins.java index 375638180382..d6390ac884c3 100644 --- a/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/BenchmarkReorderChainedJoins.java +++ b/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/BenchmarkReorderChainedJoins.java @@ -31,7 +31,6 @@ import org.openjdk.jmh.runner.RunnerException; import static io.trino.jmh.Benchmarks.benchmark; -import static io.trino.plugin.tpch.TpchConnectorFactory.TPCH_SPLITS_PER_NODE; import static io.trino.testing.TestingSession.testSessionBuilder; import static java.util.concurrent.TimeUnit.MILLISECONDS; import static org.openjdk.jmh.annotations.Mode.AverageTime; @@ -83,7 +82,7 @@ public void setup() .build(); planTester = PlanTester.create(session); planTester.installPlugin(new TpchPlugin()); - planTester.createCatalog("tpch", "tpch", ImmutableMap.of(TPCH_SPLITS_PER_NODE, "1")); + planTester.createCatalog("tpch", "tpch", ImmutableMap.of("tpch.splits-per-node", "1")); } public PlanTester getPlanTester() diff --git a/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/BenchmarkReorderInterconnectedJoins.java b/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/BenchmarkReorderInterconnectedJoins.java index 569c1026d271..2ee277539c50 100644 --- a/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/BenchmarkReorderInterconnectedJoins.java +++ b/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/BenchmarkReorderInterconnectedJoins.java @@ -33,7 +33,6 @@ import static com.google.common.base.Preconditions.checkState; import static io.trino.jmh.Benchmarks.benchmark; -import static io.trino.plugin.tpch.TpchConnectorFactory.TPCH_SPLITS_PER_NODE; import static io.trino.testing.TestingSession.testSessionBuilder; import static java.lang.String.format; import static java.util.concurrent.TimeUnit.MILLISECONDS; @@ -83,7 +82,7 @@ public void setup() .build(); queryRunner = new StandaloneQueryRunner(session); queryRunner.installPlugin(new TpchPlugin()); - queryRunner.createCatalog("tpch", "tpch", ImmutableMap.of(TPCH_SPLITS_PER_NODE, "1")); + queryRunner.createCatalog("tpch", "tpch", ImmutableMap.of("tpch.splits-per-node", "1")); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("EXPLAIN SELECT * FROM nation n1"); for (int i = 2; i <= numberOfTables; i++) { diff --git a/core/trino-main/src/test/java/io/trino/sql/planner/planprinter/TestAnonymizeJsonRepresentation.java b/core/trino-main/src/test/java/io/trino/sql/planner/planprinter/TestAnonymizeJsonRepresentation.java index 9cc20709a75c..481b3e2770c1 100644 --- a/core/trino-main/src/test/java/io/trino/sql/planner/planprinter/TestAnonymizeJsonRepresentation.java +++ b/core/trino-main/src/test/java/io/trino/sql/planner/planprinter/TestAnonymizeJsonRepresentation.java @@ -49,7 +49,6 @@ import static io.airlift.json.JsonCodec.jsonCodec; import static io.trino.SessionTestUtils.TEST_SESSION; -import static io.trino.plugin.tpch.TpchConnectorFactory.TPCH_SPLITS_PER_NODE; import static io.trino.plugin.tpch.TpchMetadata.TINY_SCALE_FACTOR; import static io.trino.plugin.tpch.TpchMetadata.TINY_SCHEMA_NAME; import static io.trino.spi.predicate.Domain.all; @@ -92,7 +91,7 @@ public void setUp() { queryRunner = new StandaloneQueryRunner(TEST_SESSION); queryRunner.installPlugin(new TpchPlugin()); - queryRunner.createCatalog(TEST_SESSION.getCatalog().get(), "tpch", ImmutableMap.of(TPCH_SPLITS_PER_NODE, "1")); + queryRunner.createCatalog(TEST_SESSION.getCatalog().get(), "tpch", ImmutableMap.of("tpch.splits-per-node", "1")); } @AfterAll diff --git a/core/trino-main/src/test/java/io/trino/sql/planner/planprinter/TestJsonRepresentation.java b/core/trino-main/src/test/java/io/trino/sql/planner/planprinter/TestJsonRepresentation.java index b0b518c1399d..44c71d613c23 100644 --- a/core/trino-main/src/test/java/io/trino/sql/planner/planprinter/TestJsonRepresentation.java +++ b/core/trino-main/src/test/java/io/trino/sql/planner/planprinter/TestJsonRepresentation.java @@ -48,7 +48,6 @@ import static io.airlift.json.JsonCodec.mapJsonCodec; import static io.trino.SessionTestUtils.TEST_SESSION; import static io.trino.operator.RetryPolicy.NONE; -import static io.trino.plugin.tpch.TpchConnectorFactory.TPCH_SPLITS_PER_NODE; import static io.trino.plugin.tpch.TpchMetadata.TINY_SCHEMA_NAME; import static io.trino.spi.type.BigintType.BIGINT; import static io.trino.spi.type.IntegerType.INTEGER; @@ -81,7 +80,7 @@ public void setUp() // the expected values below simple non-distributed plans queryRunner = new StandaloneQueryRunner(TEST_SESSION); queryRunner.installPlugin(new TpchPlugin()); - queryRunner.createCatalog(TEST_SESSION.getCatalog().get(), "tpch", ImmutableMap.of(TPCH_SPLITS_PER_NODE, "1")); + queryRunner.createCatalog(TEST_SESSION.getCatalog().get(), "tpch", ImmutableMap.of("tpch.splits-per-node", "1")); } @AfterAll diff --git a/core/trino-main/src/test/java/io/trino/sql/query/TestCheckConstraint.java b/core/trino-main/src/test/java/io/trino/sql/query/TestCheckConstraint.java index 017df2cecb0e..bd32524bb239 100644 --- a/core/trino-main/src/test/java/io/trino/sql/query/TestCheckConstraint.java +++ b/core/trino-main/src/test/java/io/trino/sql/query/TestCheckConstraint.java @@ -30,7 +30,6 @@ import static io.trino.connector.MockConnectorEntities.TPCH_NATION_DATA; import static io.trino.connector.MockConnectorEntities.TPCH_NATION_SCHEMA; -import static io.trino.plugin.tpch.TpchConnectorFactory.TPCH_SPLITS_PER_NODE; import static io.trino.plugin.tpch.TpchMetadata.TINY_SCHEMA_NAME; import static io.trino.testing.TestingSession.testSessionBuilder; import static org.assertj.core.api.Assertions.assertThat; @@ -58,7 +57,7 @@ public TestCheckConstraint() QueryRunner runner = new StandaloneQueryRunner(SESSION); runner.installPlugin(new TpchPlugin()); - runner.createCatalog(LOCAL_CATALOG, "tpch", ImmutableMap.of(TPCH_SPLITS_PER_NODE, "1")); + runner.createCatalog(LOCAL_CATALOG, "tpch", ImmutableMap.of("tpch.splits-per-node", "1")); runner.installPlugin(new MockConnectorPlugin(MockConnectorFactory.builder() .withGetColumns(schemaTableName -> { diff --git a/core/trino-main/src/test/java/io/trino/sql/query/TestColumnMask.java b/core/trino-main/src/test/java/io/trino/sql/query/TestColumnMask.java index 94eb4684502c..e34e11f9d23b 100644 --- a/core/trino-main/src/test/java/io/trino/sql/query/TestColumnMask.java +++ b/core/trino-main/src/test/java/io/trino/sql/query/TestColumnMask.java @@ -43,7 +43,6 @@ import static io.trino.connector.MockConnectorEntities.TPCH_NATION_WITH_HIDDEN_COLUMN; import static io.trino.connector.MockConnectorEntities.TPCH_WITH_HIDDEN_COLUMN_DATA; -import static io.trino.plugin.tpch.TpchConnectorFactory.TPCH_SPLITS_PER_NODE; import static io.trino.plugin.tpch.TpchMetadata.TINY_SCHEMA_NAME; import static io.trino.spi.type.IntegerType.INTEGER; import static io.trino.testing.TestingAccessControlManager.TestingPrivilegeType.SELECT_COLUMN; @@ -76,7 +75,7 @@ public TestColumnMask() { QueryRunner runner = new StandaloneQueryRunner(SESSION); runner.installPlugin(new TpchPlugin()); - runner.createCatalog(LOCAL_CATALOG, "tpch", ImmutableMap.of(TPCH_SPLITS_PER_NODE, "1")); + runner.createCatalog(LOCAL_CATALOG, "tpch", ImmutableMap.of("tpch.splits-per-node", "1")); ConnectorViewDefinition view = new ConnectorViewDefinition( "SELECT nationkey, name FROM local.tiny.nation", diff --git a/core/trino-main/src/test/java/io/trino/sql/query/TestInlineFunctions.java b/core/trino-main/src/test/java/io/trino/sql/query/TestInlineFunctions.java index d856ee868183..f0d0f1160ddb 100644 --- a/core/trino-main/src/test/java/io/trino/sql/query/TestInlineFunctions.java +++ b/core/trino-main/src/test/java/io/trino/sql/query/TestInlineFunctions.java @@ -37,7 +37,6 @@ import java.util.Map; import static com.google.common.base.Preconditions.checkState; -import static io.trino.plugin.tpch.TpchConnectorFactory.TPCH_SPLITS_PER_NODE; import static io.trino.plugin.tpch.TpchMetadata.TINY_SCHEMA_NAME; import static io.trino.spi.StandardErrorCode.FUNCTION_IMPLEMENTATION_ERROR; import static io.trino.spi.StandardErrorCode.INVALID_FUNCTION_PROPERTY; @@ -69,7 +68,7 @@ public TestInlineFunctions() QueryRunner runner = new StandaloneQueryRunner(session); runner.installPlugin(new TpchPlugin()); - runner.createCatalog(TEST_CATALOG_NAME, "tpch", ImmutableMap.of(TPCH_SPLITS_PER_NODE, "1")); + runner.createCatalog(TEST_CATALOG_NAME, "tpch", ImmutableMap.of("tpch.splits-per-node", "1")); runner.installPlugin(new TestingLanguageEnginePlugin()); assertions = new QueryAssertions(runner); diff --git a/core/trino-main/src/test/java/io/trino/sql/query/TestIssue16101.java b/core/trino-main/src/test/java/io/trino/sql/query/TestIssue16101.java index 62e46d8e36d8..7f6dc0663035 100644 --- a/core/trino-main/src/test/java/io/trino/sql/query/TestIssue16101.java +++ b/core/trino-main/src/test/java/io/trino/sql/query/TestIssue16101.java @@ -22,7 +22,6 @@ import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.parallel.Execution; -import static io.trino.plugin.tpch.TpchConnectorFactory.TPCH_SPLITS_PER_NODE; import static io.trino.plugin.tpch.TpchMetadata.TINY_SCHEMA_NAME; import static io.trino.testing.TestingSession.testSessionBuilder; import static org.assertj.core.api.Assertions.assertThat; @@ -43,7 +42,7 @@ public void test() QueryRunner runner = new StandaloneQueryRunner(session); runner.installPlugin(new TpchPlugin()); - runner.createCatalog("local", "tpch", ImmutableMap.of(TPCH_SPLITS_PER_NODE, "1")); + runner.createCatalog("local", "tpch", ImmutableMap.of("tpch.splits-per-node", "1")); try (QueryAssertions assertions = new QueryAssertions(runner)) { assertThat(assertions.query( diff --git a/core/trino-main/src/test/java/io/trino/sql/query/TestNestedLogicalBinaryExpression.java b/core/trino-main/src/test/java/io/trino/sql/query/TestNestedLogicalBinaryExpression.java index bec5f2a26222..0d247bf6d350 100644 --- a/core/trino-main/src/test/java/io/trino/sql/query/TestNestedLogicalBinaryExpression.java +++ b/core/trino-main/src/test/java/io/trino/sql/query/TestNestedLogicalBinaryExpression.java @@ -23,7 +23,6 @@ import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.parallel.Execution; -import static io.trino.plugin.tpch.TpchConnectorFactory.TPCH_SPLITS_PER_NODE; import static io.trino.plugin.tpch.TpchMetadata.TINY_SCHEMA_NAME; import static io.trino.testing.TestingHandles.TEST_CATALOG_NAME; import static io.trino.testing.TestingSession.testSessionBuilder; @@ -49,7 +48,7 @@ public TestNestedLogicalBinaryExpression() QueryRunner runner = new StandaloneQueryRunner(session); runner.installPlugin(new TpchPlugin()); - runner.createCatalog(TEST_CATALOG_NAME, "tpch", ImmutableMap.of(TPCH_SPLITS_PER_NODE, "1")); + runner.createCatalog(TEST_CATALOG_NAME, "tpch", ImmutableMap.of("tpch.splits-per-node", "1")); assertions = new QueryAssertions(runner); } diff --git a/core/trino-main/src/test/java/io/trino/sql/query/TestRowFilter.java b/core/trino-main/src/test/java/io/trino/sql/query/TestRowFilter.java index d4e9ba93a45e..5d4cd04004a4 100644 --- a/core/trino-main/src/test/java/io/trino/sql/query/TestRowFilter.java +++ b/core/trino-main/src/test/java/io/trino/sql/query/TestRowFilter.java @@ -41,7 +41,6 @@ import static io.trino.connector.MockConnectorEntities.TPCH_NATION_WITH_HIDDEN_COLUMN; import static io.trino.connector.MockConnectorEntities.TPCH_NATION_WITH_OPTIONAL_COLUMN; import static io.trino.connector.MockConnectorEntities.TPCH_WITH_HIDDEN_COLUMN_DATA; -import static io.trino.plugin.tpch.TpchConnectorFactory.TPCH_SPLITS_PER_NODE; import static io.trino.plugin.tpch.TpchMetadata.TINY_SCHEMA_NAME; import static io.trino.spi.StandardErrorCode.COLUMN_NOT_FOUND; import static io.trino.spi.StandardErrorCode.EXPRESSION_NOT_SCALAR; @@ -78,7 +77,7 @@ public TestRowFilter() { QueryRunner runner = new StandaloneQueryRunner(SESSION); runner.installPlugin(new TpchPlugin()); - runner.createCatalog(LOCAL_CATALOG, "tpch", ImmutableMap.of(TPCH_SPLITS_PER_NODE, "1")); + runner.createCatalog(LOCAL_CATALOG, "tpch", ImmutableMap.of("tpch.splits-per-node", "1")); ConnectorViewDefinition view = new ConnectorViewDefinition( "SELECT nationkey, name FROM local.tiny.nation", diff --git a/core/trino-main/src/test/java/io/trino/sql/query/TestSubqueries.java b/core/trino-main/src/test/java/io/trino/sql/query/TestSubqueries.java index 6c7807e7f4b4..f1f0f1d08791 100644 --- a/core/trino-main/src/test/java/io/trino/sql/query/TestSubqueries.java +++ b/core/trino-main/src/test/java/io/trino/sql/query/TestSubqueries.java @@ -35,7 +35,6 @@ import java.util.List; import java.util.Optional; -import static io.trino.plugin.tpch.TpchConnectorFactory.TPCH_SPLITS_PER_NODE; import static io.trino.plugin.tpch.TpchMetadata.TINY_SCHEMA_NAME; import static io.trino.spi.type.DecimalType.createDecimalType; import static io.trino.spi.type.IntegerType.INTEGER; @@ -86,7 +85,7 @@ public TestSubqueries() QueryRunner runner = new StandaloneQueryRunner(session); runner.installPlugin(new TpchPlugin()); - runner.createCatalog(TEST_CATALOG_NAME, "tpch", ImmutableMap.of(TPCH_SPLITS_PER_NODE, "1")); + runner.createCatalog(TEST_CATALOG_NAME, "tpch", ImmutableMap.of("tpch.splits-per-node", "1")); assertions = new QueryAssertions(runner); } diff --git a/core/trino-main/src/test/java/io/trino/sql/query/TestWith.java b/core/trino-main/src/test/java/io/trino/sql/query/TestWith.java index 2d7b6bc94cfa..a6f158093fe6 100644 --- a/core/trino-main/src/test/java/io/trino/sql/query/TestWith.java +++ b/core/trino-main/src/test/java/io/trino/sql/query/TestWith.java @@ -23,7 +23,6 @@ import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.parallel.Execution; -import static io.trino.plugin.tpch.TpchConnectorFactory.TPCH_SPLITS_PER_NODE; import static io.trino.plugin.tpch.TpchMetadata.TINY_SCHEMA_NAME; import static io.trino.testing.TestingHandles.TEST_CATALOG_NAME; import static io.trino.testing.TestingSession.testSessionBuilder; @@ -48,7 +47,7 @@ public TestWith() QueryRunner runner = new StandaloneQueryRunner(session); runner.installPlugin(new TpchPlugin()); - runner.createCatalog(TEST_CATALOG_NAME, "tpch", ImmutableMap.of(TPCH_SPLITS_PER_NODE, "1")); + runner.createCatalog(TEST_CATALOG_NAME, "tpch", ImmutableMap.of("tpch.splits-per-node", "1")); assertions = new QueryAssertions(runner); } diff --git a/plugin/trino-functions-python/src/test/java/io/trino/plugin/functions/python/TestPythonFunctions.java b/plugin/trino-functions-python/src/test/java/io/trino/plugin/functions/python/TestPythonFunctions.java index b73b9a91f526..203feec7f042 100644 --- a/plugin/trino-functions-python/src/test/java/io/trino/plugin/functions/python/TestPythonFunctions.java +++ b/plugin/trino-functions-python/src/test/java/io/trino/plugin/functions/python/TestPythonFunctions.java @@ -25,7 +25,6 @@ import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.parallel.Execution; -import static io.trino.plugin.tpch.TpchConnectorFactory.TPCH_SPLITS_PER_NODE; import static io.trino.plugin.tpch.TpchMetadata.TINY_SCHEMA_NAME; import static io.trino.spi.StandardErrorCode.DIVISION_BY_ZERO; import static io.trino.spi.StandardErrorCode.EXCEEDED_FUNCTION_MEMORY_LIMIT; @@ -55,7 +54,7 @@ public void init() QueryRunner runner = new StandaloneQueryRunner(session); runner.installPlugin(new TpchPlugin()); - runner.createCatalog(TEST_CATALOG_NAME, "tpch", ImmutableMap.of(TPCH_SPLITS_PER_NODE, "1")); + runner.createCatalog(TEST_CATALOG_NAME, "tpch", ImmutableMap.of("tpch.splits-per-node", "1")); runner.installPlugin(new PythonFunctionsPlugin()); assertions = new QueryAssertions(runner); diff --git a/plugin/trino-ml/src/test/java/io/trino/plugin/ml/TestMLQueries.java b/plugin/trino-ml/src/test/java/io/trino/plugin/ml/TestMLQueries.java index 8098884f39ec..f37f0340c555 100644 --- a/plugin/trino-ml/src/test/java/io/trino/plugin/ml/TestMLQueries.java +++ b/plugin/trino-ml/src/test/java/io/trino/plugin/ml/TestMLQueries.java @@ -21,7 +21,6 @@ import io.trino.testing.StandaloneQueryRunner; import org.junit.jupiter.api.Test; -import static io.trino.plugin.tpch.TpchConnectorFactory.TPCH_SPLITS_PER_NODE; import static io.trino.plugin.tpch.TpchMetadata.TINY_SCHEMA_NAME; import static io.trino.testing.TestingSession.testSessionBuilder; @@ -38,7 +37,7 @@ protected QueryRunner createQueryRunner() QueryRunner queryRunner = new StandaloneQueryRunner(defaultSession); queryRunner.installPlugin(new TpchPlugin()); - queryRunner.createCatalog(defaultSession.getCatalog().get(), "tpch", ImmutableMap.of(TPCH_SPLITS_PER_NODE, "1")); + queryRunner.createCatalog(defaultSession.getCatalog().get(), "tpch", ImmutableMap.of("tpch.splits-per-node", "1")); queryRunner.installPlugin(new MLPlugin()); return queryRunner; diff --git a/plugin/trino-tpch/pom.xml b/plugin/trino-tpch/pom.xml index 36067fff8132..be0d42deb691 100644 --- a/plugin/trino-tpch/pom.xml +++ b/plugin/trino-tpch/pom.xml @@ -19,13 +19,28 @@ - com.fasterxml.jackson.datatype - jackson-datatype-jdk8 + com.google.guava + guava - com.google.guava - guava + com.google.inject + guice + + + + io.airlift + bootstrap + + + + io.airlift + configuration + + + + io.airlift + json @@ -38,6 +53,11 @@ tpch + + org.weakref + jmxutils + + com.fasterxml.jackson.core jackson-annotations @@ -74,6 +94,12 @@ provided + + com.fasterxml.jackson.datatype + jackson-datatype-jdk8 + runtime + + io.airlift junit-extensions diff --git a/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchConfig.java b/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchConfig.java new file mode 100644 index 000000000000..da9e919d58e9 --- /dev/null +++ b/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchConfig.java @@ -0,0 +1,137 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.trino.plugin.tpch; + +import io.airlift.configuration.Config; + +public class TpchConfig +{ + private ColumnNaming columnNaming = ColumnNaming.SIMPLIFIED; + private DecimalTypeMapping decimalTypeMapping = DecimalTypeMapping.DOUBLE; + private boolean producePages; + private int maxRowsPerPage = 1_000_000; + private String tableScanRedirectionCatalog; + private String tableScanRedirectionSchema; + private int splitsPerNode; + private boolean partitioningEnabled = true; + private boolean predicatePushdownEnabled = true; + + public ColumnNaming getColumnNaming() + { + return columnNaming; + } + + @Config("tpch.column-naming") + public TpchConfig setColumnNaming(ColumnNaming columnNaming) + { + this.columnNaming = columnNaming; + return this; + } + + public DecimalTypeMapping getDecimalTypeMapping() + { + return decimalTypeMapping; + } + + @Config("tpch.double-type-mapping") + public TpchConfig setDecimalTypeMapping(DecimalTypeMapping decimalTypeMapping) + { + this.decimalTypeMapping = decimalTypeMapping; + return this; + } + + public boolean isProducePages() + { + return producePages; + } + + @Config("tpch.produce-pages") + public TpchConfig setProducePages(boolean producePages) + { + this.producePages = producePages; + return this; + } + + public int getMaxRowsPerPage() + { + return maxRowsPerPage; + } + + @Config("tpch.max-rows-per-page") + public TpchConfig setMaxRowsPerPage(int maxRowsPerPage) + { + this.maxRowsPerPage = maxRowsPerPage; + return this; + } + + public String getTableScanRedirectionCatalog() + { + return tableScanRedirectionCatalog; + } + + @Config("tpch.table-scan-redirection-catalog") + public TpchConfig setTableScanRedirectionCatalog(String tableScanRedirectionCatalog) + { + this.tableScanRedirectionCatalog = tableScanRedirectionCatalog; + return this; + } + + public String getTableScanRedirectionSchema() + { + return tableScanRedirectionSchema; + } + + @Config("tpch.table-scan-redirection-schema") + public TpchConfig setTableScanRedirectionSchema(String tableScanRedirectionSchema) + { + this.tableScanRedirectionSchema = tableScanRedirectionSchema; + return this; + } + + public int getSplitsPerNode() + { + return splitsPerNode; + } + + @Config("tpch.splits-per-node") + public TpchConfig setSplitsPerNode(int splitsPerNode) + { + this.splitsPerNode = splitsPerNode; + return this; + } + + public boolean isPartitioningEnabled() + { + return partitioningEnabled; + } + + @Config("tpch.partitioning-enabled") + public TpchConfig setPartitioningEnabled(boolean partitioningEnabled) + { + this.partitioningEnabled = partitioningEnabled; + return this; + } + + public boolean isPredicatePushdownEnabled() + { + return predicatePushdownEnabled; + } + + @Config("tpch.predicate-pushdown-enabled") + public TpchConfig setPredicatePushdownEnabled(boolean predicatePushdownEnabled) + { + this.predicatePushdownEnabled = predicatePushdownEnabled; + return this; + } +} diff --git a/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchConnector.java b/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchConnector.java new file mode 100644 index 000000000000..1abdb330156d --- /dev/null +++ b/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchConnector.java @@ -0,0 +1,93 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.trino.plugin.tpch; + +import com.google.inject.Inject; +import io.trino.spi.connector.Connector; +import io.trino.spi.connector.ConnectorMetadata; +import io.trino.spi.connector.ConnectorNodePartitioningProvider; +import io.trino.spi.connector.ConnectorPageSourceProvider; +import io.trino.spi.connector.ConnectorRecordSetProvider; +import io.trino.spi.connector.ConnectorSession; +import io.trino.spi.connector.ConnectorSplitManager; +import io.trino.spi.connector.ConnectorTransactionHandle; +import io.trino.spi.transaction.IsolationLevel; + +import static java.util.Objects.requireNonNull; + +public class TpchConnector + implements Connector +{ + private final ConnectorMetadata metadata; + private final ConnectorSplitManager splitManager; + private final ConnectorNodePartitioningProvider nodePartitioningProvider; + private final ConnectorRecordSetProvider recordSetProvider; + private final ConnectorPageSourceProvider pageSourceProvider; + private final boolean producePages; + + @Inject + public TpchConnector(ConnectorMetadata metadata, ConnectorSplitManager splitManager, ConnectorNodePartitioningProvider nodePartitioningProvider, ConnectorRecordSetProvider recordSetProvider, ConnectorPageSourceProvider pageSourceProvider, TpchConfig config) + { + this.metadata = requireNonNull(metadata, "metadata is null"); + this.splitManager = requireNonNull(splitManager, "splitManager is null"); + this.nodePartitioningProvider = requireNonNull(nodePartitioningProvider, "nodePartitioningProvider is null"); + this.recordSetProvider = requireNonNull(recordSetProvider, "recordSetProvider is null"); + this.pageSourceProvider = requireNonNull(pageSourceProvider, "pageSourceProvider is null"); + this.producePages = requireNonNull(config, "config is null").isProducePages(); + } + + @Override + public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit) + { + return TpchTransactionHandle.INSTANCE; + } + + @Override + public ConnectorMetadata getMetadata(ConnectorSession session, ConnectorTransactionHandle transaction) + { + return metadata; + } + + @Override + public ConnectorSplitManager getSplitManager() + { + return splitManager; + } + + @Override + public ConnectorPageSourceProvider getPageSourceProvider() + { + if (producePages) { + return pageSourceProvider; + } + + throw new UnsupportedOperationException(); + } + + @Override + public ConnectorRecordSetProvider getRecordSetProvider() + { + if (!producePages) { + return recordSetProvider; + } + + throw new UnsupportedOperationException(); + } + + @Override + public ConnectorNodePartitioningProvider getNodePartitioningProvider() + { + return nodePartitioningProvider; + } +} diff --git a/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchConnectorFactory.java b/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchConnectorFactory.java index ec06eecfaefc..caab168d5ecb 100644 --- a/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchConnectorFactory.java +++ b/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchConnectorFactory.java @@ -13,41 +13,23 @@ */ package io.trino.plugin.tpch; -import io.trino.spi.NodeManager; +import com.google.inject.Injector; +import io.airlift.bootstrap.Bootstrap; +import io.airlift.json.JsonModule; +import io.opentelemetry.api.OpenTelemetry; +import io.trino.plugin.base.jmx.MBeanServerModule; import io.trino.spi.connector.Connector; import io.trino.spi.connector.ConnectorContext; import io.trino.spi.connector.ConnectorFactory; -import io.trino.spi.connector.ConnectorMetadata; -import io.trino.spi.connector.ConnectorNodePartitioningProvider; -import io.trino.spi.connector.ConnectorPageSourceProvider; -import io.trino.spi.connector.ConnectorRecordSetProvider; -import io.trino.spi.connector.ConnectorSession; -import io.trino.spi.connector.ConnectorSplitManager; -import io.trino.spi.connector.ConnectorTransactionHandle; -import io.trino.spi.transaction.IsolationLevel; +import org.weakref.jmx.guice.MBeanModule; import java.util.Map; -import java.util.Optional; -import static com.google.common.base.MoreObjects.firstNonNull; import static io.trino.plugin.base.Versions.checkStrictSpiVersionMatch; -import static java.lang.Boolean.FALSE; -import static java.lang.String.format; -import static java.util.Locale.ENGLISH; public class TpchConnectorFactory implements ConnectorFactory { - public static final String TPCH_COLUMN_NAMING_PROPERTY = "tpch.column-naming"; - public static final String TPCH_DOUBLE_TYPE_MAPPING_PROPERTY = "tpch.double-type-mapping"; - public static final String TPCH_PRODUCE_PAGES = "tpch.produce-pages"; - public static final String TPCH_MAX_ROWS_PER_PAGE_PROPERTY = "tpch.max-rows-per-page"; - public static final String TPCH_TABLE_SCAN_REDIRECTION_CATALOG = "tpch.table-scan-redirection-catalog"; - public static final String TPCH_TABLE_SCAN_REDIRECTION_SCHEMA = "tpch.table-scan-redirection-schema"; - public static final String TPCH_SPLITS_PER_NODE = "tpch.splits-per-node"; - public static final String TPCH_PARTITIONING_ENABLED = "tpch.partitioning-enabled"; - private static final int DEFAULT_MAX_ROWS_PER_PAGE = 1_000_000; - private final int defaultSplitsPerNode; private final boolean predicatePushdownEnabled; @@ -78,98 +60,17 @@ public Connector create(String catalogName, Map properties, Conn { checkStrictSpiVersionMatch(context, this); - int splitsPerNode = getSplitsPerNode(properties); - ColumnNaming columnNaming = ColumnNaming.valueOf(properties.getOrDefault(TPCH_COLUMN_NAMING_PROPERTY, ColumnNaming.SIMPLIFIED.name()).toUpperCase(ENGLISH)); - DecimalTypeMapping decimalTypeMapping = DecimalTypeMapping.valueOf(properties.getOrDefault(TPCH_DOUBLE_TYPE_MAPPING_PROPERTY, DecimalTypeMapping.DOUBLE.name()).toUpperCase(ENGLISH)); - boolean partitioningEnabled = Boolean.parseBoolean(properties.getOrDefault(TPCH_PARTITIONING_ENABLED, "true")); - NodeManager nodeManager = context.getNodeManager(); - - return new Connector() - { - @Override - public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit) - { - return TpchTransactionHandle.INSTANCE; - } - - @Override - public ConnectorMetadata getMetadata(ConnectorSession session, ConnectorTransactionHandle transaction) - { - return new TpchMetadata( - columnNaming, - decimalTypeMapping, - predicatePushdownEnabled, - partitioningEnabled, - getTpchTableScanRedirectionCatalog(properties), - getTpchTableScanRedirectionSchema(properties)); - } - - @Override - public ConnectorSplitManager getSplitManager() - { - return new TpchSplitManager(nodeManager, splitsPerNode); - } - - @Override - public ConnectorPageSourceProvider getPageSourceProvider() - { - if (isProducePages(properties)) { - return new TpchPageSourceProvider(getMaxRowsPerPage(properties), decimalTypeMapping); - } - - throw new UnsupportedOperationException(); - } - - @Override - public ConnectorRecordSetProvider getRecordSetProvider() - { - if (!isProducePages(properties)) { - return new TpchRecordSetProvider(decimalTypeMapping); - } - - throw new UnsupportedOperationException(); - } - - @Override - public ConnectorNodePartitioningProvider getNodePartitioningProvider() - { - return new TpchNodePartitioningProvider(nodeManager, splitsPerNode); - } - }; - } - - private int getSplitsPerNode(Map properties) - { - try { - return Integer.parseInt(firstNonNull(properties.get(TPCH_SPLITS_PER_NODE), String.valueOf(defaultSplitsPerNode))); - } - catch (NumberFormatException e) { - throw new IllegalArgumentException("Invalid property " + TPCH_SPLITS_PER_NODE); - } - } + Bootstrap app = new Bootstrap( + binder -> binder.bind(OpenTelemetry.class).toInstance(context.getOpenTelemetry()), + new MBeanModule(), + new JsonModule(), + new TpchModule(context.getNodeManager(), defaultSplitsPerNode, predicatePushdownEnabled), + new MBeanServerModule()); - private boolean isProducePages(Map properties) - { - return Boolean.parseBoolean(firstNonNull(properties.get(TPCH_PRODUCE_PAGES), FALSE.toString())); - } + Injector injector = app.doNotInitializeLogging() + .setRequiredConfigurationProperties(properties) + .initialize(); - private int getMaxRowsPerPage(Map properties) - { - try { - return Integer.parseInt(firstNonNull(properties.get(TPCH_MAX_ROWS_PER_PAGE_PROPERTY), String.valueOf(DEFAULT_MAX_ROWS_PER_PAGE))); - } - catch (NumberFormatException e) { - throw new IllegalArgumentException(format("Invalid property %s", TPCH_MAX_ROWS_PER_PAGE_PROPERTY)); - } - } - - private Optional getTpchTableScanRedirectionCatalog(Map properties) - { - return Optional.ofNullable(properties.get(TPCH_TABLE_SCAN_REDIRECTION_CATALOG)); - } - - private Optional getTpchTableScanRedirectionSchema(Map properties) - { - return Optional.ofNullable(properties.get(TPCH_TABLE_SCAN_REDIRECTION_SCHEMA)); + return injector.getInstance(Connector.class); } } diff --git a/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchMetadata.java b/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchMetadata.java index 90cd6c52a498..c4a500b3aeb7 100644 --- a/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchMetadata.java +++ b/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchMetadata.java @@ -14,12 +14,13 @@ package io.trino.plugin.tpch; import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.ImmutableBiMap; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; +import com.google.inject.Inject; +import io.airlift.json.ObjectMapperProvider; import io.airlift.slice.Slice; import io.airlift.slice.Slices; import io.trino.plugin.tpch.statistics.ColumnStatisticsData; @@ -134,10 +135,17 @@ public class TpchMetadata public TpchMetadata() { - this(ColumnNaming.SIMPLIFIED, DecimalTypeMapping.DOUBLE, true, true, Optional.empty(), Optional.empty()); + this(new ObjectMapperProvider().get(), ColumnNaming.SIMPLIFIED, DecimalTypeMapping.DOUBLE, true, true, Optional.empty(), Optional.empty()); + } + + @Inject + public TpchMetadata(TpchConfig config, ObjectMapper mapper) + { + this(mapper, config.getColumnNaming(), config.getDecimalTypeMapping(), config.isPredicatePushdownEnabled(), config.isPartitioningEnabled(), Optional.ofNullable(config.getTableScanRedirectionCatalog()), Optional.ofNullable(config.getTableScanRedirectionSchema())); } public TpchMetadata( + ObjectMapper objectMapper, ColumnNaming columnNaming, DecimalTypeMapping decimalTypeMapping, boolean predicatePushdownEnabled, @@ -154,7 +162,7 @@ public TpchMetadata( this.decimalTypeMapping = decimalTypeMapping; this.predicatePushdownEnabled = predicatePushdownEnabled; this.partitioningEnabled = partitioningEnabled; - this.statisticsEstimator = createStatisticsEstimator(); + this.statisticsEstimator = createStatisticsEstimator(objectMapper); this.destinationCatalog = destinationCatalog; this.destinationSchema = destinationSchema; @@ -169,10 +177,8 @@ public TpchMetadata( .collect(toSet()); } - private static StatisticsEstimator createStatisticsEstimator() + private static StatisticsEstimator createStatisticsEstimator(ObjectMapper objectMapper) { - ObjectMapper objectMapper = new ObjectMapper() - .registerModule(new Jdk8Module()); TableStatisticsDataRepository tableStatisticsDataRepository = new TableStatisticsDataRepository(objectMapper); return new StatisticsEstimator(tableStatisticsDataRepository); } diff --git a/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchModule.java b/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchModule.java new file mode 100644 index 000000000000..1db55ce0390a --- /dev/null +++ b/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchModule.java @@ -0,0 +1,61 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.trino.plugin.tpch; + +import com.google.inject.Binder; +import com.google.inject.Scopes; +import io.airlift.configuration.AbstractConfigurationAwareModule; +import io.trino.spi.NodeManager; +import io.trino.spi.connector.Connector; +import io.trino.spi.connector.ConnectorMetadata; +import io.trino.spi.connector.ConnectorNodePartitioningProvider; +import io.trino.spi.connector.ConnectorPageSourceProvider; +import io.trino.spi.connector.ConnectorRecordSetProvider; +import io.trino.spi.connector.ConnectorSplitManager; + +import static io.airlift.configuration.ConfigBinder.configBinder; +import static java.util.Objects.requireNonNull; + +public class TpchModule + extends AbstractConfigurationAwareModule +{ + private final NodeManager nodeManager; + private final int defaultSplitsPerNode; + private final boolean predicatePushdownEnabled; + + public TpchModule(NodeManager nodeManager, int defaultSplitsPerNode, boolean predicatePushdownEnabled) + { + this.nodeManager = requireNonNull(nodeManager, "nodeManager is null"); + this.defaultSplitsPerNode = defaultSplitsPerNode; + this.predicatePushdownEnabled = predicatePushdownEnabled; + } + + @Override + protected void setup(Binder binder) + { + binder.bind(NodeManager.class).toInstance(nodeManager); + binder.bind(Connector.class).to(TpchConnector.class).in(Scopes.SINGLETON); + binder.bind(ConnectorMetadata.class).to(TpchMetadata.class).in(Scopes.SINGLETON); + binder.bind(ConnectorRecordSetProvider.class).to(TpchRecordSetProvider.class).in(Scopes.SINGLETON); + binder.bind(ConnectorPageSourceProvider.class).to(TpchPageSourceProvider.class).in(Scopes.SINGLETON); + binder.bind(ConnectorSplitManager.class).to(TpchSplitManager.class).in(Scopes.SINGLETON); + binder.bind(ConnectorNodePartitioningProvider.class).to(TpchNodePartitioningProvider.class).in(Scopes.SINGLETON); + + configBinder(binder).bindConfig(TpchConfig.class); + configBinder(binder).bindConfigDefaults(TpchConfig.class, config -> { + config.setSplitsPerNode(defaultSplitsPerNode); + config.setPredicatePushdownEnabled(predicatePushdownEnabled); + }); + } +} diff --git a/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchNodePartitioningProvider.java b/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchNodePartitioningProvider.java index b95848d0169d..f05ae1f651a2 100644 --- a/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchNodePartitioningProvider.java +++ b/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchNodePartitioningProvider.java @@ -14,6 +14,7 @@ package io.trino.plugin.tpch; import com.google.common.collect.ImmutableList; +import com.google.inject.Inject; import io.trino.spi.Node; import io.trino.spi.NodeManager; import io.trino.spi.connector.BucketFunction; @@ -36,6 +37,7 @@ import static io.trino.spi.connector.ConnectorBucketNodeMap.createBucketNodeMap; import static io.trino.spi.type.BigintType.BIGINT; import static java.util.Comparator.comparing; +import static java.util.Objects.requireNonNull; public class TpchNodePartitioningProvider implements ConnectorNodePartitioningProvider @@ -43,6 +45,12 @@ public class TpchNodePartitioningProvider private final NodeManager nodeManager; private final int splitsPerNode; + @Inject + public TpchNodePartitioningProvider(NodeManager nodeManager, TpchConfig config) + { + this(requireNonNull(nodeManager, "nodeManager is null"), requireNonNull(config, "config is null").getSplitsPerNode()); + } + public TpchNodePartitioningProvider(NodeManager nodeManager, int splitsPerNode) { this.nodeManager = nodeManager; diff --git a/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchPageSourceProvider.java b/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchPageSourceProvider.java index a5df782d2d45..9dfa7db8d052 100644 --- a/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchPageSourceProvider.java +++ b/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchPageSourceProvider.java @@ -13,6 +13,7 @@ */ package io.trino.plugin.tpch; +import com.google.inject.Inject; import io.trino.spi.connector.ColumnHandle; import io.trino.spi.connector.ConnectorPageSource; import io.trino.spi.connector.ConnectorPageSourceProvider; @@ -24,12 +25,20 @@ import java.util.List; +import static java.util.Objects.requireNonNull; + public class TpchPageSourceProvider implements ConnectorPageSourceProvider { private final TpchRecordSetProvider tpchRecordSetProvider; private final int maxRowsPerPage; + @Inject + TpchPageSourceProvider(TpchConfig config) + { + this(requireNonNull(config, "config is null").getMaxRowsPerPage(), config.getDecimalTypeMapping()); + } + TpchPageSourceProvider(int maxRowsPerPage, DecimalTypeMapping decimalTypeMapping) { this.tpchRecordSetProvider = new TpchRecordSetProvider(decimalTypeMapping); diff --git a/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchRecordSetProvider.java b/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchRecordSetProvider.java index 60dda4d312a0..b9ed14b8eccd 100644 --- a/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchRecordSetProvider.java +++ b/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchRecordSetProvider.java @@ -14,6 +14,7 @@ package io.trino.plugin.tpch; import com.google.common.collect.ImmutableList; +import com.google.inject.Inject; import io.trino.spi.connector.ColumnHandle; import io.trino.spi.connector.ConnectorRecordSetProvider; import io.trino.spi.connector.ConnectorSession; @@ -31,15 +32,22 @@ import static io.trino.plugin.tpch.TpchRecordSet.createTpchRecordSet; import static io.trino.tpch.TpchColumnTypes.IDENTIFIER; +import static java.util.Objects.requireNonNull; public class TpchRecordSetProvider implements ConnectorRecordSetProvider { private final DecimalTypeMapping decimalTypeMapping; + @Inject + public TpchRecordSetProvider(TpchConfig config) + { + this(requireNonNull(config, "config is null").getDecimalTypeMapping()); + } + public TpchRecordSetProvider(DecimalTypeMapping decimalTypeMapping) { - this.decimalTypeMapping = decimalTypeMapping; + this.decimalTypeMapping = requireNonNull(decimalTypeMapping, "decimalTypeMapping is null"); } @Override diff --git a/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchSplitManager.java b/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchSplitManager.java index 146ad44c389b..f3519a341e29 100644 --- a/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchSplitManager.java +++ b/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchSplitManager.java @@ -14,6 +14,7 @@ package io.trino.plugin.tpch; import com.google.common.collect.ImmutableList; +import com.google.inject.Inject; import io.trino.spi.Node; import io.trino.spi.NodeManager; import io.trino.spi.connector.ConnectorSession; @@ -32,6 +33,7 @@ import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.collect.ImmutableList.toImmutableList; import static java.util.Comparator.comparing; +import static java.util.Objects.requireNonNull; public class TpchSplitManager implements ConnectorSplitManager @@ -39,6 +41,12 @@ public class TpchSplitManager private final NodeManager nodeManager; private final int splitsPerNode; + @Inject + public TpchSplitManager(NodeManager nodeManager, TpchConfig config) + { + this(requireNonNull(nodeManager, "nodeManager is null"), requireNonNull(config, "config is null").getSplitsPerNode()); + } + public TpchSplitManager(NodeManager nodeManager, int splitsPerNode) { this.nodeManager = nodeManager; diff --git a/testing/trino-tests/src/test/java/io/trino/execution/AbstractTestCoordinatorDynamicFiltering.java b/testing/trino-tests/src/test/java/io/trino/execution/AbstractTestCoordinatorDynamicFiltering.java index f1e6a5ae40db..442c343cc4ec 100644 --- a/testing/trino-tests/src/test/java/io/trino/execution/AbstractTestCoordinatorDynamicFiltering.java +++ b/testing/trino-tests/src/test/java/io/trino/execution/AbstractTestCoordinatorDynamicFiltering.java @@ -67,8 +67,6 @@ import static io.trino.SystemSessionProperties.JOIN_DISTRIBUTION_TYPE; import static io.trino.SystemSessionProperties.JOIN_REORDERING_STRATEGY; import static io.trino.SystemSessionProperties.TASK_CONCURRENCY; -import static io.trino.plugin.tpch.TpchConnectorFactory.TPCH_PARTITIONING_ENABLED; -import static io.trino.plugin.tpch.TpchConnectorFactory.TPCH_SPLITS_PER_NODE; import static io.trino.spi.predicate.Domain.multipleValues; import static io.trino.spi.predicate.Domain.singleValue; import static io.trino.spi.predicate.Range.range; @@ -112,7 +110,7 @@ public void setup() getQueryRunner().createCatalog( "tpch", "tpch", - ImmutableMap.of(TPCH_PARTITIONING_ENABLED, "false", TPCH_SPLITS_PER_NODE, "16")); + ImmutableMap.of("tpch.partitioning-enabled", "false", "tpch.splits-per-node", "16")); getQueryRunner().createCatalog("tpcds", "tpcds", ImmutableMap.of()); getQueryRunner().createCatalog("memory", "memory", ImmutableMap.of("memory.splits-per-node", "16")); computeActual("CREATE TABLE lineitem AS SELECT * FROM tpch.tiny.lineitem"); diff --git a/testing/trino-tests/src/test/java/io/trino/execution/TestEventListenerWithSplits.java b/testing/trino-tests/src/test/java/io/trino/execution/TestEventListenerWithSplits.java index dee773021b36..017216ed9bc5 100644 --- a/testing/trino-tests/src/test/java/io/trino/execution/TestEventListenerWithSplits.java +++ b/testing/trino-tests/src/test/java/io/trino/execution/TestEventListenerWithSplits.java @@ -44,7 +44,6 @@ import static com.google.common.collect.Iterables.getOnlyElement; import static io.trino.execution.TestQueues.createResourceGroupId; -import static io.trino.plugin.tpch.TpchConnectorFactory.TPCH_SPLITS_PER_NODE; import static io.trino.testing.TestingSession.testSessionBuilder; import static java.util.concurrent.TimeUnit.SECONDS; import static java.util.stream.Collectors.toSet; @@ -76,7 +75,7 @@ protected QueryRunner createQueryRunner() queryRunner.installPlugin(new TpchPlugin()); queryRunner.installPlugin(new TestingEventListenerPlugin(generatedEvents)); queryRunner.installPlugin(new ResourceGroupManagerPlugin()); - queryRunner.createCatalog("tpch", "tpch", ImmutableMap.of(TPCH_SPLITS_PER_NODE, Integer.toString(SPLITS_PER_NODE))); + queryRunner.createCatalog("tpch", "tpch", ImmutableMap.of("tpch.splits-per-node", Integer.toString(SPLITS_PER_NODE))); queryRunner.installPlugin(new Plugin() { @Override diff --git a/testing/trino-tests/src/test/java/io/trino/execution/TestPendingStageState.java b/testing/trino-tests/src/test/java/io/trino/execution/TestPendingStageState.java index 240e15861916..1888c9753010 100644 --- a/testing/trino-tests/src/test/java/io/trino/execution/TestPendingStageState.java +++ b/testing/trino-tests/src/test/java/io/trino/execution/TestPendingStageState.java @@ -30,7 +30,6 @@ import static io.trino.execution.QueryRunnerUtil.createQuery; import static io.trino.execution.QueryRunnerUtil.waitForQueryState; import static io.trino.execution.QueryState.RUNNING; -import static io.trino.plugin.tpch.TpchConnectorFactory.TPCH_SPLITS_PER_NODE; import static io.trino.testing.assertions.Assert.assertEventually; import static java.util.concurrent.TimeUnit.SECONDS; import static org.assertj.core.api.Assertions.assertThat; @@ -48,7 +47,7 @@ public void setup() throws Exception { queryRunner = TpchQueryRunner.builder() - .withConnectorProperties(Map.of(TPCH_SPLITS_PER_NODE, "10000")) + .withConnectorProperties(Map.of("tpch.splits-per-node", "10000")) .build(); } diff --git a/testing/trino-tests/src/test/java/io/trino/tests/TestDictionaryAggregation.java b/testing/trino-tests/src/test/java/io/trino/tests/TestDictionaryAggregation.java index b40e7bd8fe58..8b42ddf5cf51 100644 --- a/testing/trino-tests/src/test/java/io/trino/tests/TestDictionaryAggregation.java +++ b/testing/trino-tests/src/test/java/io/trino/tests/TestDictionaryAggregation.java @@ -22,7 +22,6 @@ import static io.trino.SystemSessionProperties.DICTIONARY_AGGREGATION; import static io.trino.SystemSessionProperties.JOIN_REORDERING_STRATEGY; -import static io.trino.plugin.tpch.TpchConnectorFactory.TPCH_SPLITS_PER_NODE; import static io.trino.sql.planner.OptimizerConfig.JoinReorderingStrategy.NONE; import static io.trino.testing.TestingSession.testSessionBuilder; @@ -38,7 +37,7 @@ protected QueryRunner createQueryRunner() .build()); queryRunner.installPlugin(new TpchPlugin()); - queryRunner.createCatalog("tpch", "tpch", ImmutableMap.of(TPCH_SPLITS_PER_NODE, "1")); + queryRunner.createCatalog("tpch", "tpch", ImmutableMap.of("tpch.splits-per-node", "1")); return queryRunner; } diff --git a/testing/trino-tests/src/test/java/io/trino/tests/TestJoinQueries.java b/testing/trino-tests/src/test/java/io/trino/tests/TestJoinQueries.java index f445fd107549..97fb1ac8160c 100644 --- a/testing/trino-tests/src/test/java/io/trino/tests/TestJoinQueries.java +++ b/testing/trino-tests/src/test/java/io/trino/tests/TestJoinQueries.java @@ -25,7 +25,6 @@ import java.util.Map; import static com.google.common.base.Verify.verify; -import static io.trino.plugin.tpch.TpchConnectorFactory.TPCH_SPLITS_PER_NODE; import static io.trino.testing.QueryAssertions.assertEqualsIgnoreOrder; /** @@ -82,7 +81,7 @@ public void testBroadcastJoinDeadlockResolution() // make sure the build side will get blocked on a broadcast buffer "sink.max-broadcast-buffer-size", "1kB")) // make sure the connector produces enough splits for the scheduling to block on a split placement - .withConnectorProperties(Map.of(TPCH_SPLITS_PER_NODE, "10")) + .withConnectorProperties(Map.of("tpch.splits-per-node", "10")) .build()) { String sql = "SELECT * FROM supplier s INNER JOIN lineitem l ON s.suppkey = l.suppkey"; MaterializedResult actual = queryRunner.execute(sql); diff --git a/testing/trino-tests/src/test/java/io/trino/tests/TestLocalQueries.java b/testing/trino-tests/src/test/java/io/trino/tests/TestLocalQueries.java index 630a78691ef7..0c9f2ab27f77 100644 --- a/testing/trino-tests/src/test/java/io/trino/tests/TestLocalQueries.java +++ b/testing/trino-tests/src/test/java/io/trino/tests/TestLocalQueries.java @@ -23,7 +23,6 @@ import org.junit.jupiter.api.Test; import static io.trino.SystemSessionProperties.PUSH_PARTIAL_AGGREGATION_THROUGH_JOIN; -import static io.trino.plugin.tpch.TpchConnectorFactory.TPCH_SPLITS_PER_NODE; import static io.trino.plugin.tpch.TpchMetadata.TINY_SCHEMA_NAME; import static io.trino.spi.type.DoubleType.DOUBLE; import static io.trino.spi.type.VarcharType.VARCHAR; @@ -50,7 +49,7 @@ public static QueryRunner createTestQueryRunner() QueryRunner queryRunner = new StandaloneQueryRunner(defaultSession); queryRunner.installPlugin(new TpchPlugin()); - queryRunner.createCatalog(defaultSession.getCatalog().get(), "tpch", ImmutableMap.of(TPCH_SPLITS_PER_NODE, "1")); + queryRunner.createCatalog(defaultSession.getCatalog().get(), "tpch", ImmutableMap.of("tpch.splits-per-node", "1")); queryRunner.installPlugin(new MemoryPlugin()); queryRunner.createCatalog("memory", "memory"); diff --git a/testing/trino-tests/src/test/java/io/trino/tests/TestQueryPlanDeterminism.java b/testing/trino-tests/src/test/java/io/trino/tests/TestQueryPlanDeterminism.java index 106cd9db852e..41cdee23fe91 100644 --- a/testing/trino-tests/src/test/java/io/trino/tests/TestQueryPlanDeterminism.java +++ b/testing/trino-tests/src/test/java/io/trino/tests/TestQueryPlanDeterminism.java @@ -32,7 +32,6 @@ import java.util.List; -import static io.trino.plugin.tpch.TpchConnectorFactory.TPCH_SPLITS_PER_NODE; import static io.trino.plugin.tpch.TpchMetadata.TINY_SCHEMA_NAME; import static io.trino.testing.CustomFunctionBundle.CUSTOM_FUNCTIONS; import static io.trino.testing.TestingSession.testSessionBuilder; @@ -70,7 +69,7 @@ protected QueryRunner createQueryRunner() queryRunner.createCatalog( defaultSession.getCatalog().get(), "tpch", - ImmutableMap.of(TPCH_SPLITS_PER_NODE, "1")); + ImmutableMap.of("tpch.splits-per-node", "1")); queryRunner.addFunctions(CUSTOM_FUNCTIONS); diff --git a/testing/trino-tests/src/test/java/io/trino/tests/TestTablesample.java b/testing/trino-tests/src/test/java/io/trino/tests/TestTablesample.java index bc7e31508b07..349b080a858a 100644 --- a/testing/trino-tests/src/test/java/io/trino/tests/TestTablesample.java +++ b/testing/trino-tests/src/test/java/io/trino/tests/TestTablesample.java @@ -26,7 +26,6 @@ import org.junit.jupiter.api.parallel.Execution; import static io.trino.SessionTestUtils.TEST_SESSION; -import static io.trino.plugin.tpch.TpchConnectorFactory.TPCH_SPLITS_PER_NODE; import static io.trino.spi.StandardErrorCode.INVALID_ARGUMENTS; import static io.trino.spi.StandardErrorCode.TYPE_MISMATCH; import static org.assertj.core.api.Assertions.assertThat; @@ -46,7 +45,7 @@ public void setUp() { queryRunner = new StandaloneQueryRunner(TEST_SESSION); queryRunner.installPlugin(new TpchPlugin()); - queryRunner.createCatalog("tpch", "tpch", ImmutableMap.of(TPCH_SPLITS_PER_NODE, "1")); + queryRunner.createCatalog("tpch", "tpch", ImmutableMap.of("tpch.splits-per-node", "1")); assertions = new QueryAssertions(queryRunner); } diff --git a/testing/trino-tests/src/test/java/io/trino/tests/tpch/TestTpchDistributedStats.java b/testing/trino-tests/src/test/java/io/trino/tests/tpch/TestTpchDistributedStats.java index 182a063855ca..badc4b4bda57 100644 --- a/testing/trino-tests/src/test/java/io/trino/tests/tpch/TestTpchDistributedStats.java +++ b/testing/trino-tests/src/test/java/io/trino/tests/tpch/TestTpchDistributedStats.java @@ -26,7 +26,6 @@ import java.util.Map; import static io.trino.SystemSessionProperties.COLLECT_PLAN_STATISTICS_FOR_ALL_QUERIES; -import static io.trino.plugin.tpch.TpchConnectorFactory.TPCH_COLUMN_NAMING_PROPERTY; import static io.trino.testing.assertions.Assert.assertEventually; import static io.trino.testing.statistics.MetricComparisonStrategies.absoluteError; import static io.trino.testing.statistics.MetricComparisonStrategies.defaultTolerance; @@ -48,7 +47,7 @@ public void setup() throws Exception { QueryRunner runner = TpchQueryRunner.builder() - .withConnectorProperties(Map.of(TPCH_COLUMN_NAMING_PROPERTY, ColumnNaming.STANDARD.name())) + .withConnectorProperties(Map.of("tpch.column-naming", ColumnNaming.STANDARD.name())) .amendSession(builder -> builder // Stats for non-EXPLAIN queries are not collected by default .setSystemProperty(COLLECT_PLAN_STATISTICS_FOR_ALL_QUERIES, "true")) diff --git a/testing/trino-tests/src/test/java/io/trino/tests/tpch/TestTpchLocalStats.java b/testing/trino-tests/src/test/java/io/trino/tests/tpch/TestTpchLocalStats.java index e1747fe86bd1..8a94a0f15e87 100644 --- a/testing/trino-tests/src/test/java/io/trino/tests/tpch/TestTpchLocalStats.java +++ b/testing/trino-tests/src/test/java/io/trino/tests/tpch/TestTpchLocalStats.java @@ -27,8 +27,6 @@ import org.junit.jupiter.api.parallel.Execution; import static io.trino.SystemSessionProperties.COLLECT_PLAN_STATISTICS_FOR_ALL_QUERIES; -import static io.trino.plugin.tpch.TpchConnectorFactory.TPCH_COLUMN_NAMING_PROPERTY; -import static io.trino.plugin.tpch.TpchConnectorFactory.TPCH_SPLITS_PER_NODE; import static io.trino.plugin.tpch.TpchMetadata.TINY_SCHEMA_NAME; import static io.trino.testing.TestingSession.testSessionBuilder; import static io.trino.testing.statistics.MetricComparisonStrategies.absoluteError; @@ -62,8 +60,8 @@ public void setUp() QueryRunner queryRunner = new StandaloneQueryRunner(defaultSession); queryRunner.installPlugin(new TpchPlugin()); queryRunner.createCatalog("tpch", "tpch", ImmutableMap.builder() - .put(TPCH_SPLITS_PER_NODE, "1") - .put(TPCH_COLUMN_NAMING_PROPERTY, ColumnNaming.STANDARD.name()) + .put("tpch.splits-per-node", "1") + .put("tpch.column-naming", ColumnNaming.STANDARD.name()) .buildOrThrow()); statisticsAssertion = new StatisticsAssertion(queryRunner); } diff --git a/testing/trino-tests/src/test/java/io/trino/tests/tpch/TestTpchTableScanRedirection.java b/testing/trino-tests/src/test/java/io/trino/tests/tpch/TestTpchTableScanRedirection.java index 87ab2a63cdae..9bc1ae742ede 100644 --- a/testing/trino-tests/src/test/java/io/trino/tests/tpch/TestTpchTableScanRedirection.java +++ b/testing/trino-tests/src/test/java/io/trino/tests/tpch/TestTpchTableScanRedirection.java @@ -21,8 +21,6 @@ import java.util.Map; -import static io.trino.plugin.tpch.TpchConnectorFactory.TPCH_TABLE_SCAN_REDIRECTION_CATALOG; -import static io.trino.plugin.tpch.TpchConnectorFactory.TPCH_TABLE_SCAN_REDIRECTION_SCHEMA; import static org.assertj.core.api.Assertions.assertThat; public class TestTpchTableScanRedirection @@ -34,8 +32,8 @@ protected QueryRunner createQueryRunner() { QueryRunner queryRunner = TpchQueryRunner.builder() .withConnectorProperties(Map.of( - TPCH_TABLE_SCAN_REDIRECTION_CATALOG, "memory", - TPCH_TABLE_SCAN_REDIRECTION_SCHEMA, "test")) + "tpch.table-scan-redirection-catalog", "memory", + "tpch.table-scan-redirection-schema", "test")) .build(); queryRunner.installPlugin(new MemoryPlugin()); queryRunner.createCatalog("memory", "memory");