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

Fix cudf java build error. #9958

Merged
merged 1 commit into from
Dec 29, 2021
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
12 changes: 4 additions & 8 deletions java/src/main/java/ai/rapids/cudf/ColumnVector.java
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ public static ColumnVector md5Hash(ColumnView... columns) {
"Unsupported nested type column";
columnViews[i] = columns[i].getNativeView();
}
return new ColumnVector(hash(columnViews, HashType.HASH_MD5.getNativeId(), new int[0], 0));
return new ColumnVector(hash(columnViews, HashType.HASH_MD5.getNativeId(), 0));
}

/**
Expand All @@ -704,7 +704,7 @@ public static ColumnVector serial32BitMurmurHash3(int seed, ColumnView columns[]
assert !columns[i].getType().equals(DType.LIST) : "List columns are not supported";
columnViews[i] = columns[i].getNativeView();
}
return new ColumnVector(hash(columnViews, HashType.HASH_SERIAL_MURMUR3.getNativeId(), new int[0], seed));
return new ColumnVector(hash(columnViews, HashType.HASH_SERIAL_MURMUR3.getNativeId(), seed));
}

/**
Expand Down Expand Up @@ -739,7 +739,7 @@ public static ColumnVector spark32BitMurmurHash3(int seed, ColumnView columns[])
assert !columns[i].getType().equals(DType.LIST) : "List columns are not supported";
columnViews[i] = columns[i].getNativeView();
}
return new ColumnVector(hash(columnViews, HashType.HASH_SPARK_MURMUR3.getNativeId(), new int[0], seed));
return new ColumnVector(hash(columnViews, HashType.HASH_SPARK_MURMUR3.getNativeId(), seed));
}

/**
Expand Down Expand Up @@ -859,14 +859,10 @@ private static native long stringConcatenationSepCol(long[] columnViews,
*
* @param viewHandles array of native handles to the cudf::column_view columns being operated on.
* @param hashId integer native ID of the hashing function identifier HashType.
* @param initialValues array of integer values, one per column, only used by non-serial murmur3
* hash. Each element's hash value is merged with its column's initial value
* before the row is merged into a single value.
* @param seed integer seed for the hash. Only used by serial murmur3 hash.
* @return native handle of the resulting cudf column containing the hex-string hashing results.
*/
private static native long hash(long[] viewHandles, int hashId, int[] initialValues,
int seed) throws CudfException;
private static native long hash(long[] viewHandles, int hashId, int seed) throws CudfException;

/////////////////////////////////////////////////////////////////////////////
// INTERNAL/NATIVE ACCESS
Expand Down
11 changes: 2 additions & 9 deletions java/src/main/native/src/ColumnVectorJni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,8 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnVector_concatenate(JNIEnv *env

JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnVector_hash(JNIEnv *env, jobject j_object,
jlongArray column_handles,
jint hash_function_id,
jintArray initial_values, jint seed) {
jint hash_function_id, jint seed) {
JNI_NULL_CHECK(env, column_handles, "array of column handles is null", 0);
JNI_NULL_CHECK(env, initial_values, "array of initial values is null", 0);

try {
cudf::jni::native_jpointerArray<cudf::column_view> n_cudf_columns(env, column_handles);
Expand All @@ -340,13 +338,8 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnVector_hash(JNIEnv *env, jobje
[](auto const &p_column) { return *p_column; });
cudf::table_view *input_table = new cudf::table_view(column_views);

cudf::jni::native_jintArray native_iv(env, initial_values);
std::vector<uint32_t> vector_iv;
std::transform(native_iv.data(), native_iv.data() + native_iv.size(),
std::back_inserter(vector_iv), [](auto const &iv) { return iv; });

std::unique_ptr<cudf::column> result =
cudf::hash(*input_table, static_cast<cudf::hash_id>(hash_function_id), vector_iv, seed);
cudf::hash(*input_table, static_cast<cudf::hash_id>(hash_function_id), seed);
return reinterpret_cast<jlong>(result.release());
}
CATCH_STD(env, 0);
Expand Down