From 544d71a4de8218cee20619caea58b1dc10e31321 Mon Sep 17 00:00:00 2001 From: Oleksiy <35204136+oleksiyskononenko@users.noreply.github.com> Date: Fri, 28 Apr 2023 11:25:04 -0700 Subject: [PATCH] Minor refactoring of methods to get the underlying column type (#3458) WIP for #1691 --- src/core/column.h | 1 - src/core/column/column_impl.cc | 3 +-- src/core/column/column_impl.h | 11 +++++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/core/column.h b/src/core/column.h index d8a399dec..1594fdfbb 100644 --- a/src/core/column.h +++ b/src/core/column.h @@ -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; diff --git a/src/core/column/column_impl.cc b/src/core/column/column_impl.cc index 78e633696..bf65f1737 100644 --- a/src/core/column/column_impl.cc +++ b/src/core/column/column_impl.cc @@ -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(); } diff --git a/src/core/column/column_impl.h b/src/core/column/column_impl.h index f5a50085c..a82f73ab8 100644 --- a/src/core/column/column_impl.h +++ b/src/core/column/column_impl.h @@ -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;