Skip to content

Commit

Permalink
update java code to use non detail api
Browse files Browse the repository at this point in the history
  • Loading branch information
robertmaynard committed Jun 25, 2024
1 parent 0716b42 commit b3f9001
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
26 changes: 13 additions & 13 deletions java/src/main/native/src/ColumnViewJni.cu
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
#include <cudf/detail/iterator.cuh>
#include <cudf/detail/labeling/label_segments.cuh>
#include <cudf/detail/null_mask.hpp>
#include <cudf/detail/stream_compaction.hpp>
#include <cudf/detail/valid_if.cuh>
#include <cudf/lists/list_device_view.cuh>
#include <cudf/lists/lists_column_device_view.cuh>
#include <cudf/stream_compaction.hpp>
#include <cudf/table/table.hpp>
#include <cudf/table/table_view.hpp>
#include <cudf/utilities/span.hpp>
Expand Down Expand Up @@ -201,17 +201,17 @@ std::unique_ptr<cudf::column> lists_distinct_by_key(cudf::lists_column_view cons
// Use `cudf::duplicate_keep_option::KEEP_LAST` so this will produce the desired behavior when
// being called in `create_map` in spark-rapids.
// Other options comparing nulls and NaNs are set as all-equal.
auto out_columns = cudf::detail::stable_distinct(
table_view{{column_view{cudf::device_span<cudf::size_type const>{labels}},
child.child(0),
child.child(1)}}, // input table
std::vector<size_type>{0, 1}, // key columns
cudf::duplicate_keep_option::KEEP_LAST,
cudf::null_equality::EQUAL,
cudf::nan_equality::ALL_EQUAL,
stream,
rmm::mr::get_current_device_resource())
->release();
auto out_columns =
cudf::stable_distinct(table_view{{column_view{cudf::device_span<cudf::size_type const>{labels}},
child.child(0),
child.child(1)}}, // input table
std::vector<size_type>{0, 1}, // key columns
cudf::duplicate_keep_option::KEEP_LAST,
cudf::null_equality::EQUAL,
cudf::nan_equality::ALL_EQUAL,
stream,
rmm::mr::get_current_device_resource())
->release();
auto const out_labels = out_columns.front()->view();

// Assemble a structs column of <out_keys, out_vals>.
Expand All @@ -237,7 +237,7 @@ std::unique_ptr<cudf::column> lists_distinct_by_key(cudf::lists_column_view cons
std::move(out_offsets),
std::move(out_structs),
input.null_count(),
cudf::detail::copy_bitmask(input.parent(), stream, rmm::mr::get_current_device_resource()),
cudf::copy_bitmask(input.parent(), stream, rmm::mr::get_current_device_resource()),
stream);
}

Expand Down
20 changes: 10 additions & 10 deletions java/src/main/native/src/maps_column_view.cu
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/

#include <cudf/detail/replace.hpp>
#include <cudf/lists/detail/contains.hpp>
#include <cudf/lists/detail/extract.hpp>
#include <cudf/lists/contains.hpp>
#include <cudf/lists/extract.hpp>
#include <cudf/scalar/scalar.hpp>

#include <rmm/exec_policy.hpp>
Expand Down Expand Up @@ -61,19 +61,19 @@ std::unique_ptr<column> get_values_for_impl(maps_column_view const& maps_view,
auto const values_ = maps_view.values();
CUDF_EXPECTS(lookup_keys.type().id() == keys_.child().type().id(),
"Lookup keys must have the same type as the keys of the map column.");
auto key_indices = lists::detail::index_of(keys_,
lookup_keys,
lists::duplicate_find_option::FIND_LAST,
stream,
rmm::mr::get_current_device_resource());
auto key_indices = lists::index_of(keys_,
lookup_keys,
lists::duplicate_find_option::FIND_LAST,
stream,
rmm::mr::get_current_device_resource());
auto constexpr absent_offset = size_type{-1};
auto constexpr nullity_offset = std::numeric_limits<size_type>::min();
thrust::replace(rmm::exec_policy(stream),
key_indices->mutable_view().template begin<size_type>(),
key_indices->mutable_view().template end<size_type>(),
absent_offset,
nullity_offset);
return lists::detail::extract_list_element(values_, key_indices->view(), stream, mr);
return lists::extract_list_element(values_, key_indices->view(), stream, mr);
}

std::unique_ptr<column> maps_column_view::get_values_for(column_view const& lookup_keys,
Expand Down Expand Up @@ -103,10 +103,10 @@ std::unique_ptr<column> contains_impl(maps_column_view const& maps_view,
CUDF_EXPECTS(lookup_keys.type().id() == keys.child().type().id(),
"Lookup keys must have the same type as the keys of the map column.");
auto const contains =
lists::detail::contains(keys, lookup_keys, stream, rmm::mr::get_current_device_resource());
lists::contains(keys, lookup_keys, stream, rmm::mr::get_current_device_resource());
// Replace nulls with BOOL8{false};
auto const scalar_false = numeric_scalar<bool>{false, true, stream};
return detail::replace_nulls(contains->view(), scalar_false, stream, mr);
return cudf::replace_nulls(contains->view(), scalar_false, stream, mr);
}

std::unique_ptr<column> maps_column_view::contains(column_view const& lookup_keys,
Expand Down

0 comments on commit b3f9001

Please sign in to comment.