Skip to content

Commit 4316c85

Browse files
fix: fix build warning in switch case (#118)
1 parent ed49d1e commit 4316c85

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

src/iceberg/json_internal.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#include "iceberg/util/formatter.h" // IWYU pragma: keep
4444
#include "iceberg/util/macros.h"
4545
#include "iceberg/util/timepoint.h"
46+
#include "iceberg/util/unreachable.h"
4647

4748
namespace iceberg {
4849

@@ -476,6 +477,9 @@ nlohmann::json ToJson(const Type& type) {
476477
}
477478
case TypeId::kUuid:
478479
return "uuid";
480+
default:
481+
internal::Unreachable(std::format("Unknown type id: {}",
482+
static_cast<int>(type.type_id())));
479483
}
480484
}
481485

src/iceberg/schema_util.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "iceberg/util/checked_cast.h"
3030
#include "iceberg/util/formatter_internal.h"
3131
#include "iceberg/util/macros.h"
32+
#include "iceberg/util/unreachable.h"
3233

3334
namespace iceberg {
3435

@@ -171,6 +172,9 @@ std::string_view ToString(FieldProjection::Kind kind) {
171172
return "default";
172173
case FieldProjection::Kind::kNull:
173174
return "null";
175+
default:
176+
internal::Unreachable(std::format("Unknown field projection kind: {}",
177+
static_cast<int>(kind)));
174178
}
175179
}
176180

src/iceberg/transform.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
#include "iceberg/transform_function.h"
2626
#include "iceberg/type.h"
27+
#include "iceberg/util/unreachable.h"
2728

2829
namespace iceberg {
2930
namespace {
@@ -58,6 +59,9 @@ constexpr std::string_view TransformTypeToString(TransformType type) {
5859
return kHourName;
5960
case TransformType::kVoid:
6061
return kVoidName;
62+
default:
63+
internal::Unreachable(std::format("Unknown transform type: {}",
64+
static_cast<int>(type)));
6165
}
6266
}
6367

@@ -165,6 +169,9 @@ std::string Transform::ToString() const {
165169
case TransformType::kTruncate:
166170
return std::format("{}[{}]", TransformTypeToString(transform_type_),
167171
std::get<int32_t>(param_));
172+
default:
173+
internal::Unreachable(std::format("Unknown transform type: {}",
174+
static_cast<int>(transform_type_)));
168175
}
169176
}
170177

0 commit comments

Comments
 (0)