diff --git a/schema.cc b/schema.cc index 828066c9b0..405448a6cd 100644 --- a/schema.cc +++ b/schema.cc @@ -232,6 +232,18 @@ column_definition::column_definition(bytes name, data_type type, column_kind kin : _name(std::move(name)), type(std::move(type)), id(component_index), kind(kind), idx_info(std::move(idx)) {} +std::ostream& operator<<(std::ostream& os, const column_definition& cd) { + os << "ColumnDefinition{"; + os << "name=" << cd.name_as_text(); + os << ", type=" << cd.type->name(); + os << ", kind=" << to_sstring(cd.kind); + os << ", componentIndex=" << (cd.has_component_index() ? std::to_string(cd.component_index()) : "null"); + os << ", indexName=" << (cd.idx_info.index_name ? *cd.idx_info.index_name : "null"); + os << ", indexType=" << to_sstring(cd.idx_info.index_type); + os << "}"; + return os; +} + const column_definition* schema::get_column_definition(const bytes& name) const { auto i = _columns_by_name.find(name); diff --git a/schema.hh b/schema.hh index a72ddf0ae5..76cd70a5e1 100644 --- a/schema.hh +++ b/schema.hh @@ -187,9 +187,7 @@ public: bool is_compact_value() const { return kind == column_kind::compact_column; } const sstring& name_as_text() const; const bytes& name() const; - friend std::ostream& operator<<(std::ostream& os, const column_definition& cd) { - return os << cd.name_as_text(); - } + friend std::ostream& operator<<(std::ostream& os, const column_definition& cd); friend std::ostream& operator<<(std::ostream& os, const column_definition* cd) { return cd != nullptr ? os << *cd : os << "(null)"; }