Skip to content

Commit

Permalink
review changes req by @ttnghia
Browse files Browse the repository at this point in the history
  • Loading branch information
devavret committed Mar 21, 2022
1 parent 01be0bc commit de95530
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
10 changes: 5 additions & 5 deletions cpp/benchmarks/sort/sort_structs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ void nvbench_sort_struct(nvbench::state& state)
std::default_random_engine generator;
std::uniform_int_distribution<int> distribution(0, 100);

const cudf::size_type n_rows{(cudf::size_type)state.get_int64("NumRows")};
const cudf::size_type n_rows{static_cast<cudf::size_type>(state.get_int64("NumRows"))};
const cudf::size_type n_cols{1};
const cudf::size_type depth{(cudf::size_type)state.get_int64("Depth")};
const cudf::size_type depth{static_cast<cudf::size_type>(state.get_int64("Depth"))};
const bool nulls{static_cast<bool>(state.get_int64("Nulls"))};

// Create columns with values in the range [0,100)
std::vector<column_wrapper> columns;
columns.reserve(n_cols);
std::generate_n(std::back_inserter(columns), n_cols, [&, n_rows]() {
auto elements = cudf::detail::make_counting_transform_iterator(
std::generate_n(std::back_inserter(columns), n_cols, [&]() {
auto const elements = cudf::detail::make_counting_transform_iterator(
0, [&](auto row) { return distribution(generator); });
if (!nulls) return column_wrapper(elements, elements + n_rows);
auto valids =
Expand All @@ -69,7 +69,7 @@ void nvbench_sort_struct(nvbench::state& state)
}

// Create table view
auto input = cudf::table(std::move(child_cols));
auto const input = cudf::table(std::move(child_cols));

state.exec(nvbench::exec_tag::sync, [&](nvbench::launch& launch) {
rmm::cuda_stream_view stream_view{launch.get_stream()};
Expand Down
15 changes: 8 additions & 7 deletions cpp/include/cudf/table/experimental/row_operators.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ namespace experimental {
* @endcode
*/
template <cudf::type_id t>
struct dispatch_nested_to_void {
struct dispatch_void_if_nested {
using type = std::conditional_t<cudf::is_nested(data_type(t)), void, id_to_type<t>>;
};

Expand Down Expand Up @@ -150,8 +150,8 @@ class element_comparator {
++depth;
}

auto comparator = element_comparator{_nulls, lcol, rcol, _null_precedence, depth};
return cudf::type_dispatcher<dispatch_nested_to_void>(
auto const comparator = element_comparator{_nulls, lcol, rcol, _null_precedence, depth};
return cudf::type_dispatcher<dispatch_void_if_nested>(
lcol.type(), comparator, lhs_element_index, rhs_element_index);
}

Expand Down Expand Up @@ -227,15 +227,16 @@ class device_row_comparator {
{
int last_null_depth = std::numeric_limits<int>::max();
for (size_type i = 0; i < _lhs.num_columns(); ++i) {
int depth = _depth.has_value() ? (*_depth)[i] : 0;
int const depth = _depth.has_value() ? (*_depth)[i] : 0;
if (depth > last_null_depth) { continue; }

bool ascending = _column_order.has_value() ? (*_column_order)[i] == order::ASCENDING : true;
bool const ascending =
_column_order.has_value() ? (*_column_order)[i] == order::ASCENDING : true;

null_order null_precedence =
null_order const null_precedence =
_null_precedence.has_value() ? (*_null_precedence)[i] : null_order::BEFORE;

auto comparator =
auto const comparator =
element_comparator{_nulls, _lhs.column(i), _rhs.column(i), null_precedence, depth};

weak_ordering state;
Expand Down

0 comments on commit de95530

Please sign in to comment.