@@ -35,8 +35,8 @@ class IdToFieldVisitor {
3535 explicit IdToFieldVisitor (
3636 std::unordered_map<int32_t , std::reference_wrapper<const SchemaField>>&
3737 id_to_field);
38- Status Visit (const Type & type);
39- Status VisitNestedType (const Type & type);
38+ Status Visit (const PrimitiveType & type);
39+ Status Visit (const NestedType & type);
4040
4141 private:
4242 std::unordered_map<int32_t , std::reference_wrapper<const SchemaField>>& id_to_field_;
@@ -147,22 +147,17 @@ IdToFieldVisitor::IdToFieldVisitor(
147147 std::unordered_map<int32_t , std::reference_wrapper<const SchemaField>>& id_to_field)
148148 : id_to_field_(id_to_field) {}
149149
150- Status IdToFieldVisitor::Visit (const Type& type) {
151- if (type.is_nested ()) {
152- ICEBERG_RETURN_UNEXPECTED (VisitNestedType (type));
153- }
154- return {};
155- }
150+ Status IdToFieldVisitor::Visit (const PrimitiveType& type) { return {}; }
156151
157- Status IdToFieldVisitor::VisitNestedType (const Type & type) {
152+ Status IdToFieldVisitor::Visit (const NestedType & type) {
158153 const auto & nested = iceberg::internal::checked_cast<const NestedType&>(type);
159154 const auto & fields = nested.fields ();
160155 for (const auto & field : fields) {
161156 auto it = id_to_field_.try_emplace (field.field_id (), std::cref (field));
162157 if (!it.second ) {
163158 return InvalidSchema (" Duplicate field id found: {}" , field.field_id ());
164159 }
165- ICEBERG_RETURN_UNEXPECTED (Visit (*field.type ()));
160+ ICEBERG_RETURN_UNEXPECTED (VisitTypeInline (*field.type (), this ));
166161 }
167162 return {};
168163}
@@ -256,7 +251,6 @@ std::string NameToIdVisitor::BuildPath(std::string_view prefix,
256251 }
257252 return prefix.empty () ? StringUtils::ToLower (quoted_name)
258253 : std::string (prefix) + " ." + StringUtils::ToLower (quoted_name);
259- ;
260254}
261255
262256void NameToIdVisitor::Finish () {
0 commit comments