Skip to content

Commit db8aa74

Browse files
fix: fix build warning in switch case (#118) (#119)
fix some compilation warnings. see issue (#118)
1 parent ed49d1e commit db8aa74

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

src/iceberg/json_internal.cc

Lines changed: 3 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

@@ -477,6 +478,8 @@ nlohmann::json ToJson(const Type& type) {
477478
case TypeId::kUuid:
478479
return "uuid";
479480
}
481+
internal::Unreachable(
482+
std::format("Unknown type id: {}", static_cast<int>(type.type_id())));
480483
}
481484

482485
nlohmann::json ToJson(const Schema& schema) {

src/iceberg/schema_util.cc

Lines changed: 3 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

@@ -172,6 +173,8 @@ std::string_view ToString(FieldProjection::Kind kind) {
172173
case FieldProjection::Kind::kNull:
173174
return "null";
174175
}
176+
internal::Unreachable(
177+
std::format("Unknown field projection kind: {}", static_cast<int>(kind)));
175178
}
176179

177180
std::string ToString(const FieldProjection& projection) {

src/iceberg/transform.cc

Lines changed: 5 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 {
@@ -59,6 +60,8 @@ constexpr std::string_view TransformTypeToString(TransformType type) {
5960
case TransformType::kVoid:
6061
return kVoidName;
6162
}
63+
internal::Unreachable(
64+
std::format("Unknown transform type: {}", static_cast<int>(type)));
6265
}
6366

6467
std::shared_ptr<Transform> Transform::Identity() {
@@ -166,6 +169,8 @@ std::string Transform::ToString() const {
166169
return std::format("{}[{}]", TransformTypeToString(transform_type_),
167170
std::get<int32_t>(param_));
168171
}
172+
internal::Unreachable(
173+
std::format("Unknown transform type: {}", static_cast<int>(transform_type_)));
169174
}
170175

171176
TransformFunction::TransformFunction(TransformType transform_type,

0 commit comments

Comments
 (0)