Skip to content

Commit b6a8047

Browse files
committed
cpp-linter complains about unnamed namespaces in header files
Signed-off-by: Junwang Zhao <[email protected]>
1 parent fe5e23a commit b6a8047

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

src/iceberg/arrow/arrow_error_transform_internal.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727

2828
namespace iceberg::arrow::internal {
2929

30-
namespace {
31-
3230
inline ErrorKind ToErrorKind(const ::arrow::Status& status) {
3331
switch (status.code()) {
3432
case ::arrow::StatusCode::IOError:
@@ -46,8 +44,6 @@ inline ErrorKind ToErrorKind(const ::arrow::Status& status) {
4644
} \
4745
lhs = std::move(result_name).ValueOrDie();
4846

49-
} // namespace
50-
5147
#define ICEBERG_INTERNAL_ASSIGN_OR_RETURN(lhs, rexpr) \
5248
ICEBERG_INTERNAL_ASSIGN_OR_RETURN_IMPL( \
5349
ARROW_ASSIGN_OR_RAISE_NAME(_error_or_value, __COUNTER__), lhs, rexpr, \

src/iceberg/arrow/io/arrow_fs_file_io.cc

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,10 @@ expected<std::string, Error> ArrowFileSystemFileIO::ReadFile(
5050
expected<void, Error> ArrowFileSystemFileIO::WriteFile(const std::string& file_location,
5151
std::string_view content,
5252
bool overwrite) {
53-
// auto file_info = arrow_fs_->GetFileInfo(file_location);
54-
// if (file_info.status().ok() && !overwrite) {
55-
// return unexpected(
56-
// Error(ErrorKind::kAlreadyExists, std::format("File {} exists",
57-
// file_location)));
58-
// }
53+
auto exists = arrow_fs_->OpenInputFile(file_location).ok();
54+
if (!overwrite && exists) {
55+
return unexpected(Error(ErrorKind::kAlreadyExists, "File already exists"));
56+
}
5957
ICEBERG_INTERNAL_ASSIGN_OR_RETURN(auto file,
6058
arrow_fs_->OpenOutputStream(file_location));
6159
ICEBERG_INTERNAL_RETURN_NOT_OK(file->Write(content.data(), content.size()));

test/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ if(ICEBERG_BUILD_BUNDLE)
4242

4343
add_executable(arrow_test)
4444
target_sources(arrow_test PRIVATE arrow_test.cc)
45-
target_link_libraries(arrow_test PRIVATE iceberg_bundle_static GTest::gtest_main)
45+
target_link_libraries(arrow_test PRIVATE iceberg_bundle_static GTest::gtest_main
46+
GTest::gmock)
4647
add_test(NAME arrow_test COMMAND arrow_test)
4748

4849
add_executable(arrow_fs_file_io_test)

0 commit comments

Comments
 (0)