diff --git a/velox/connectors/hive/FileHandle.cpp b/velox/connectors/hive/FileHandle.cpp index dfc8f64f0406..b092946f1e10 100644 --- a/velox/connectors/hive/FileHandle.cpp +++ b/velox/connectors/hive/FileHandle.cpp @@ -34,7 +34,8 @@ std::string groupName(const std::string& filename) { } // namespace std::shared_ptr FileHandleGenerator::operator()( - std::tuple params) { + std::tuple + params) { // We have seen cases where drivers are stuck when creating file handles. // Adding a trace here to spot this more easily in future. process::TraceContext trace("FileHandleGenerator::operator()"); @@ -46,10 +47,12 @@ std::shared_ptr FileHandleGenerator::operator()( filesystems::FileOptions options; options.values["fileSize"] = std::get<1>(params); // Add length and modification time here to create a unique handle? - fileHandle->file = filesystems::getFileSystem(std::get<0>(params), properties_) - ->openFileForRead(std::get<0>(params), options); + fileHandle->file = + filesystems::getFileSystem(std::get<0>(params), properties_) + ->openFileForRead(std::get<0>(params), options); fileHandle->uuid = StringIdLease(fileIds(), std::get<0>(params)); - fileHandle->groupId = StringIdLease(fileIds(), groupName(std::get<0>(params))); + fileHandle->groupId = + StringIdLease(fileIds(), groupName(std::get<0>(params))); VLOG(1) << "Generating file handle for: " << std::get<0>(params) << " uuid: " << fileHandle->uuid.id(); } diff --git a/velox/connectors/hive/FileHandle.h b/velox/connectors/hive/FileHandle.h index 18e53dab7ecc..839899daf941 100644 --- a/velox/connectors/hive/FileHandle.h +++ b/velox/connectors/hive/FileHandle.h @@ -63,7 +63,8 @@ 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 b990d7acdab1..94593ca50af8 100644 --- a/velox/connectors/hive/HiveConnector.cpp +++ b/velox/connectors/hive/HiveConnector.cpp @@ -59,8 +59,12 @@ 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 c755a89d561b..3d47d8ba31dd 100644 --- a/velox/connectors/hive/SplitReader.cpp +++ b/velox/connectors/hive/SplitReader.cpp @@ -147,17 +147,20 @@ void SplitReader::prepareSplit( std::shared_ptr fileHandle; try { auto fileSizeIter = hiveSplit_->infoColumns.find(kFileSize); - auto fileModificationTimeIter = hiveSplit_->infoColumns.find(kModificationTime); + auto fileModificationTimeIter = + hiveSplit_->infoColumns.find(kModificationTime); if (fileSizeIter != hiveSplit_->infoColumns.end() && fileModificationTimeIter != hiveSplit_->infoColumns.end()) { fileHandle = fileHandleFactory_ - ->generate( - std::make_tuple(hiveSplit_->filePath, + ->generate(std::make_tuple( + hiveSplit_->filePath, fileSizeIter->second, fileModificationTimeIter->second)) .second; } else { - fileHandle = fileHandleFactory_->generate(std::make_tuple(hiveSplit_->filePath, "", "")).second; + fileHandle = fileHandleFactory_ + ->generate(std::make_tuple(hiveSplit_->filePath, "", "")) + .second; } } catch (const VeloxRuntimeError& e) { if (e.errorCode() == error_code::kFileNotFound && diff --git a/velox/connectors/hive/iceberg/PositionalDeleteFileReader.cpp b/velox/connectors/hive/iceberg/PositionalDeleteFileReader.cpp index 7d0ac044c13a..ae68c6595b5c 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, "", "")).second; + fileHandleFactory_->generate(make_tuple(deleteFile_.filePath, "", "")) + .second; auto deleteFileInput = createBufferedInput( *deleteFileHandle, deleteReaderOpts, diff --git a/velox/connectors/hive/tests/FileHandleTest.cpp b/velox/connectors/hive/tests/FileHandleTest.cpp index 1345b71db3f7..3962b8285bc5 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, "", "")).second; ASSERT_EQ(fileHandle->file->size(), 3);