Skip to content

Commit

Permalink
Minor refactoring of methods to get the underlying column type (#3458)
Browse files Browse the repository at this point in the history
WIP for #1691
  • Loading branch information
oleksiyskononenko authored and samukweku committed May 2, 2023
1 parent 390df8a commit 544d71a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
1 change: 0 additions & 1 deletion src/core/column.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ class Column
size_t nrows() const noexcept;
size_t na_count() const;
const dt::Type& type() const noexcept;
const dt::Type& data_type() const noexcept;
dt::LType ltype() const noexcept;
dt::SType stype() const noexcept;

Expand Down
3 changes: 1 addition & 2 deletions src/core/column/column_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,7 @@ const Type& ColumnImpl::data_type() const {
}

SType ColumnImpl::data_stype() const {
return type_.is_categorical()? child(0).stype()
: stype();
return data_type().stype();
}


Expand Down
11 changes: 7 additions & 4 deletions src/core/column/column_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,13 @@ class ColumnImpl
size_t nrows() const noexcept { return nrows_; }
SType stype() const { return type_.stype(); }
const Type& type() const { return type_; }
const Type& data_type() const {
return type_.is_categorical()? child(0).type()
: type_;
}

// For categorical columns these methods will return the stype/type
// of the data the column is backed up with. For all the other column types,
// these methods are equivalent to `stype()`/`type()`.
SType data_stype() const;
const Type& data_type() const;

virtual bool is_virtual() const noexcept = 0;
virtual bool computationally_expensive() const { return false; }
virtual size_t memory_footprint() const noexcept = 0;
Expand Down

0 comments on commit 544d71a

Please sign in to comment.