diff --git a/docs/src/main/sphinx/connector/pinot.md b/docs/src/main/sphinx/connector/pinot.md index cffe2baf6bd709..7f7d4a25b2b7c0 100644 --- a/docs/src/main/sphinx/connector/pinot.md +++ b/docs/src/main/sphinx/connector/pinot.md @@ -11,7 +11,7 @@ The Pinot connector allows Trino to query data stored in To connect to Pinot, you need: -- Pinot 0.11.0 or higher. +- Pinot 1.1.0 or higher. - Network access from the Trino coordinator and workers to the Pinot controller nodes. Port 8098 is the default port. diff --git a/plugin/trino-pinot/pom.xml b/plugin/trino-pinot/pom.xml index 4890309e00e2a1..725dccfe5463a3 100755 --- a/plugin/trino-pinot/pom.xml +++ b/plugin/trino-pinot/pom.xml @@ -14,15 +14,25 @@ ${project.parent.basedir} - 0.12.1 + 1.1.0 + ${air.test.jvm.additional-arguments.default} + --add-exports=java.base/jdk.internal.ref=ALL-UNNAMED + --add-exports=java.base/sun.nio.ch=ALL-UNNAMED + --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED + --add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED + --add-opens=jdk.compiler/com.sun.tools.javac=ALL-UNNAMED + --add-opens=java.base/java.lang=ALL-UNNAMED + --add-opens=java.base/java.lang.reflect=ALL-UNNAMED + --add-opens=java.base/java.io=ALL-UNNAMED + --add-opens=java.base/java.util=ALL-UNNAMED - org.apache.calcite - calcite-core - 1.32.0 + net.openhft + posix + 2.25ea0 @@ -118,10 +128,15 @@ jakarta.validation-api + + org.apache.commons + commons-lang3 + + org.apache.helix helix-core - 1.0.4 + 1.3.1 commons-io @@ -135,6 +150,10 @@ log4j log4j + + org.apache.commons + commons-lang3 + org.apache.logging.log4j log4j-core @@ -148,10 +167,6 @@ org.slf4j slf4j-log4j12 - - org.yaml - snakeyaml - @@ -164,14 +179,6 @@ com.101tec zkclient - - com.fasterxml.jackson.core - jackson-annotations - - - com.fasterxml.jackson.core - jackson-databind - com.google.code.findbugs annotations @@ -192,14 +199,6 @@ commons-logging commons-logging - - jakarta.annotation - jakarta.annotation-api - - - jakarta.ws.rs - jakarta.ws.rs-api - javax.servlet javax.servlet-api @@ -216,6 +215,10 @@ log4j log4j + + net.openhft + chronicle-core + org.antlr antlr4-annotations @@ -224,10 +227,6 @@ org.apache.commons commons-compress - - org.apache.commons - commons-lang3 - org.apache.httpcomponents httpcore @@ -244,10 +243,18 @@ org.apache.logging.log4j log4j-1.2-api + + org.apache.logging.log4j + log4j-core + org.apache.logging.log4j log4j-slf4j-impl + + org.apache.logging.log4j + log4j-slf4j2-impl + org.apache.zookeeper zookeeper @@ -280,10 +287,6 @@ org.slf4j slf4j-log4j12 - - org.yaml - snakeyaml - @@ -292,26 +295,10 @@ pinot-core ${dep.pinot.version} - - com.fasterxml.jackson.core - jackson-annotations - - - com.fasterxml.jackson.core - jackson-databind - commons-logging commons-logging - - jakarta.annotation - jakarta.annotation-api - - - jakarta.ws.rs - jakarta.ws.rs-api - javax.validation validation-api @@ -329,16 +316,16 @@ kafka_2.10 - org.apache.lucene - lucene-analyzers-common + org.apache.logging.log4j + log4j-slf4j-impl - org.apache.lucene - lucene-core + org.apache.logging.log4j + log4j-slf4j2-impl - org.apache.lucene - lucene-sandbox + org.apache.logging.log4j + log4j-to-slf4j org.codehaus.jackson @@ -364,6 +351,10 @@ org.glassfish.jersey.containers jersey-container-grizzly2-http + + org.locationtech.jts + jts-core + org.slf4j slf4j-api @@ -379,22 +370,18 @@ org.apache.pinot pinot-segment-local ${dep.pinot.version} - - - org.apache.lucene - lucene-analyzers-common - - - org.apache.lucene - lucene-core - - org.apache.pinot pinot-segment-spi ${dep.pinot.version} + + + org.locationtech.jts + jts-core + + @@ -415,8 +402,8 @@ log4j-slf4j-impl - org.yaml - snakeyaml + org.apache.logging.log4j + log4j-slf4j2-impl @@ -468,21 +455,23 @@ runtime + - org.antlr - antlr4-runtime + net.openhft + chronicle-core + 2.25ea14 runtime - org.apache.avro - avro + org.antlr + antlr4-runtime runtime - org.apache.commons - commons-lang3 + org.apache.avro + avro runtime diff --git a/plugin/trino-pinot/src/main/java/io/trino/plugin/pinot/client/PinotLegacyDataFetcher.java b/plugin/trino-pinot/src/main/java/io/trino/plugin/pinot/client/PinotLegacyDataFetcher.java index d2959ba8e204b3..a2b60c973f1f81 100644 --- a/plugin/trino-pinot/src/main/java/io/trino/plugin/pinot/client/PinotLegacyDataFetcher.java +++ b/plugin/trino-pinot/src/main/java/io/trino/plugin/pinot/client/PinotLegacyDataFetcher.java @@ -22,6 +22,7 @@ import io.trino.plugin.pinot.PinotSessionProperties; import io.trino.plugin.pinot.PinotSplit; import io.trino.spi.connector.ConnectorSession; +import org.apache.commons.lang3.tuple.Pair; import org.apache.pinot.common.datatable.DataTable; import org.apache.pinot.common.metrics.BrokerMetrics; import org.apache.pinot.common.request.BrokerRequest; @@ -41,7 +42,6 @@ import java.net.InetAddress; import java.net.UnknownHostException; -import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; @@ -218,12 +218,12 @@ public Iterator queryPinot(ConnectorSession session, Str throw new PinotException(PINOT_INVALID_PQL_GENERATED, Optional.of(query), format("Parsing error with on %s, Error = %s", serverHost, e.getMessage()), e); } ServerInstance serverInstance = pinotHostMapper.getServerInstance(serverHost); - Map> routingTable = new HashMap<>(); - routingTable.put(serverInstance, new ArrayList<>(segments)); + Map, List>> routingTable = new HashMap<>(); + routingTable.put(serverInstance, Pair.of(segments, segments)); String tableName = brokerRequest.getQuerySource().getTableName(); String rawTableName = TableNameBuilder.extractRawTableName(tableName); - Map> offlineRoutingTable = TableNameBuilder.isOfflineTableResource(tableName) ? routingTable : null; - Map> realtimeRoutingTable = TableNameBuilder.isRealtimeTableResource(tableName) ? routingTable : null; + Map, List>> offlineRoutingTable = TableNameBuilder.isOfflineTableResource(tableName) ? routingTable : null; + Map, List>> realtimeRoutingTable = TableNameBuilder.isRealtimeTableResource(tableName) ? routingTable : null; BrokerRequest offlineBrokerRequest = TableNameBuilder.isOfflineTableResource(tableName) ? brokerRequest : null; BrokerRequest realtimeBrokerRequest = TableNameBuilder.isRealtimeTableResource(tableName) ? brokerRequest : null; AsyncQueryResponse asyncQueryResponse = diff --git a/plugin/trino-pinot/src/main/java/io/trino/plugin/pinot/query/PinotExpressionRewriter.java b/plugin/trino-pinot/src/main/java/io/trino/plugin/pinot/query/PinotExpressionRewriter.java index 74dd12a6f47fbd..a8e100233785f7 100644 --- a/plugin/trino-pinot/src/main/java/io/trino/plugin/pinot/query/PinotExpressionRewriter.java +++ b/plugin/trino-pinot/src/main/java/io/trino/plugin/pinot/query/PinotExpressionRewriter.java @@ -55,9 +55,9 @@ import static java.lang.String.format; import static java.util.Locale.ENGLISH; import static java.util.Objects.requireNonNull; -import static org.apache.pinot.common.function.TransformFunctionType.DATETIMECONVERT; -import static org.apache.pinot.common.function.TransformFunctionType.DATETRUNC; -import static org.apache.pinot.common.function.TransformFunctionType.TIMECONVERT; +import static org.apache.pinot.common.function.TransformFunctionType.DATE_TIME_CONVERT; +import static org.apache.pinot.common.function.TransformFunctionType.DATE_TRUNC; +import static org.apache.pinot.common.function.TransformFunctionType.TIME_CONVERT; import static org.apache.pinot.common.request.Literal.stringValue; import static org.apache.pinot.common.request.context.ExpressionContext.Type.FUNCTION; import static org.apache.pinot.common.request.context.ExpressionContext.Type.IDENTIFIER; @@ -80,9 +80,9 @@ private PinotExpressionRewriter() {} static { Map> functionMap = new HashMap<>(); - functionMap.put(DATETIMECONVERT, new DateTimeConvertRewriteRule()); - functionMap.put(TIMECONVERT, new TimeConvertRewriteRule()); - functionMap.put(DATETRUNC, new DateTruncRewriteRule()); + functionMap.put(DATE_TIME_CONVERT, new DateTimeConvertRewriteRule()); + functionMap.put(TIME_CONVERT, new TimeConvertRewriteRule()); + functionMap.put(DATE_TRUNC, new DateTruncRewriteRule()); FUNCTION_RULE_MAP = immutableEnumMap(functionMap); Map> aggregationFunctionMap = new HashMap<>(); @@ -160,7 +160,7 @@ private static class DateTimeConvertRewriteRule @Override public Pattern getPattern() { - return transformFunction().with(transformFunctionType().equalTo(DATETIMECONVERT)); + return transformFunction().with(transformFunctionType().equalTo(DATE_TIME_CONVERT)); } @Override @@ -193,7 +193,7 @@ private static class TimeConvertRewriteRule @Override public Pattern getPattern() { - return transformFunction().with(transformFunctionType().equalTo(TIMECONVERT)); + return transformFunction().with(transformFunctionType().equalTo(TIME_CONVERT)); } @Override @@ -224,7 +224,7 @@ private static class DateTruncRewriteRule @Override public Pattern getPattern() { - return transformFunction().with(transformFunctionType().equalTo(DATETRUNC)); + return transformFunction().with(transformFunctionType().equalTo(DATE_TRUNC)); } @Override diff --git a/plugin/trino-pinot/src/main/java/io/trino/plugin/pinot/query/PinotSqlFormatter.java b/plugin/trino-pinot/src/main/java/io/trino/plugin/pinot/query/PinotSqlFormatter.java index 898ace8891a7f1..9edc9cd943aaec 100644 --- a/plugin/trino-pinot/src/main/java/io/trino/plugin/pinot/query/PinotSqlFormatter.java +++ b/plugin/trino-pinot/src/main/java/io/trino/plugin/pinot/query/PinotSqlFormatter.java @@ -624,18 +624,13 @@ public String formatToSql(FunctionContext object, Captures captures, Context con .map(expressionContext -> formatExpression(expressionContext, context)) .collect(toImmutableList()); checkState(arguments.size() >= 2, "Unexpected expression '%s'", object); - int whenStatements = arguments.size() / 2; - StringBuilder builder = new StringBuilder("CASE "); - builder.append("WHEN ") - .append(arguments.get(0)) - .append(" THEN ") - .append(arguments.get(whenStatements)); - - for (int index = 1; index < whenStatements; index++) { + StringBuilder builder = new StringBuilder("CASE"); + + for (int index = 0; index < arguments.size() / 2; index++) { builder.append(" WHEN ") - .append(arguments.get(index)) + .append(arguments.get(index * 2)) .append(" THEN ") - .append(arguments.get(index + whenStatements)); + .append(arguments.get(index * 2 + 1)); } if (arguments.size() % 2 != 0) { diff --git a/plugin/trino-pinot/src/main/java/io/trino/plugin/pinot/query/PinotTransformFunctionTypeResolver.java b/plugin/trino-pinot/src/main/java/io/trino/plugin/pinot/query/PinotTransformFunctionTypeResolver.java index a7ccdcd0f14f0e..577598ede01786 100644 --- a/plugin/trino-pinot/src/main/java/io/trino/plugin/pinot/query/PinotTransformFunctionTypeResolver.java +++ b/plugin/trino-pinot/src/main/java/io/trino/plugin/pinot/query/PinotTransformFunctionTypeResolver.java @@ -36,7 +36,7 @@ private PinotTransformFunctionTypeResolver() {} { Map builder = new HashMap<>(); for (TransformFunctionType transformFunctionType : TransformFunctionType.values()) { - for (String alias : transformFunctionType.getAliases()) { + for (String alias : transformFunctionType.getAlternativeNames()) { TransformFunctionType previousValue = builder.put(canonicalize(alias), transformFunctionType); checkState(previousValue == null || previousValue == transformFunctionType, "Duplicate key with different values for alias '%s', transform function type '%s' and previous value '%s'", canonicalize(alias), transformFunctionType, previousValue); } diff --git a/plugin/trino-pinot/src/test/java/io/trino/plugin/pinot/BasePinotConnectorSmokeTest.java b/plugin/trino-pinot/src/test/java/io/trino/plugin/pinot/BasePinotConnectorSmokeTest.java index 3b9b915ef9eff9..06c6d541f9be74 100644 --- a/plugin/trino-pinot/src/test/java/io/trino/plugin/pinot/BasePinotConnectorSmokeTest.java +++ b/plugin/trino-pinot/src/test/java/io/trino/plugin/pinot/BasePinotConnectorSmokeTest.java @@ -77,7 +77,7 @@ import static com.google.common.io.RecursiveDeleteOption.ALLOW_INSECURE; import static io.confluent.kafka.serializers.AbstractKafkaSchemaSerDeConfig.SCHEMA_REGISTRY_URL_CONFIG; import static io.trino.plugin.pinot.PinotQueryRunner.createPinotQueryRunner; -import static io.trino.plugin.pinot.TestingPinotCluster.PINOT_PREVIOUS_IMAGE_NAME; +import static io.trino.plugin.pinot.TestingPinotCluster.PINOT_LATEST_IMAGE_NAME; import static io.trino.spi.type.DoubleType.DOUBLE; import static io.trino.spi.type.RealType.REAL; import static java.lang.String.format; @@ -131,7 +131,7 @@ protected boolean isGrpcEnabled() protected String getPinotImageName() { - return PINOT_PREVIOUS_IMAGE_NAME; + return PINOT_LATEST_IMAGE_NAME; } @Override @@ -933,10 +933,10 @@ public void testShowCreateTable() assertThat((String) computeScalar("SHOW CREATE TABLE region")) .isEqualTo( "CREATE TABLE %s.%s.region (\n" + - " regionkey bigint,\n" + - " updated_at_seconds bigint,\n" + + " comment varchar,\n" + " name varchar,\n" + - " comment varchar\n" + + " regionkey bigint,\n" + + " updated_at_seconds bigint\n" + ")", getSession().getCatalog().orElseThrow(), getSession().getSchema().orElseThrow()); @@ -958,7 +958,7 @@ public void testTopN() { // TODO https://github.com/trinodb/trino/issues/14045 Fix ORDER BY ... LIMIT query assertQueryFails("SELECT regionkey FROM nation ORDER BY name LIMIT 3", - format("Segment query returned '%2$s' rows per split, maximum allowed is '%1$s' rows. with query \"SELECT \"regionkey\", \"name\" FROM nation_REALTIME LIMIT 12\"", MAX_ROWS_PER_SPLIT_FOR_SEGMENT_QUERIES, MAX_ROWS_PER_SPLIT_FOR_SEGMENT_QUERIES + 1)); + format("Segment query returned '%2$s' rows per split, maximum allowed is '%1$s' rows. with query \"SELECT \"name\", \"regionkey\" FROM nation_REALTIME LIMIT 12\"", MAX_ROWS_PER_SPLIT_FOR_SEGMENT_QUERIES, MAX_ROWS_PER_SPLIT_FOR_SEGMENT_QUERIES + 1)); } @Test @@ -967,7 +967,7 @@ public void testJoin() { // TODO https://github.com/trinodb/trino/issues/14046 Fix JOIN query assertQueryFails("SELECT n.name, r.name FROM nation n JOIN region r on n.regionkey = r.regionkey", - format("Segment query returned '%2$s' rows per split, maximum allowed is '%1$s' rows. with query \"SELECT \"regionkey\", \"name\" FROM nation_REALTIME LIMIT 12\"", MAX_ROWS_PER_SPLIT_FOR_SEGMENT_QUERIES, MAX_ROWS_PER_SPLIT_FOR_SEGMENT_QUERIES + 1)); + format("Segment query returned '%2$s' rows per split, maximum allowed is '%1$s' rows. with query \"SELECT \"name\", \"regionkey\" FROM nation_REALTIME LIMIT 12\"", MAX_ROWS_PER_SPLIT_FOR_SEGMENT_QUERIES, MAX_ROWS_PER_SPLIT_FOR_SEGMENT_QUERIES + 1)); } @Test @@ -2068,19 +2068,16 @@ public void testAggregationPushdown() assertThat(query("SELECT bool_col, COUNT(long_col) FROM \"SELECT bool_col, long_col FROM " + ALL_TYPES_TABLE + "\" GROUP BY bool_col")) .isNotFullyPushedDown(AggregationNode.class, ExchangeNode.class, ExchangeNode.class, AggregationNode.class); - // Ensure that count() is not pushed down even if the query contains a matching grouping column - assertThatExceptionOfType(RuntimeException.class) - // TODO verify the failure is TrinoException (eg. asserThat(query(....)).failure()...) - .isThrownBy(() -> computeActual("SELECT COUNT(long_col) FROM \"SELECT long_col FROM " + ALL_TYPES_TABLE + " GROUP BY long_col\"")) - .withRootCauseInstanceOf(RuntimeException.class) - .withMessage("Operation not supported for DISTINCT aggregation function"); + // Ensure that count() is pushed down even if the query contains a matching grouping column + assertThat(query("SELECT COUNT(long_col) FROM \"SELECT long_col FROM " + ALL_TYPES_TABLE + " GROUP BY long_col\"")) + .isNotFullyPushedDown(AggregationNode.class, ExchangeNode.class, ExchangeNode.class, AggregationNode.class); // Ensure that count() with grouping columns is not pushed down even if the query contains a matching grouping column assertThatExceptionOfType(RuntimeException.class) // TODO verify the failure is TrinoException (eg. asserThat(query(....)).failure()...) .isThrownBy(() -> computeActual("SELECT bool_col, COUNT(long_col) FROM \"SELECT bool_col, long_col FROM " + ALL_TYPES_TABLE + " GROUP BY bool_col, long_col\"")) .withRootCauseInstanceOf(RuntimeException.class) - .withMessage("Operation not supported for DISTINCT aggregation function"); + .withMessageContaining("'bool_col' must be an aggregate expression or appear in GROUP BY clause"); // Verify that count() is pushed down only when it matches a COUNT(DISTINCT ) query assertThat(query(""" diff --git a/plugin/trino-pinot/src/test/java/io/trino/plugin/pinot/TestDynamicTable.java b/plugin/trino-pinot/src/test/java/io/trino/plugin/pinot/TestDynamicTable.java index 24f7b13e62f9c3..259d41edf6c55e 100755 --- a/plugin/trino-pinot/src/test/java/io/trino/plugin/pinot/TestDynamicTable.java +++ b/plugin/trino-pinot/src/test/java/io/trino/plugin/pinot/TestDynamicTable.java @@ -171,12 +171,12 @@ public void testFilterWithCaseStatements() AND CASE origincityname WHEN 'nyc' THEN 'pizza' WHEN 'la' THEN 'burrito' WHEN 'boston' THEN 'clam chowder' ELSE 'burger' END != 'salad'""".formatted(tableName); String expected = """ - SELECT "FlightNum", "AirlineID"\ - FROM %s\ - WHERE AND((CASE WHEN equals("CancellationCode", 'strike')\ - THEN '3' ELSE '4' END) != '5', (CASE WHEN equals("OriginCityName", 'nyc')\ - THEN 'pizza' WHEN equals("OriginCityName", 'la') THEN 'burrito' WHEN equals("OriginCityName", 'boston')\ - THEN 'clam chowder' ELSE 'burger' END) != 'salad') LIMIT 10""".formatted(tableName); + SELECT "FlightNum", "AirlineID" \ + FROM %s \ + WHERE AND((CASE WHEN equals("CancellationCode", 'strike') THEN '3' ELSE '4' END) != '5', \ + (CASE WHEN equals("OriginCityName", 'nyc') THEN 'pizza' WHEN equals("OriginCityName", 'la') THEN 'burrito' WHEN equals("OriginCityName", 'boston') THEN 'clam chowder' \ + ELSE 'burger' END) != 'salad') LIMIT 10""".formatted(tableName); + DynamicTable dynamicTable = buildFromPql(pinotMetadata, new SchemaTableName("default", query), mockClusterInfoFetcher, TESTING_TYPE_CONVERTER); assertThat(extractPql(dynamicTable, TupleDomain.all())).isEqualTo(expected); } @@ -321,11 +321,12 @@ SELECT datetimeconvert(dayssinceEpoch, '1:seconds:epoch', '1:milliseconds:epoch' DynamicTable dynamicTable = buildFromPql(pinotMetadata, new SchemaTableName("default", query), mockClusterInfoFetcher, TESTING_TYPE_CONVERTER); String expectedPql = """ - SELECT datetimeconvert("DaysSinceEpoch", '1:SECONDS:EPOCH', '1:MILLISECONDS:EPOCH', '15:MINUTES'),\ - not_equals(CASE WHEN equals("OriginCityName", 'nyc') THEN 'pizza' WHEN equals("OriginCityName", 'la') THEN 'burrito' WHEN equals(\"OriginCityName\", 'boston') THEN 'clam chowder' ELSE 'burger' END, 'salad'),\ - timeconvert("DaysSinceEpoch", 'SECONDS', 'MINUTES') AS "foo"\ - FROM %s\ - LIMIT 70""".formatted(tableNameWithSuffix); + SELECT datetimeconvert("DaysSinceEpoch", '1:SECONDS:EPOCH', '1:MILLISECONDS:EPOCH', '15:MINUTES'), \ + not_equals(CASE WHEN equals("OriginCityName", 'nyc') THEN 'pizza' WHEN equals("OriginCityName", 'la') THEN 'burrito' WHEN equals("OriginCityName", 'boston') THEN 'clam chowder' ELSE 'burger' END, 'salad'), \ + timeconvert("DaysSinceEpoch", 'SECONDS', 'MINUTES') AS "foo" \ + FROM %s \ + LIMIT 70""".formatted(tableNameWithSuffix); + assertThat(extractPql(dynamicTable, TupleDomain.all())).isEqualTo(expectedPql); assertThat(dynamicTable.tableName()).isEqualTo(tableName); } @@ -348,17 +349,16 @@ SELECT datetimeconvert(dayssinceEpoch, '1:seconds:epoch', '1:milliseconds:epoch' DynamicTable dynamicTable = buildFromPql(pinotMetadata, new SchemaTableName("default", query), mockClusterInfoFetcher, TESTING_TYPE_CONVERTER); String expectedPql = """ - SELECT datetimeconvert("DaysSinceEpoch", '1:SECONDS:EPOCH',\ - '1:MILLISECONDS:EPOCH', '15:MINUTES'), count(*) AS "bar",\ - not_equals(CASE WHEN equals("OriginCityName", 'nyc') THEN 'pizza' WHEN equals("OriginCityName", 'la') THEN 'burrito'\ - WHEN equals("OriginCityName", 'boston') THEN 'clam chowder' ELSE 'burger' END, 'salad'),\ - timeconvert("DaysSinceEpoch", 'SECONDS', 'MINUTES') AS "foo",\ - max("AirTime") AS "baz"\ - FROM %s\ - GROUP BY datetimeconvert("DaysSinceEpoch", '1:SECONDS:EPOCH', '1:MILLISECONDS:EPOCH', '15:MINUTES'),\ - not_equals(CASE WHEN equals("OriginCityName", 'nyc') THEN 'pizza' WHEN equals("OriginCityName", 'la') THEN 'burrito' WHEN equals("OriginCityName", 'boston') THEN 'clam chowder' ELSE 'burger' END, 'salad'),\ - timeconvert("DaysSinceEpoch", 'SECONDS', 'MINUTES')\ - LIMIT 70""".formatted(tableNameWithSuffix); + SELECT datetimeconvert("DaysSinceEpoch", '1:SECONDS:EPOCH', \ + '1:MILLISECONDS:EPOCH', '15:MINUTES'), count(*) AS "bar", \ + not_equals(CASE WHEN equals("OriginCityName", 'nyc') THEN 'pizza' \ + WHEN equals("OriginCityName", 'la') THEN 'burrito' WHEN equals("OriginCityName", 'boston') THEN 'clam chowder' ELSE 'burger' END, 'salad'), \ + timeconvert("DaysSinceEpoch", 'SECONDS', 'MINUTES') AS "foo", max("AirTime") AS "baz" FROM %s \ + GROUP BY datetimeconvert("DaysSinceEpoch", '1:SECONDS:EPOCH', '1:MILLISECONDS:EPOCH', '15:MINUTES'), \ + not_equals(CASE WHEN equals("OriginCityName", 'nyc') THEN 'pizza' WHEN equals("OriginCityName", 'la') THEN 'burrito' WHEN equals("OriginCityName", 'boston') THEN 'clam chowder' ELSE 'burger' END, 'salad'), \ + timeconvert("DaysSinceEpoch", 'SECONDS', 'MINUTES') \ + LIMIT 70""".formatted(tableNameWithSuffix); + assertThat(extractPql(dynamicTable, TupleDomain.all())).isEqualTo(expectedPql); assertThat(dynamicTable.tableName()).isEqualTo(tableName); } diff --git a/plugin/trino-pinot/src/test/java/io/trino/plugin/pinot/TestPinotConnectorTest.java b/plugin/trino-pinot/src/test/java/io/trino/plugin/pinot/TestPinotConnectorTest.java index e7bd630462ea6d..af4fcd0fc337b2 100644 --- a/plugin/trino-pinot/src/test/java/io/trino/plugin/pinot/TestPinotConnectorTest.java +++ b/plugin/trino-pinot/src/test/java/io/trino/plugin/pinot/TestPinotConnectorTest.java @@ -152,15 +152,15 @@ public void testShowCreateTable() .isEqualTo(""" CREATE TABLE pinot.default.orders ( clerk varchar, - orderkey bigint, - orderstatus varchar, - updated_at_seconds bigint, - custkey bigint, - totalprice double, comment varchar, + custkey bigint, orderdate date, + orderkey bigint, orderpriority varchar, - shippriority integer + orderstatus varchar, + shippriority integer, + totalprice double, + updated_at_seconds bigint )"""); } diff --git a/plugin/trino-pinot/src/test/java/io/trino/plugin/pinot/TestPinotLatestNoGrpcConnectorSmokeTest.java b/plugin/trino-pinot/src/test/java/io/trino/plugin/pinot/TestPinotLatestNoGrpcConnectorSmokeTest.java index f4d11ea14d76e4..d255cbe1dd2c4a 100644 --- a/plugin/trino-pinot/src/test/java/io/trino/plugin/pinot/TestPinotLatestNoGrpcConnectorSmokeTest.java +++ b/plugin/trino-pinot/src/test/java/io/trino/plugin/pinot/TestPinotLatestNoGrpcConnectorSmokeTest.java @@ -15,8 +15,6 @@ import org.junit.jupiter.api.parallel.Isolated; -import static io.trino.plugin.pinot.TestingPinotCluster.PINOT_LATEST_IMAGE_NAME; - @Isolated public class TestPinotLatestNoGrpcConnectorSmokeTest extends BasePinotConnectorSmokeTest @@ -27,12 +25,6 @@ protected boolean isSecured() return false; } - @Override - protected String getPinotImageName() - { - return PINOT_LATEST_IMAGE_NAME; - } - @Override protected boolean isGrpcEnabled() { diff --git a/plugin/trino-pinot/src/test/java/io/trino/plugin/pinot/TestingPinotCluster.java b/plugin/trino-pinot/src/test/java/io/trino/plugin/pinot/TestingPinotCluster.java index b5ccb0eb50141f..de954b317e8436 100644 --- a/plugin/trino-pinot/src/test/java/io/trino/plugin/pinot/TestingPinotCluster.java +++ b/plugin/trino-pinot/src/test/java/io/trino/plugin/pinot/TestingPinotCluster.java @@ -65,9 +65,7 @@ public class TestingPinotCluster implements Closeable { - public static final String PINOT_LATEST_IMAGE_NAME = "apachepinot/pinot:0.12.1"; - public static final String PINOT_PREVIOUS_IMAGE_NAME = "apachepinot/pinot:0.11.0"; - + public static final String PINOT_LATEST_IMAGE_NAME = "apachepinot/pinot:1.1.0"; private static final String ZOOKEEPER_INTERNAL_HOST = "zookeeper"; private static final JsonCodec> LIST_JSON_CODEC = listJsonCodec(String.class); private static final JsonCodec PINOT_SUCCESS_RESPONSE_JSON_CODEC = jsonCodec(PinotSuccessResponse.class); @@ -90,7 +88,7 @@ public class TestingPinotCluster public TestingPinotCluster(Network network, boolean secured, String pinotImageName) { httpClient = closer.register(new JettyHttpClient()); - zookeeper = new GenericContainer<>(parse("zookeeper:3.5.6")) + zookeeper = new GenericContainer<>(parse("zookeeper:3.9")) .withStartupAttempts(3) .withNetwork(network) .withNetworkAliases(ZOOKEEPER_INTERNAL_HOST) diff --git a/plugin/trino-pinot/src/test/resources/too_many_broker_rows_realtimeSpec.json b/plugin/trino-pinot/src/test/resources/too_many_broker_rows_realtimeSpec.json index 8dcb390e0a1b61..feca663d6acdce 100644 --- a/plugin/trino-pinot/src/test/resources/too_many_broker_rows_realtimeSpec.json +++ b/plugin/trino-pinot/src/test/resources/too_many_broker_rows_realtimeSpec.json @@ -9,7 +9,7 @@ "segmentPushType": "APPEND", "segmentPushFrequency": "daily", "segmentAssignmentStrategy": "BalanceNumSegmentAssignmentStrategy", - "schemaName": "alltypes", + "schemaName": "too_many_broker_rows", "replicasPerPartition": "1" }, "tenants": {