diff --git a/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestDeltaLakeBasic.java b/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestDeltaLakeBasic.java index 5e4ad8846e449..5e5feea73ddb4 100644 --- a/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestDeltaLakeBasic.java +++ b/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestDeltaLakeBasic.java @@ -52,7 +52,6 @@ import java.util.List; import java.util.Optional; import java.util.regex.Pattern; -import java.util.stream.Stream; import static com.google.common.collect.Iterators.getOnlyElement; import static com.google.common.collect.MoreCollectors.onlyElement; @@ -61,13 +60,13 @@ import static io.trino.plugin.deltalake.DeltaLakeQueryRunner.DELTA_CATALOG; import static io.trino.plugin.deltalake.DeltaLakeQueryRunner.createDeltaLakeQueryRunner; import static io.trino.plugin.deltalake.DeltaTestingConnectorSession.SESSION; +import static io.trino.plugin.deltalake.TestingDeltaLakeUtils.copyDirectoryContents; import static io.trino.plugin.deltalake.transactionlog.DeltaLakeSchemaSupport.getColumnsMetadata; import static io.trino.plugin.deltalake.transactionlog.checkpoint.TransactionLogTail.getEntriesFromJson; import static io.trino.plugin.hive.HiveTestUtils.HDFS_ENVIRONMENT; import static io.trino.plugin.hive.HiveTestUtils.HDFS_FILE_SYSTEM_STATS; import static io.trino.testing.TestingNames.randomNameSuffix; import static java.lang.String.format; -import static java.nio.file.StandardCopyOption.REPLACE_EXISTING; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.entry; import static org.testng.Assert.assertFalse; @@ -684,19 +683,4 @@ private static MetadataEntry loadMetadataEntry(long entryNumber, Path tableLocat .collect(onlyElement()); return transactionLog.getMetaData(); } - - private void copyDirectoryContents(Path source, Path destination) - throws IOException - { - try (Stream stream = Files.walk(source)) { - stream.forEach(file -> { - try { - Files.copy(file, destination.resolve(source.relativize(file)), REPLACE_EXISTING); - } - catch (IOException e) { - throw new RuntimeException(e); - } - }); - } - } } diff --git a/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestingDeltaLakeUtils.java b/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestingDeltaLakeUtils.java index e688e3f81a6ad..b74b16f96e29f 100644 --- a/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestingDeltaLakeUtils.java +++ b/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestingDeltaLakeUtils.java @@ -20,10 +20,14 @@ import io.trino.testing.DistributedQueryRunner; import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.List; +import java.util.stream.Stream; import static io.trino.plugin.deltalake.DeltaLakeQueryRunner.DELTA_CATALOG; import static io.trino.testing.TestingConnectorSession.SESSION; +import static java.nio.file.StandardCopyOption.REPLACE_EXISTING; public final class TestingDeltaLakeUtils { @@ -45,4 +49,19 @@ public static List getTableActiveFiles(TransactionLogAccess transa TableSnapshot snapshot = transactionLogAccess.loadSnapshot(dummyTable, tableLocation, SESSION); return transactionLogAccess.getActiveFiles(snapshot, SESSION); } + + public static void copyDirectoryContents(Path source, Path destination) + throws IOException + { + try (Stream stream = Files.walk(source)) { + stream.forEach(file -> { + try { + Files.copy(file, destination.resolve(source.relativize(file)), REPLACE_EXISTING); + } + catch (IOException e) { + throw new RuntimeException(e); + } + }); + } + } }