From 37917e7cb5d5f26b442677121295fa55e7f4447d Mon Sep 17 00:00:00 2001 From: Pasha Stetsenko Date: Tue, 8 Dec 2020 21:46:43 -0800 Subject: [PATCH] Fix the first test --- src/core/column/view.cc | 4 ++-- src/core/sort.cc | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/core/column/view.cc b/src/core/column/view.cc index ecf0bbddaf..c9a946a40b 100644 --- a/src/core/column/view.cc +++ b/src/core/column/view.cc @@ -88,13 +88,13 @@ ArrayView_ColumnImpl::ArrayView_ColumnImpl( : Virtual_ColumnImpl(nrows, col.stype()), arg(std::move(col)) { - xassert((std::is_same::value? ri.isarr32() : ri.isarr64())); - xassert(ri.max() < arg.nrows()); set_rowindex(ri); } template void ArrayView_ColumnImpl::set_rowindex(const RowIndex& ri) { + xassert((std::is_same::value? ri.isarr32() : ri.isarr64())); + xassert(ri.max() < arg.nrows()); rowindex_container = ri; indices = get_indices(ri); } diff --git a/src/core/sort.cc b/src/core/sort.cc index c8427115b6..c8cb3c94bf 100644 --- a/src/core/sort.cc +++ b/src/core/sort.cc @@ -1506,7 +1506,15 @@ void dt::ArrayView_ColumnImpl::sort_grouped( (void) out.stats(); SortContext sc(nrows(), rowindex_container, grps, /*make_groups=*/ false); sc.continue_sort(arg, /*desc=*/ false, /*make_groups=*/ false); - set_rowindex(sc.get_result_rowindex()); + if (sizeof(T) == 4) { + set_rowindex(sc.get_result_rowindex()); + } else { + // Since SortContext produces an ARR32 rowindex, and the current + // ArrayView_ColumnImpl is int64, we need to replace the column + // with the new which uses int32s. + out = Column(new dt::ArrayView_ColumnImpl( + std::move(arg), sc.get_result_rowindex(), nrows_)); + } } template class dt::ArrayView_ColumnImpl;