Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,15 @@

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import io.airlift.log.Logger;
import io.airlift.units.Duration;
import io.opentelemetry.api.OpenTelemetry;
import io.trino.filesystem.Location;
import io.trino.filesystem.TrinoFileSystem;
import io.trino.filesystem.TrinoFileSystemFactory;
import io.trino.filesystem.hdfs.HdfsFileSystemFactory;
import io.trino.hdfs.DynamicHdfsConfiguration;
import io.trino.hdfs.HdfsConfig;
import io.trino.hdfs.HdfsConfigurationInitializer;
import io.trino.hdfs.HdfsEnvironment;
import io.trino.hdfs.TrinoHdfsFileSystemStats;
import io.trino.hdfs.authentication.NoHdfsAuthentication;
import io.trino.hdfs.s3.HiveS3Config;
import io.trino.hdfs.s3.TrinoS3ConfigurationInitializer;
import io.trino.filesystem.s3.S3FileSystemConfig;
import io.trino.filesystem.s3.S3FileSystemFactory;
import io.trino.filesystem.s3.S3FileSystemStats;
import io.trino.metastore.Table;
import io.trino.metastore.TableInfo;
import io.trino.metastore.cache.CachingHiveMetastore;
Expand Down Expand Up @@ -66,7 +60,6 @@
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;

import static com.google.common.base.Verify.verify;
import static com.google.common.util.concurrent.MoreExecutors.directExecutor;
Expand All @@ -81,6 +74,7 @@
import static io.trino.testing.TestingConnectorSession.SESSION;
import static io.trino.testing.TestingNames.randomNameSuffix;
import static io.trino.testing.containers.Minio.MINIO_ACCESS_KEY;
import static io.trino.testing.containers.Minio.MINIO_REGION;
import static io.trino.testing.containers.Minio.MINIO_SECRET_KEY;
import static java.util.Locale.ENGLISH;
import static java.util.concurrent.TimeUnit.MINUTES;
Expand Down Expand Up @@ -128,20 +122,15 @@ public void tearDown()
@Override
protected TrinoCatalog createTrinoCatalog(boolean useUniqueTableLocations)
{
TrinoFileSystemFactory fileSystemFactory = new HdfsFileSystemFactory(new HdfsEnvironment(
new DynamicHdfsConfiguration(
new HdfsConfigurationInitializer(
new HdfsConfig(),
Set.of(new TrinoS3ConfigurationInitializer(new HiveS3Config()
.setS3Endpoint(dataLake.getMinio().getMinioAddress())
.setS3SslEnabled(false)
.setS3AwsAccessKey(MINIO_ACCESS_KEY)
.setS3AwsSecretKey(MINIO_SECRET_KEY)
.setS3PathStyleAccess(true)))),
ImmutableSet.of()),
new HdfsConfig(),
new NoHdfsAuthentication()),
new TrinoHdfsFileSystemStats());
TrinoFileSystemFactory fileSystemFactory = new S3FileSystemFactory(
OpenTelemetry.noop(),
new S3FileSystemConfig()
.setEndpoint(dataLake.getMinio().getMinioAddress())
.setAwsAccessKey(MINIO_ACCESS_KEY)
.setAwsSecretKey(MINIO_SECRET_KEY)
.setRegion(MINIO_REGION)
.setPathStyleAccess(true),
new S3FileSystemStats());
ThriftMetastore thriftMetastore = testingThriftHiveMetastoreBuilder()
.thriftMetastoreConfig(new ThriftMetastoreConfig()
// Read timed out sometimes happens with the default timeout
Expand Down Expand Up @@ -227,13 +216,13 @@ public void testCreateMaterializedView()
storageTableName = storageTable.get().getSchemaTableName().getTableName();
}
Location dataLocation = Location.of(getNamespaceLocation(namespace) + "/" + storageTableName);
assertThat(fileSystem.newInputFile(dataLocation).exists())
assertThat(fileSystem.directoryExists(dataLocation).orElseThrow())
.describedAs("The directory corresponding to the table data for materialized view must exist")
.isTrue();
catalog.dropMaterializedView(SESSION, new SchemaTableName(namespace, materializedViewName));
assertThat(fileSystem.newInputFile(dataLocation).exists())
assertThat(fileSystem.directoryExists(dataLocation))
.describedAs("The materialized view drop should also delete the data files associated with it")
.isFalse();
.isEmpty();
}
finally {
try {
Expand Down