Skip to content

Commit

Permalink
Remove Hadoop usage from SemiTransactionalHiveMetastore
Browse files Browse the repository at this point in the history
  • Loading branch information
electrum committed Oct 24, 2023
1 parent 9799746 commit e77b848
Show file tree
Hide file tree
Showing 6 changed files with 354 additions and 487 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import io.trino.filesystem.Location;
import io.trino.filesystem.TrinoFileSystem;
import io.trino.filesystem.TrinoFileSystemFactory;
import io.trino.hdfs.HdfsContext;
import io.trino.hdfs.HdfsEnvironment;
import io.trino.plugin.base.CatalogName;
import io.trino.plugin.base.projection.ApplyProjectionUtil;
Expand Down Expand Up @@ -127,7 +126,6 @@
import io.trino.spi.type.VarcharType;
import org.apache.avro.Schema;
import org.apache.avro.SchemaParseException;
import org.apache.hadoop.fs.Path;

import java.io.FileNotFoundException;
import java.io.IOException;
Expand Down Expand Up @@ -1833,7 +1831,7 @@ public Optional<ConnectorOutputMetadata> finishCreateTable(ConnectorSession sess
tableStatistics = new PartitionStatistics(createEmptyStatistics(), ImmutableMap.of());
}

Optional<Path> writePath = Optional.of(new Path(writeInfo.writePath().toString()));
Optional<Location> writePath = Optional.of(writeInfo.writePath());
if (handle.getPartitionedBy().isEmpty()) {
List<String> fileNames;
if (partitionUpdates.isEmpty()) {
Expand Down Expand Up @@ -2208,7 +2206,7 @@ private Table finishChangingTable(AcidOperation acidOperation, String changeDesc
session,
table,
principalPrivileges,
Optional.of(new Path(partitionUpdate.getWritePath().toString())),
Optional.of(partitionUpdate.getWritePath()),
Optional.of(partitionUpdate.getFileNames()),
false,
partitionStatistics,
Expand Down Expand Up @@ -2268,8 +2266,8 @@ else if (partitionUpdate.getUpdateMode() == NEW || partitionUpdate.getUpdateMode
if (handle.getLocationHandle().getWriteMode() == DIRECT_TO_TARGET_EXISTING_DIRECTORY) {
removeNonCurrentQueryFiles(session, partitionUpdate.getTargetPath());
if (handle.isRetriesEnabled()) {
HdfsContext hdfsContext = new HdfsContext(session);
cleanExtraOutputFiles(hdfsEnvironment, hdfsContext, session.getQueryId(), partitionUpdate.getTargetPath(), ImmutableSet.copyOf(partitionUpdate.getFileNames()));
TrinoFileSystem fileSystem = fileSystemFactory.create(session);
cleanExtraOutputFiles(fileSystem, session.getQueryId(), partitionUpdate.getTargetPath(), ImmutableSet.copyOf(partitionUpdate.getFileNames()));
}
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public TransactionalMetadata create(ConnectorIdentity identity, boolean autoComm

DirectoryLister directoryLister = transactionScopeCachingDirectoryListerFactory.get(this.directoryLister);
SemiTransactionalHiveMetastore metastore = new SemiTransactionalHiveMetastore(
hdfsEnvironment,
fileSystemFactory,
hiveMetastoreClosure,
fileSystemExecutor,
dropExecutor,
Expand Down
Loading

0 comments on commit e77b848

Please sign in to comment.