From 3bd82ba003bf019767e3c6fe99e42088d0915157 Mon Sep 17 00:00:00 2001 From: "Jacob I. Komissar" Date: Tue, 8 Mar 2022 12:00:21 -0500 Subject: [PATCH] Replace references to "Presto" and "SEP" in Delta Lake connector --- .../io/trino/plugin/deltalake/DeltaLakeSplitSource.java | 4 ++-- .../io/trino/plugin/deltalake/DeltaLakeTableProperties.java | 2 +- .../metastore/HiveMetastoreBackedDeltaLakeMetastore.java | 2 +- .../transactionlog/DeltaLakeParquetStatisticsUtils.java | 4 ++-- .../deltalake/transactionlog/DeltaLakeSchemaSupport.java | 2 +- .../plugin/deltalake/BaseDeltaLakeConnectorSmokeTest.java | 4 ++-- .../io/trino/plugin/deltalake/TestDeltaLakePageSink.java | 6 +++--- .../trino/plugin/deltalake/TestDeltaLakeReadTimestamps.java | 4 ++-- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/plugin/trino-delta-lake/src/main/java/io/trino/plugin/deltalake/DeltaLakeSplitSource.java b/plugin/trino-delta-lake/src/main/java/io/trino/plugin/deltalake/DeltaLakeSplitSource.java index de0747c2ce2b..b573286edf92 100644 --- a/plugin/trino-delta-lake/src/main/java/io/trino/plugin/deltalake/DeltaLakeSplitSource.java +++ b/plugin/trino-delta-lake/src/main/java/io/trino/plugin/deltalake/DeltaLakeSplitSource.java @@ -73,7 +73,7 @@ public DeltaLakeSplitSource( this.dynamicFilter = requireNonNull(dynamicFilter, "dynamicFilter is null"); queueSplits(splits, queue, executor) .exceptionally(throwable -> { - // set prestoException before finishing the queue to ensure failure is observed instead of successful completion + // set trinoException before finishing the queue to ensure failure is observed instead of successful completion // (the field is declared as volatile to make sure that the change is visible right away to other threads) trinoException = new TrinoException(GENERIC_INTERNAL_ERROR, "Failed to generate splits for " + this.tableName, throwable); try { @@ -139,7 +139,7 @@ public void close() public boolean isFinished() { if (queue.isFinished()) { - // Note: queue and prestoException need to be checked in the appropriate order + // Note: queue and trinoException need to be checked in the appropriate order // When throwable is set, we want getNextBatch to be called, so that we can propagate the exception return trinoException == null; } diff --git a/plugin/trino-delta-lake/src/main/java/io/trino/plugin/deltalake/DeltaLakeTableProperties.java b/plugin/trino-delta-lake/src/main/java/io/trino/plugin/deltalake/DeltaLakeTableProperties.java index bfb99312e6a6..d6633f5ce4f5 100644 --- a/plugin/trino-delta-lake/src/main/java/io/trino/plugin/deltalake/DeltaLakeTableProperties.java +++ b/plugin/trino-delta-lake/src/main/java/io/trino/plugin/deltalake/DeltaLakeTableProperties.java @@ -43,7 +43,7 @@ public class DeltaLakeTableProperties // to pass the column names to ConnectorMetadata#getStatisticsCollectionMetadata; we should consider passing // ConnectorTableHandle instead of ConnectorTableMetadata as an argument since it makes more information // available (including the names of the columns to be analyzed) - public static final String ANALYZE_COLUMNS_PROPERTY = "$sep.analyze_columns"; + public static final String ANALYZE_COLUMNS_PROPERTY = "$trino.analyze_columns"; private final List> tableProperties; diff --git a/plugin/trino-delta-lake/src/main/java/io/trino/plugin/deltalake/metastore/HiveMetastoreBackedDeltaLakeMetastore.java b/plugin/trino-delta-lake/src/main/java/io/trino/plugin/deltalake/metastore/HiveMetastoreBackedDeltaLakeMetastore.java index d4010d9fcb5d..383640fc491a 100644 --- a/plugin/trino-delta-lake/src/main/java/io/trino/plugin/deltalake/metastore/HiveMetastoreBackedDeltaLakeMetastore.java +++ b/plugin/trino-delta-lake/src/main/java/io/trino/plugin/deltalake/metastore/HiveMetastoreBackedDeltaLakeMetastore.java @@ -373,7 +373,7 @@ private TableStatistics createZeroStatistics(List columns private boolean isValidInRange(Double d) { - // Delta considers NaN a valid min/max value but Presto does not + // Delta considers NaN a valid min/max value but Trino does not return d != null && !d.isNaN(); } diff --git a/plugin/trino-delta-lake/src/main/java/io/trino/plugin/deltalake/transactionlog/DeltaLakeParquetStatisticsUtils.java b/plugin/trino-delta-lake/src/main/java/io/trino/plugin/deltalake/transactionlog/DeltaLakeParquetStatisticsUtils.java index fd6a0bc67464..f05165cf37e4 100644 --- a/plugin/trino-delta-lake/src/main/java/io/trino/plugin/deltalake/transactionlog/DeltaLakeParquetStatisticsUtils.java +++ b/plugin/trino-delta-lake/src/main/java/io/trino/plugin/deltalake/transactionlog/DeltaLakeParquetStatisticsUtils.java @@ -165,7 +165,7 @@ else if (statistics instanceof BinaryStatistics) { return Optional.empty(); } - LOG.warn("Accumulating Parquet statistics with Presto type: %s and Parquet statistics of type: %s is not supported", type, statistics); + LOG.warn("Accumulating Parquet statistics with Trino type: %s and Parquet statistics of type: %s is not supported", type, statistics); return Optional.empty(); } @@ -245,7 +245,7 @@ else if (statistics instanceof BinaryStatistics) { return Optional.empty(); } - LOG.warn("Accumulating Parquet statistics with Presto type: %s and Parquet statistics of type: %s is not supported", type, statistics); + LOG.warn("Accumulating Parquet statistics with Trino type: %s and Parquet statistics of type: %s is not supported", type, statistics); return Optional.empty(); } } diff --git a/plugin/trino-delta-lake/src/main/java/io/trino/plugin/deltalake/transactionlog/DeltaLakeSchemaSupport.java b/plugin/trino-delta-lake/src/main/java/io/trino/plugin/deltalake/transactionlog/DeltaLakeSchemaSupport.java index 4167e53e75d6..ccabc1f8d0f3 100644 --- a/plugin/trino-delta-lake/src/main/java/io/trino/plugin/deltalake/transactionlog/DeltaLakeSchemaSupport.java +++ b/plugin/trino-delta-lake/src/main/java/io/trino/plugin/deltalake/transactionlog/DeltaLakeSchemaSupport.java @@ -120,7 +120,7 @@ private static Map serializeStructField(String name, Type type) fieldContents.put("metadata", ImmutableMap.of()); fieldContents.put("name", name); - fieldContents.put("nullable", true); // TODO: Is column nullability configurable in Presto? + fieldContents.put("nullable", true); // TODO: Is column nullability configurable in Trino? fieldContents.put("type", serializeColumnType(type)); return fieldContents.buildOrThrow(); diff --git a/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/BaseDeltaLakeConnectorSmokeTest.java b/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/BaseDeltaLakeConnectorSmokeTest.java index f523bd5f4f92..ba4dd6e3d13f 100644 --- a/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/BaseDeltaLakeConnectorSmokeTest.java +++ b/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/BaseDeltaLakeConnectorSmokeTest.java @@ -669,7 +669,7 @@ public void testTimestampWithTimeZoneInComplexTypesFails() public void testSelectOldDate() { // Due to calendar shifts the read value is different than the written value. - // This means that the Presto value falls outside of the Databricks min/max values from the file statistics + // This means that the Trino value falls outside of the Databricks min/max values from the file statistics assertQuery("SELECT * FROM old_dates", "VALUES (DATE '0099-12-30', 1), (DATE '1582-10-15', 2), (DATE '1960-01-01', 3), (DATE '2020-01-01', 4)"); assertQuery("SELECT * FROM old_dates WHERE d = DATE '0099-12-30'", "VALUES (DATE '0099-12-30', 1)"); assertQuery("SELECT * FROM old_dates WHERE d = DATE '1582-10-15'", "VALUES (DATE '1582-10-15', 2)"); @@ -1166,7 +1166,7 @@ public void testStatsSplitPruningBasedOnSepCreatedCheckpointOnTopOfCheckpointWit assertThat(listCheckpointFiles(transactionLogDirectory)).hasSize(1); testCountQuery(format("SELECT count(*) FROM %s WHERE l = 0", tableName), 3, 3); - // fill in with extra transaction to force one more checkpoint made by SEP + // fill in with extra transaction to force one more checkpoint made by Trino // the checkpoint will be based on DB checkpoint which includes only struct stats assertUpdate(format("INSERT INTO %s VALUES (NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)", tableName), 1); assertUpdate(format("INSERT INTO %s VALUES (NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)", tableName), 1); diff --git a/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestDeltaLakePageSink.java b/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestDeltaLakePageSink.java index 5a5ee4ab6e3a..b0b8bc66fabc 100644 --- a/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestDeltaLakePageSink.java +++ b/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestDeltaLakePageSink.java @@ -81,7 +81,7 @@ public void testPageSinkStats() List columns = ImmutableList.copyOf(LineItemColumn.values()); List columnTypes = columns.stream() .map(LineItemColumn::getType) - .map(TestDeltaLakePageSink::getPrestoType) + .map(TestDeltaLakePageSink::getTrinoType) .collect(toList()); PageBuilder pageBuilder = new PageBuilder(columnTypes); @@ -185,13 +185,13 @@ private static List getColumnHandles() for (LineItemColumn column : columns) { handles.add(new DeltaLakeColumnHandle( column.getColumnName(), - getPrestoType(column.getType()), + getTrinoType(column.getType()), REGULAR)); } return handles.build(); } - private static Type getPrestoType(TpchColumnType type) + private static Type getTrinoType(TpchColumnType type) { switch (type.getBase()) { case IDENTIFIER: diff --git a/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestDeltaLakeReadTimestamps.java b/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestDeltaLakeReadTimestamps.java index 0082dba2b1fe..7b5416e83138 100644 --- a/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestDeltaLakeReadTimestamps.java +++ b/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestDeltaLakeReadTimestamps.java @@ -158,11 +158,11 @@ private void runTestInTimeZone(String zone, List testCases) String actual = "SELECT col_0, " + projections + " FROM read_timestamps WHERE col_0 = '" + zone + "'"; Session session = sessionBuilder.build(); assertQuery(session, actual, expected); - actual = "SELECT col_0, " + projections + " FROM read_timestamps WHERE " + buildPrestoWhereClauses(zone, testCases); + actual = "SELECT col_0, " + projections + " FROM read_timestamps WHERE " + buildTrinoWhereClauses(zone, testCases); assertQuery(session, actual, expected); } - private String buildPrestoWhereClauses(String zone, List testCases) + private String buildTrinoWhereClauses(String zone, List testCases) { List predicates = new ArrayList<>(); // partition values