diff --git a/velox/connectors/hive/FileHandle.cpp b/velox/connectors/hive/FileHandle.cpp index d6dfcf5ac06c8..a0ed3ea733440 100644 --- a/velox/connectors/hive/FileHandle.cpp +++ b/velox/connectors/hive/FileHandle.cpp @@ -44,12 +44,15 @@ std::shared_ptr FileHandleGenerator::operator()( MicrosecondTimer timer(&elapsedTimeUs); fileHandle = std::make_shared(); filesystems::FileOptions options; - options.fileSize = std::get<1>(fileProperties) == -1 ? std::nullopt - : std::optional{std::get<1>(fileProperties)}; - fileHandle->file = filesystems::getFileSystem(std::get<0>(fileProperties), properties_) - ->openFileForRead(std::get<0>(fileProperties), options); + options.fileSize = std::get<1>(fileProperties) == -1 + ? std::nullopt + : std::optional{std::get<1>(fileProperties)}; + fileHandle->file = + filesystems::getFileSystem(std::get<0>(fileProperties), properties_) + ->openFileForRead(std::get<0>(fileProperties), options); fileHandle->uuid = StringIdLease(fileIds(), std::get<0>(fileProperties)); - fileHandle->groupId = StringIdLease(fileIds(), groupName(std::get<0>(fileProperties))); + fileHandle->groupId = + StringIdLease(fileIds(), groupName(std::get<0>(fileProperties))); VLOG(1) << "Generating file handle for: " << std::get<0>(fileProperties); } RECORD_HISTOGRAM_METRIC_VALUE( diff --git a/velox/connectors/hive/FileHandle.h b/velox/connectors/hive/FileHandle.h index ba5425fd5c5d3..d1e22035bddc1 100644 --- a/velox/connectors/hive/FileHandle.h +++ b/velox/connectors/hive/FileHandle.h @@ -54,7 +54,8 @@ struct FileHandle { // first diff we'll not include the map. }; -using FileHandleCache = SimpleLRUCache, FileHandle>; +using FileHandleCache = + SimpleLRUCache, FileHandle>; // Creates FileHandles via the Generator interface the CachedFactory requires. class FileHandleGenerator { @@ -63,7 +64,7 @@ class FileHandleGenerator { FileHandleGenerator(std::shared_ptr properties) : properties_(std::move(properties)) {} std::shared_ptr operator()( - std::tuple params); + std::tuple params); private: const std::shared_ptr properties_; diff --git a/velox/connectors/hive/HiveConnector.cpp b/velox/connectors/hive/HiveConnector.cpp index 63a7e4bbde20b..735f766f9149c 100644 --- a/velox/connectors/hive/HiveConnector.cpp +++ b/velox/connectors/hive/HiveConnector.cpp @@ -59,8 +59,9 @@ HiveConnector::HiveConnector( hiveConfig_(std::make_shared(config)), fileHandleFactory_( hiveConfig_->isFileHandleCacheEnabled() - ? std::make_unique< - SimpleLRUCache, std::shared_ptr>>( + ? std::make_unique, + std::shared_ptr>>( hiveConfig_->numCacheFileHandles()) : nullptr, std::make_unique(config)), diff --git a/velox/connectors/hive/SplitReader.cpp b/velox/connectors/hive/SplitReader.cpp index 404a43e6ed7e2..4c5553fd4669c 100644 --- a/velox/connectors/hive/SplitReader.cpp +++ b/velox/connectors/hive/SplitReader.cpp @@ -216,8 +216,12 @@ void SplitReader::createReader() { std::shared_ptr fileHandle; try { - fileHandle = fileHandleFactory_->generate(std::make_tuple( - hiveSplit_->filePath, hiveSplit_->fileSize, hiveSplit_->modificationTime)).second; + fileHandle = fileHandleFactory_ + ->generate(std::make_tuple( + hiveSplit_->filePath, + hiveSplit_->fileSize, + hiveSplit_->modificationTime)) + .second; } catch (const VeloxRuntimeError& e) { if (e.errorCode() == error_code::kFileNotFound && hiveConfig_->ignoreMissingFiles( diff --git a/velox/connectors/hive/iceberg/PositionalDeleteFileReader.cpp b/velox/connectors/hive/iceberg/PositionalDeleteFileReader.cpp index 042d42f3c4034..8ca657a08abb8 100644 --- a/velox/connectors/hive/iceberg/PositionalDeleteFileReader.cpp +++ b/velox/connectors/hive/iceberg/PositionalDeleteFileReader.cpp @@ -94,7 +94,8 @@ PositionalDeleteFileReader::PositionalDeleteFileReader( deleteSplit_); auto deleteFileHandle = - fileHandleFactory_->generate(make_tuple(deleteFile_.filePath, -1, -1)).second; + fileHandleFactory_->generate(make_tuple(deleteFile_.filePath, -1, -1)) + .second; auto deleteFileInput = createBufferedInput( *deleteFileHandle, deleteReaderOpts, diff --git a/velox/connectors/hive/storage_adapters/s3fs/tests/S3FileSystemRegistrationTest.cpp b/velox/connectors/hive/storage_adapters/s3fs/tests/S3FileSystemRegistrationTest.cpp index 75908f64ff076..b2797abb6e6e4 100644 --- a/velox/connectors/hive/storage_adapters/s3fs/tests/S3FileSystemRegistrationTest.cpp +++ b/velox/connectors/hive/storage_adapters/s3fs/tests/S3FileSystemRegistrationTest.cpp @@ -64,8 +64,9 @@ TEST_F(S3FileSystemRegistrationTest, fileHandle) { } auto hiveConfig = minioServer_->hiveConfig(); FileHandleFactory factory( - std::make_unique< - SimpleLRUCache, std::shared_ptr>>(1000), + std::make_unique, + std::shared_ptr>>(1000), std::make_unique(hiveConfig)); auto fileHandle = factory.generate(s3File).second; readData(fileHandle->file.get()); diff --git a/velox/connectors/hive/tests/FileHandleTest.cpp b/velox/connectors/hive/tests/FileHandleTest.cpp index 89c92b1848af9..42a4c37aa9be4 100644 --- a/velox/connectors/hive/tests/FileHandleTest.cpp +++ b/velox/connectors/hive/tests/FileHandleTest.cpp @@ -37,8 +37,9 @@ TEST(FileHandleTest, localFile) { } FileHandleFactory factory( - std::make_unique< - SimpleLRUCache, std::shared_ptr>>(1000), + std::make_unique, + std::shared_ptr>>(1000), std::make_unique()); auto fileHandle = factory.generate(std::make_tuple(filename, -1, -1)).second; ASSERT_EQ(fileHandle->file->size(), 3);