Skip to content

Commit 7223081

Browse files
author
nullccxsy
committed
fix comments
1 parent 0e0d42c commit 7223081

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

src/iceberg/schema.cc

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -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

262256
void NameToIdVisitor::Finish() {

src/iceberg/util/string_util.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ struct ICEBERG_EXPORT string_hash {
5555
using is_transparent = void;
5656

5757
std::size_t operator()(std::string_view str) const { return hash_type{}(str); }
58+
std::size_t operator()(const char* str) const { return hash_type{}(str); }
59+
std::size_t operator()(const std::string& str) const { return hash_type{}(str); }
5860
};
5961

6062
} // namespace iceberg

0 commit comments

Comments
 (0)