Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept r-value references in convert_table_for_return(): #10131

Merged
merged 6 commits into from
Jan 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions java/src/main/native/include/jni_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,9 @@ template <typename T> class native_jpointerArray {

T **data() { return reinterpret_cast<T **>(wrapped.data()); }

T *const *begin() const { return data(); }
T *const *end() const { return data() + size(); }

const jlongArray get_jArray() const { return wrapped.get_jArray(); }

jlongArray get_jArray() { return wrapped.get_jArray(); }
Expand Down
22 changes: 10 additions & 12 deletions java/src/main/native/src/ColumnViewJni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -561,18 +561,17 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnView_listSortRows(JNIEnv *env,

JNIEXPORT jlongArray JNICALL Java_ai_rapids_cudf_ColumnView_stringSplit(JNIEnv *env, jclass,
jlong column_view,
jlong delimiter,
jlong delimiter_ptr,
jint max_split) {
JNI_NULL_CHECK(env, column_view, "column is null", 0);
JNI_NULL_CHECK(env, delimiter, "string scalar delimiter is null", 0);
JNI_NULL_CHECK(env, delimiter_ptr, "string scalar delimiter is null", 0);
try {
cudf::jni::auto_set_device(env);
cudf::column_view *cv = reinterpret_cast<cudf::column_view *>(column_view);
cudf::strings_column_view scv(*cv);
cudf::string_scalar *ss_scalar = reinterpret_cast<cudf::string_scalar *>(delimiter);
cudf::strings_column_view const scv{*reinterpret_cast<cudf::column_view *>(column_view)};
auto delimiter = reinterpret_cast<cudf::string_scalar *>(delimiter_ptr);

std::unique_ptr<cudf::table> table_result = cudf::strings::split(scv, *ss_scalar, max_split);
return cudf::jni::convert_table_for_return(env, table_result);
return cudf::jni::convert_table_for_return(env,
cudf::strings::split(scv, *delimiter, max_split));
}
CATCH_STD(env, 0);
}
Expand Down Expand Up @@ -1410,13 +1409,12 @@ JNIEXPORT jlongArray JNICALL Java_ai_rapids_cudf_ColumnView_extractRe(JNIEnv *en

try {
cudf::jni::auto_set_device(env);
cudf::column_view *column_view = reinterpret_cast<cudf::column_view *>(j_view_handle);
cudf::strings_column_view strings_column(*column_view);
cudf::strings_column_view const strings_column{
*reinterpret_cast<cudf::column_view *>(j_view_handle)};
cudf::jni::native_jstring pattern(env, patternObj);

std::unique_ptr<cudf::table> table_result =
cudf::strings::extract(strings_column, pattern.get());
return cudf::jni::convert_table_for_return(env, table_result);
return cudf::jni::convert_table_for_return(
env, cudf::strings::extract(strings_column, pattern.get()));
}
CATCH_STD(env, 0);
}
Expand Down
Loading