diff --git a/src/iceberg/json_internal.cc b/src/iceberg/json_internal.cc index 3614ed230..e3e66116e 100644 --- a/src/iceberg/json_internal.cc +++ b/src/iceberg/json_internal.cc @@ -43,6 +43,7 @@ #include "iceberg/util/formatter.h" // IWYU pragma: keep #include "iceberg/util/macros.h" #include "iceberg/util/timepoint.h" +#include "iceberg/util/unreachable.h" namespace iceberg { @@ -477,6 +478,8 @@ nlohmann::json ToJson(const Type& type) { case TypeId::kUuid: return "uuid"; } + internal::Unreachable( + std::format("Unknown type id: {}", static_cast(type.type_id()))); } nlohmann::json ToJson(const Schema& schema) { diff --git a/src/iceberg/schema_util.cc b/src/iceberg/schema_util.cc index 3e409efd7..4139a2b38 100644 --- a/src/iceberg/schema_util.cc +++ b/src/iceberg/schema_util.cc @@ -29,6 +29,7 @@ #include "iceberg/util/checked_cast.h" #include "iceberg/util/formatter_internal.h" #include "iceberg/util/macros.h" +#include "iceberg/util/unreachable.h" namespace iceberg { @@ -172,6 +173,8 @@ std::string_view ToString(FieldProjection::Kind kind) { case FieldProjection::Kind::kNull: return "null"; } + internal::Unreachable( + std::format("Unknown field projection kind: {}", static_cast(kind))); } std::string ToString(const FieldProjection& projection) { diff --git a/src/iceberg/transform.cc b/src/iceberg/transform.cc index dc0529766..95f6fe717 100644 --- a/src/iceberg/transform.cc +++ b/src/iceberg/transform.cc @@ -24,6 +24,7 @@ #include "iceberg/transform_function.h" #include "iceberg/type.h" +#include "iceberg/util/unreachable.h" namespace iceberg { namespace { @@ -59,6 +60,8 @@ constexpr std::string_view TransformTypeToString(TransformType type) { case TransformType::kVoid: return kVoidName; } + internal::Unreachable( + std::format("Unknown transform type: {}", static_cast(type))); } std::shared_ptr Transform::Identity() { @@ -166,6 +169,8 @@ std::string Transform::ToString() const { return std::format("{}[{}]", TransformTypeToString(transform_type_), std::get(param_)); } + internal::Unreachable( + std::format("Unknown transform type: {}", static_cast(transform_type_))); } TransformFunction::TransformFunction(TransformType transform_type,