← Back to Pull requests

Add Java bindings for the remaining libcudf hash functions #25394

Open
bdice opened this pull request with 609 lines diff across 3 files
View on GitHub
bdice bdice commented on Nov 18, 2026 21:41 UTC
Author

Description

cuDF Java exposed only md5Hash and sha1Hash from cudf/hashing.hpp. This adds ColumnVector bindings for the rest: sha224Hash, sha256Hash, sha384Hash, sha512Hash, murmurHash3x86_32, sparkMurmurHash3x86_32, murmurHash3x64_128 (returns a two-column Table), xxhash32 and xxhash64. Seeds are Java int/long whose bits are passed to libcudf as unsigned, matching the C++ seed widths.

For a single STRING column, libcudf's xxHash64 is the reference XXH64 of each row's UTF-8 bytes, which the tests check against Python's xxhash. This covers the use case in #25314 without a new libcudf API.

xref #25314, #25357

Checklist


  • I am familiar with the Contributing Guidelines.

  • New or existing tests cover these changes.

  • The documentation is up to date with these changes.
  • Diff: 609 lines (+587 / -22) across 3 files Reviewer: bdice Review duration: 25419m
    All Vouch review confidence checks passed
    Residual risk 0.10 = Change Risk (0.58) × (1 − Review Confidence (0.83)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.58 · 609 lines diff across 3 files
    0.58
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.89 · 5 substantive comment(s)
    0.89
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    83%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.384
    Self Review self_review
    0.140
    Real PR Conversation Timeline
    17 items
    copy-pr-bot[bot] copy-pr-bot[bot] commented on Nov 18, 2026 21:41 UTC
    Bot

    Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

    Contributors can view more details about this message here.

    bdice bdice commented on code on Nov 18, 2026 23:08 UTC
    Code Review
    java/src/main/java/ai/rapids/cudf/ColumnVector.java:1

    Please use the getNativeViews helper here and for md5 and wherever needed for alignment and less repetition.

    bdice bdice commented on code on Nov 18, 2026 23:08 UTC
    Code Review
    java/src/main/java/ai/rapids/cudf/ColumnVector.java:1
    @@ -789,6 +789,116 @@ public static ColumnVector sha1Hash(ColumnView... columns) {
         return new ColumnVector(sha1(columnViews));
       }
     
    +  /**
    +   * Create a new column containing the SHA-224 hash of each row in the table.
    +   *
    +   * @param columns columns to hash
    +   * @return the new ColumnVector of 56 character hex strings representing each row's hash value.
    +   */
    +  public static ColumnVector sha224Hash(ColumnView... columns) {
    +    return new ColumnVector(sha224(getNativeViews("SHA-224", columns)));
    +  }
    +
    +  /**
    +   * Create a new column containing the SHA-256 hash of each row in the table.
    +   *
    +   * @param columns columns to hash
    +   * @return the new ColumnVector of 64 character hex strings representing each row's hash value.
    +   */
    +  public static ColumnVector sha256Hash(ColumnView... columns) {
    +    return new ColumnVector(sha256(getNativeViews("SHA-256", columns)));
    +  }
    +
    +  /**
    +   * Create a new column containing the SHA-384 hash of each row in the table.
    +   *
    +   * @param columns columns to hash
    +   * @return the new ColumnVector of 96 character hex strings representing each row's hash value.
    +   */
    +  public static ColumnVector sha384Hash(ColumnView... columns) {
    +    return new ColumnVector(sha384(getNativeViews("SHA-384", columns)));
    +  }
    +
    +  /**
    +   * Create a new column containing the SHA-512 hash of each row in the table.
    +   *
    +   * @param columns columns to hash
    +   * @return the new ColumnVector of 128 character hex strings representing each row's hash value.
    +   */
    +  public static ColumnVector sha512Hash(ColumnView... columns) {
    +    return new ColumnVector(sha512(getNativeViews("SHA-512", columns)));
    +  }
    +
    +  /**
    +   * Create a new column containing the MurmurHash3_x86_32 hash of each row in the table.
    +   *
    +   * @param seed the hash seed; its bits are used as an unsigned 32-bit value.
    +   * @param columns columns to hash
    +   * @return the new UINT32 ColumnVector of hash values.
    +   */
    +  public static ColumnVector murmurHash3x86_32(int seed, ColumnView... columns) {
    +    return new ColumnVector(murmurHash32(seed, getNativeViews("MurmurHash3_x86_32", columns)));
    +  }
    +
    +  /**
    +   * Create a new column containing the Apache Spark-compatible MurmurHash3_x86_32 hash of each row
    +   * in the table.
    +   *
    +   * @param seed the initial hash seed; its bits are used as an unsigned 32-bit value. Spark's
    +   *             SQL {@code hash()} uses 42.
    +   * @param columns columns to hash
    +   * @return the new INT32 ColumnVector of hash values.
    +   */
    +  public static ColumnVector sparkMurmurHash3x86_32(int seed, ColumnView... columns) {
    +    return new ColumnVector(
    +        sparkMurmurHash32(seed, getNativeViews("Spark MurmurHash3_x86_32", columns)));
    +  }
    +
    +  /**
    +   * Create a new table containing the MurmurHash3_x64_128 hash of each row in the table.
    +   *
    +   * @param seed the hash seed; its bits are used as an unsigned 64-bit value.
    +   * @param columns columns to hash
    +   * @return a new Table of two UINT64 columns holding the two 64-bit halves of each row's hash.
    +   */
    +  public static Table murmurHash3x64_128(long seed, ColumnView... columns) {
    +    return new Table(murmurHash128(seed, getNativeViews("MurmurHash3_x64_128", columns)));
    +  }
    +
    +  /**
    +   * Create a new column containing the xxHash32 hash of each row in the table.
    +   *
    +   * @param seed the hash seed; its bits are used as an unsigned 32-bit value.
    +   * @param columns columns to hash
    +   * @return the new UINT32 ColumnVector of hash values.
    +   */
    +  public static ColumnVector xxhash32(int seed, ColumnView... columns) {
    +    return new ColumnVector(xxHash32(seed, getNativeViews("xxHash32", columns)));
    +  }
    +
    +  /**
    +   * Create a new column containing the xxHash64 hash of each row in the table.
    +   *
    +   * @param seed the hash seed; its bits are used as an unsigned 64-bit value.
    +   * @param columns columns to hash
    +   * @return the new UINT64 ColumnVector of hash values.
    +   */
    +  public static ColumnVector xxhash64(long seed, ColumnView... columns) {
    +    return new ColumnVector(xxHash64(seed, getNativeViews("xxHash64", columns)));
    +  }
    +
    +  private static long[] getNativeViews(String hashName, ColumnView... columns) {

    Maybe declare this higher up in the file, before it's used?

    bdice bdice commented on code on Nov 18, 2026 23:09 UTC
    Code Review
    java/src/main/native/src/ColumnVectorJni.cpp:1
    @@ -438,6 +438,157 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnVector_sha1(JNIEnv* env,
       JNI_CATCH(env, 0);
     }
     
    +JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnVector_sha224(JNIEnv* env,
    +                                                                jclass,
    +                                                                jlongArray column_handles)
    +{
    +  JNI_NULL_CHECK(env, column_handles, "array of column handles is null", 0);
    +
    +  JNI_TRY
    +  {
    +    cudf::jni::auto_set_device(env);

    Do we need the same auto_set_device in sha1 and md5 and others above?

    bdice bdice commented on code on Nov 18, 2026 23:14 UTC
    Code Review
    java/src/main/java/ai/rapids/cudf/ColumnVector.java:1

    Done in 1a91873c8e

    bdice bdice commented on code on Nov 18, 2026 23:14 UTC
    Code Review
    java/src/main/java/ai/rapids/cudf/ColumnVector.java:1
    @@ -789,6 +789,116 @@ public static ColumnVector sha1Hash(ColumnView... columns) {
         return new ColumnVector(sha1(columnViews));
       }
     
    +  /**
    +   * Create a new column containing the SHA-224 hash of each row in the table.
    +   *
    +   * @param columns columns to hash
    +   * @return the new ColumnVector of 56 character hex strings representing each row's hash value.
    +   */
    +  public static ColumnVector sha224Hash(ColumnView... columns) {
    +    return new ColumnVector(sha224(getNativeViews("SHA-224", columns)));
    +  }
    +
    +  /**
    +   * Create a new column containing the SHA-256 hash of each row in the table.
    +   *
    +   * @param columns columns to hash
    +   * @return the new ColumnVector of 64 character hex strings representing each row's hash value.
    +   */
    +  public static ColumnVector sha256Hash(ColumnView... columns) {
    +    return new ColumnVector(sha256(getNativeViews("SHA-256", columns)));
    +  }
    +
    +  /**
    +   * Create a new column containing the SHA-384 hash of each row in the table.
    +   *
    +   * @param columns columns to hash
    +   * @return the new ColumnVector of 96 character hex strings representing each row's hash value.
    +   */
    +  public static ColumnVector sha384Hash(ColumnView... columns) {
    +    return new ColumnVector(sha384(getNativeViews("SHA-384", columns)));
    +  }
    +
    +  /**
    +   * Create a new column containing the SHA-512 hash of each row in the table.
    +   *
    +   * @param columns columns to hash
    +   * @return the new ColumnVector of 128 character hex strings representing each row's hash value.
    +   */
    +  public static ColumnVector sha512Hash(ColumnView... columns) {
    +    return new ColumnVector(sha512(getNativeViews("SHA-512", columns)));
    +  }
    +
    +  /**
    +   * Create a new column containing the MurmurHash3_x86_32 hash of each row in the table.
    +   *
    +   * @param seed the hash seed; its bits are used as an unsigned 32-bit value.
    +   * @param columns columns to hash
    +   * @return the new UINT32 ColumnVector of hash values.
    +   */
    +  public static ColumnVector murmurHash3x86_32(int seed, ColumnView... columns) {
    +    return new ColumnVector(murmurHash32(seed, getNativeViews("MurmurHash3_x86_32", columns)));
    +  }
    +
    +  /**
    +   * Create a new column containing the Apache Spark-compatible MurmurHash3_x86_32 hash of each row
    +   * in the table.
    +   *
    +   * @param seed the initial hash seed; its bits are used as an unsigned 32-bit value. Spark's
    +   *             SQL {@code hash()} uses 42.
    +   * @param columns columns to hash
    +   * @return the new INT32 ColumnVector of hash values.
    +   */
    +  public static ColumnVector sparkMurmurHash3x86_32(int seed, ColumnView... columns) {
    +    return new ColumnVector(
    +        sparkMurmurHash32(seed, getNativeViews("Spark MurmurHash3_x86_32", columns)));
    +  }
    +
    +  /**
    +   * Create a new table containing the MurmurHash3_x64_128 hash of each row in the table.
    +   *
    +   * @param seed the hash seed; its bits are used as an unsigned 64-bit value.
    +   * @param columns columns to hash
    +   * @return a new Table of two UINT64 columns holding the two 64-bit halves of each row's hash.
    +   */
    +  public static Table murmurHash3x64_128(long seed, ColumnView... columns) {
    +    return new Table(murmurHash128(seed, getNativeViews("MurmurHash3_x64_128", columns)));
    +  }
    +
    +  /**
    +   * Create a new column containing the xxHash32 hash of each row in the table.
    +   *
    +   * @param seed the hash seed; its bits are used as an unsigned 32-bit value.
    +   * @param columns columns to hash
    +   * @return the new UINT32 ColumnVector of hash values.
    +   */
    +  public static ColumnVector xxhash32(int seed, ColumnView... columns) {
    +    return new ColumnVector(xxHash32(seed, getNativeViews("xxHash32", columns)));
    +  }
    +
    +  /**
    +   * Create a new column containing the xxHash64 hash of each row in the table.
    +   *
    +   * @param seed the hash seed; its bits are used as an unsigned 64-bit value.
    +   * @param columns columns to hash
    +   * @return the new UINT64 ColumnVector of hash values.
    +   */
    +  public static ColumnVector xxhash64(long seed, ColumnView... columns) {
    +    return new ColumnVector(xxHash64(seed, getNativeViews("xxHash64", columns)));
    +  }
    +
    +  private static long[] getNativeViews(String hashName, ColumnView... columns) {

    Done in 1a91873c8e

    bdice bdice commented on code on Nov 18, 2026 23:14 UTC
    Code Review
    java/src/main/native/src/ColumnVectorJni.cpp:1
    @@ -438,6 +438,157 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnVector_sha1(JNIEnv* env,
       JNI_CATCH(env, 0);
     }
     
    +JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_ColumnVector_sha224(JNIEnv* env,
    +                                                                jclass,
    +                                                                jlongArray column_handles)
    +{
    +  JNI_NULL_CHECK(env, column_handles, "array of column handles is null", 0);
    +
    +  JNI_TRY
    +  {
    +    cudf::jni::auto_set_device(env);

    Yes, done in 1a91873c8e. md5 and sha1 were the only JNI entry points in ColumnVectorJni.cpp without it, so they could run on the wrong device when the calling thread had a different current device.

    bdice bdice commented on Nov 18, 2026 23:14 UTC
    Author

    /ok to test 1a91873c8e3b8eeca9aebe3e7920817f114ad099

    coderabbitai[bot] coderabbitai[bot] commented on Nov 18, 2026 23:26 UTC
    Bot

    <!-- coderabbit-ai-generated:v1 -->

    <!-- This is an auto-generated comment: summarize by coderabbit.ai -->
    <!-- review_stack_entry_start -->

    <a href="https://app.coderabbit.ai/change-stack/NVIDIA/cudf/pull/25394?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change.svg" alt="Explain Change →" height="32"></picture></a>

    <!-- review_stack_entry_end -->
    <!-- recent_review_status_start -->

    No actionable comments were generated in the recent review.

    <!-- recent_review_status_end -->
    <!-- walkthrough_start -->

    <details>
    <summary><strong>Summary</strong></summary>
    <dl>
    <dd>
    <br>

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    Summary by CodeRabbit

    New Features
    Added SHA-224, SHA-256, SHA-384, and SHA-512 hashing, along with seeded XXHash and MurmurHash options.
    Added support for hashing multiple columns and for Trino- and Spark-compatible hash variants.
    Bug Fixes
    Hash operations now set the active device before processing columns.
    Hashing requires at least one column; invalid inputs are rejected.

    <!-- end of auto-generated comment: release notes by coderabbit.ai -->
    ColumnVector adds Java entry points for SHA-224/256/384/512, MurmurHash variants, and xxHash variants. JNI implements these hash calls and selects the active device. Tests check expected outputs, seeds, null rows, multiple columns, and byte-list inputs.

    Changes: Java hash bindings

    |Layer / File(s)|Summary|
    |:---|:---|
    |Hash API and shared input handling <br> java/src/main/java/ai/rapids/cudf/ColumnVector.java|A shared helper validates hash inputs and collects native views. New Java entry points and native declarations cover SHA-224/256/384/512, MurmurHash variants, and xxHash variants. MD5 retains its type assertions, and SHA-1 uses the shared helper.|
    |JNI hash implementations <br> java/src/main/native/src/ColumnVectorJni.cpp|JNI adds implementations for the new hash methods. The MD5 and SHA-1 methods also select the active device before accessing column views.|
    |Hash output and input tests <br> java/src/test/java/ai/rapids/cudf/ColumnVectorTest.java|Tests check expected hashes for strings, seeded variants, multiple columns, and Trino-compatible VARCHAR and VARBINARY inputs. They also check null rows and the empty-input exception for seeded XXHash64.|

    <!-- change_assessment_start -->
    Estimated code review effort: 3 (Moderate) | ~25 minutes

    <!-- change_assessment_commit:"1a91873c8e3b8eeca9aebe3e7920817f114ad099" -->
    <!-- change_assessment_priority:{"version":1,"urgency":"p2","manual":false} -->
    Change: Feature
    <!-- change_assessment_end -->

    Possibly related issues

  • NVIDIA/cudf issue 25314: The PR adds the Java xxHash64 binding requested by the issue. The available summaries do not establish that all proposed input types and null-handling requirements are covered.
  • Suggested reviewers: rishic3, ttnghia

    </dd>
    </dl>
    </details>

    <!-- walkthrough_end -->
    <details>
    <summary><strong>Merge Risk:</strong> <strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/risk-unassessed-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Minimal</strong> · up to <code>1a918</code></summary>
    <dl>
    <dd>
    <br>

    <!-- final_review_risk_start -->
    <!-- final_review_risk_label
    Merge Risk: ⚪ Minimal · up to 1a918
    -->
    <!-- final_review_risk_coverage:{"sourceCommitId":"1a91873c8e3b8eeca9aebe3e7920817f114ad099","coveredCommitId":"1a91873c8e3b8eeca9aebe3e7920817f114ad099","kind":"reviewed"} -->

    This change adds Java bindings for the SHA-2, MurmurHash and xxHash functions already present in libcudf, and moves MD5 and SHA-1 onto shared input checks. No concrete defect was found, and the added tests cover the main input and seed cases. Merge-readiness risk is minimal, subject to the normal CI GPU test run.
    <!-- final_review_risk_end -->

    </dd>
    </dl>
    </details>

    <details>
    <summary><strong>Security architecture risk:</strong> <strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/risk-unassessed-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Minimal</strong> · up to <code>1a918</code></summary>
    <dl>
    <dd>
    <br>

    <!-- architecture_review_start -->
    <!-- architecture_review_label

    Security Architecture Review

    Security architecture risk: ⚪ Minimal · up to 1a918
    -->

    The added hashing APIs follow the existing Java-to-native execution and resource-ownership model. The inspected changes do not establish a material weakening of security, failure containment, or ownership guarantees.

    Retained concerns
    No architecture-level concerns identified.

    <details>
    <summary><strong>Security review details</strong></summary>
    <dl>
    <dd>
    <br>

    Security Blast Radius

  • _inferred_ — The inspected expansion lets existing in-process callers send column data and seeds to more native hash implementations. Its direct exposure remains the caller's process and GPU resources; these bindings introduce no credential, network destination or tenant-selection input.
  • Trust Boundaries and Controls

  • _observed_ — Java's non-null and equal-row checks use assertions, but native handle conversion checks null pointers and native table construction rejects unequal column sizes before hashing. These controls do not establish validity of arbitrary nonzero native addresses.

  • _observed_ — The new methods retain the existing borrowed-view lifecycle requirement: callers must keep input columns alive and unmodified while native views are used. They do not add input ownership transfer or protection against concurrent closure.
  • Resilience and Maintainability Implications

  • _observed_ — MurmurHash128 uses the existing table-transfer path. Native columns remain uniquely owned during Java handle-array allocation and access. Java pointer conversion attempts cleanup of constructed columns and remaining handles on failure, while Table construction closes converted columns if subsequent view creation fails. Successful results are caller-owned and closeable.
  • </dd>
    </dl>
    </details>
    <!-- architecture_review_end -->

    </dd>
    </dl>
    </details>
    <!-- pre_merge_checks_walkthrough_start -->

    <details>
    <summary><strong>Pre-merge checks: <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v2.svg" width="14" height="14" align="middle" alt="Passed" title="Passed"></picture></sup> 4</strong></summary>
    <dl>
    <dd>
    <br>

    | Check name | Status | Explanation |
    | :------------------------ | :--------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | Title check | !Passed | The title states the main change: adding Java ColumnVector bindings for the remaining libcudf hash functions. The raw summary confirms the SHA-224/256/384/512, MurmurHash, and xxHash bindings and thei… |
    | Description check | !Passed | The description states that cuDF Java exposed only md5Hash and sha1Hash and lists the new ColumnVector bindings (SHA-2 variants, MurmurHash3 variants, xxhash32/64). This matches the raw summary of the… |
    | Linked Issues check | !Passed | Check skipped because no linked issues were found for this pull request. |
    | Out of Scope Changes check | !Passed | Check skipped because no linked issues were found for this pull request. |

    <details>
    <summary><strong>Full details: Title check</strong></summary>
    <dl>
    <dd>
    <br>

    Explanation

    The title states the main change: adding Java ColumnVector bindings for the remaining libcudf hash functions. The raw summary confirms the SHA-224/256/384/512, MurmurHash, and xxHash bindings and their JNI methods. The title is specific and concise.

    </dd>
    </dl>
    </details>

    <details>
    <summary><strong>Full details: Description check</strong></summary>
    <dl>
    <dd>
    <br>

    Explanation

    The description states that cuDF Java exposed only md5Hash and sha1Hash and lists the new ColumnVector bindings (SHA-2 variants, MurmurHash3 variants, xxhash32/64). This matches the raw summary of the ColumnVector, JNI, and test changes. It also explains the seed handling and the xxHash64 verification approach.

    </dd>
    </dl>
    </details>

    </dd>
    </dl>
    </details>

    <!-- pre_merge_checks_walkthrough_end -->
    <!-- finishing_touch_checkbox_start -->

    <details>
    <summary><strong>Finishing Touches</strong></summary>
    <dl>
    <dd>
    <br>

    <details open>
    <summary><strong>Generate unit tests (beta)</strong></summary>
    <dl>
    <dd>
    <br>

  • <!-- {"checkboxId": "f47ac10b-58cc-4372-a567-0e02b2c3d479", "radioGroupId": "utg-output-choice-group-unknown_comment_id"} --> Create a new PR
  • </dd>
    </dl>
    </details>

    </dd>
    </dl>
    </details>

    <!-- finishing_touch_checkbox_end -->

    <!-- autopilot:start -->

  • <!-- {"checkboxId":"2708ad07-9f24-4260-9c11-7dc76a49f2e3"} --> <strong title="Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts">Autofix</strong> · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

  • <!-- autopilot:end -->
    <!-- recent_review_start -->

    <h6>
    <details>
    <summary><strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/info.svg" width="12" height="12" align="absmiddle" alt=""></picture> Recent review info</strong></summary>
    <dl>
    <dd>
    <br>

    <!-- review_info_content -->
    <details>
    <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog.svg" width="16" height="16" align="absmiddle" alt=""></picture> Run configuration</strong></summary>
    <dl>
    <dd>
    <br>

  • Source mode: Auto

  • Repository: [NVIDIA/cudf](<https://github.com/NVIDIA/cudf>)

  • Branch: [main](<https://github.com/NVIDIA/cudf/tree/main>)

  • File: [.coderabbit.yaml](<https://github.com/NVIDIA/cudf/blob/a8434b630df6c73f2caf4c5166c72b4072ee5583/.coderabbit.yaml>)

  • Commit: [a8434b6](<https://github.com/NVIDIA/cudf/commit/a8434b630df6c73f2caf4c5166c72b4072ee5583>)

  • Layers: Repository YAML

  • Review profile: CHILL

  • Plan: Enterprise

  • Run ID: 69addc5d-089d-437e-8699-84a84d734d53
  • </dd>
    </dl>
    </details>

    <details>
    <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal.svg" width="16" height="16" align="absmiddle" alt=""></picture> Commits</strong></summary>
    <dl>
    <dd>
    <br>

    Reviewing files that changed from the base of the PR and between a8434b630df6c73f2caf4c5166c72b4072ee5583 and 1a91873c8e3b8eeca9aebe3e7920817f114ad099.

    </dd>
    </dl>
    </details>

    <details>
    <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner.svg" width="16" height="16" align="absmiddle" alt=""></picture> Files selected for processing: 3</strong></summary>
    <dl>
    <dd>
    <br>

    java/src/main/java/ai/rapids/cudf/ColumnVector.java
    java/src/main/native/src/ColumnVectorJni.cpp

  • java/src/test/java/ai/rapids/cudf/ColumnVectorTest.java
  • </dd>
    </dl>
    </details>

    Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

    </dd>
    </dl>
    </details>
    </h6>

    <!-- recent_review_end -->

    findepi findepi commented on code on Nov 19, 2026 08:42 UTC
    Code Review
    java/src/main/java/ai/rapids/cudf/ColumnVector.java:1
    @@ -777,16 +783,105 @@ public static ColumnVector md5Hash(ColumnView... columns) {
        * @return the new ColumnVector of 40 character hex strings representing each row's hash value.
        */
       public static ColumnVector sha1Hash(ColumnView... columns) {
    -    if (columns.length < 1) {
    -      throw new IllegalArgumentException("Sha1 hashing requires at least 1 column of input");
    -    }
    -    long[] columnViews = new long[columns.length];
    +    return new ColumnVector(sha1(getNativeViews("Sha1", columns)));
    +  }
     
    -    for(int i = 0; i < columns.length; i++) {
    -      assert columns[i] != null : "Column vectors passed may not be null";
    -      columnViews[i] = columns[i].getNativeView();
    -    }
    -    return new ColumnVector(sha1(columnViews));
    +  /**
    +   * Create a new column containing the SHA-224 hash of each row in the table.
    +   *
    +   * @param columns columns to hash
    +   * @return the new ColumnVector of 56 character hex strings representing each row's hash value.
    +   */
    +  public static ColumnVector sha224Hash(ColumnView... columns) {
    +    return new ColumnVector(sha224(getNativeViews("SHA-224", columns)));
    +  }
    +
    +  /**
    +   * Create a new column containing the SHA-256 hash of each row in the table.
    +   *
    +   * @param columns columns to hash
    +   * @return the new ColumnVector of 64 character hex strings representing each row's hash value.
    +   */
    +  public static ColumnVector sha256Hash(ColumnView... columns) {
    +    return new ColumnVector(sha256(getNativeViews("SHA-256", columns)));
    +  }
    +
    +  /**
    +   * Create a new column containing the SHA-384 hash of each row in the table.
    +   *
    +   * @param columns columns to hash
    +   * @return the new ColumnVector of 96 character hex strings representing each row's hash value.
    +   */
    +  public static ColumnVector sha384Hash(ColumnView... columns) {
    +    return new ColumnVector(sha384(getNativeViews("SHA-384", columns)));
    +  }
    +
    +  /**
    +   * Create a new column containing the SHA-512 hash of each row in the table.
    +   *
    +   * @param columns columns to hash
    +   * @return the new ColumnVector of 128 character hex strings representing each row's hash value.
    +   */
    +  public static ColumnVector sha512Hash(ColumnView... columns) {
    +    return new ColumnVector(sha512(getNativeViews("SHA-512", columns)));
    +  }
    +
    +  /**
    +   * Create a new column containing the MurmurHash3_x86_32 hash of each row in the table.
    +   *
    +   * @param seed the hash seed; its bits are used as an unsigned 32-bit value.
    +   * @param columns columns to hash
    +   * @return the new UINT32 ColumnVector of hash values.
    +   */
    +  public static ColumnVector murmurHash3x86_32(int seed, ColumnView... columns) {
    +    return new ColumnVector(murmurHash32(seed, getNativeViews("MurmurHash3_x86_32", columns)));
    +  }
    +
    +  /**
    +   * Create a new column containing the Apache Spark-compatible MurmurHash3_x86_32 hash of each row
    +   * in the table.
    +   *
    +   * @param seed the initial hash seed; its bits are used as an unsigned 32-bit value. Spark's
    +   *             SQL {@code hash()} uses 42.
    +   * @param columns columns to hash
    +   * @return the new INT32 ColumnVector of hash values.
    +   */
    +  public static ColumnVector sparkMurmurHash3x86_32(int seed, ColumnView... columns) {

    IMO the library API should be engine agnostic. The reader wanting to use this function should not have to look up what spark murmur is. Also, if future Spark version changes their hash or combine functions, the semantics of this method cannot silently change.

    Can you name and document the API in engine agnostic terms? This can be supplemented with "This is the same algorithm that Spark v X.Y.Z's .... does."

    findepi findepi commented on code on Nov 19, 2026 08:44 UTC
    Code Review
    java/src/main/java/ai/rapids/cudf/ColumnVector.java:1
    @@ -745,27 +745,33 @@ public static ColumnVector listConcatenateByRow(boolean ignoreNull, ColumnView..
         return new ColumnVector(concatListByRow(columnViews, ignoreNull));
       }
     
    +  private static long[] getNativeViews(String hashName, ColumnView... columns) {
    +    if (columns.length < 1) {
    +      throw new IllegalArgumentException(hashName + " hashing requires at least 1 column of input");
    +    }

    If this check didn't exist, what would sha1Hash(new ColumnView[0]) return?

    findepi findepi commented on code on Nov 19, 2026 08:49 UTC
    Code Review
    java/src/main/java/ai/rapids/cudf/ColumnVector.java:1
    @@ -777,16 +783,105 @@ public static ColumnVector md5Hash(ColumnView... columns) {
        * @return the new ColumnVector of 40 character hex strings representing each row's hash value.
        */
       public static ColumnVector sha1Hash(ColumnView... columns) {
    -    if (columns.length < 1) {
    -      throw new IllegalArgumentException("Sha1 hashing requires at least 1 column of input");
    -    }
    -    long[] columnViews = new long[columns.length];
    +    return new ColumnVector(sha1(getNativeViews("Sha1", columns)));
    +  }
     
    -    for(int i = 0; i < columns.length; i++) {
    -      assert columns[i] != null : "Column vectors passed may not be null";
    -      columnViews[i] = columns[i].getNativeView();
    -    }
    -    return new ColumnVector(sha1(columnViews));
    +  /**
    +   * Create a new column containing the SHA-224 hash of each row in the table.
    +   *
    +   * @param columns columns to hash
    +   * @return the new ColumnVector of 56 character hex strings representing each row's hash value.
    +   */
    +  public static ColumnVector sha224Hash(ColumnView... columns) {
    +    return new ColumnVector(sha224(getNativeViews("SHA-224", columns)));
    +  }
    +
    +  /**
    +   * Create a new column containing the SHA-256 hash of each row in the table.
    +   *
    +   * @param columns columns to hash
    +   * @return the new ColumnVector of 64 character hex strings representing each row's hash value.
    +   */
    +  public static ColumnVector sha256Hash(ColumnView... columns) {

    SHA-256 is well defined over bytes. Table != bytes.
    This function -- and every other hash function -- should define how a row is converted into bytes, including how individual cells are combined. For example: is ["a", "bc"] row converted to same bytes as ["ab","c"]? Or maybe the SHA-256 of each cell is combined with some custom combining function? How are numbers, including floats and decimals, converted to bytes to the purpose of hashing? How are structs and lists?

    These are all questions a user of this API should be able to answer from reading the javadoc, and without reading the code.

    findepi findepi commented on code on Nov 19, 2026 08:51 UTC
    Code Review
    java/src/main/java/ai/rapids/cudf/ColumnVector.java:1
    @@ -777,16 +783,105 @@ public static ColumnVector md5Hash(ColumnView... columns) {
        * @return the new ColumnVector of 40 character hex strings representing each row's hash value.
        */
       public static ColumnVector sha1Hash(ColumnView... columns) {
    -    if (columns.length < 1) {
    -      throw new IllegalArgumentException("Sha1 hashing requires at least 1 column of input");
    -    }
    -    long[] columnViews = new long[columns.length];
    +    return new ColumnVector(sha1(getNativeViews("Sha1", columns)));
    +  }
     
    -    for(int i = 0; i < columns.length; i++) {
    -      assert columns[i] != null : "Column vectors passed may not be null";
    -      columnViews[i] = columns[i].getNativeView();
    -    }
    -    return new ColumnVector(sha1(columnViews));
    +  /**
    +   * Create a new column containing the SHA-224 hash of each row in the table.
    +   *
    +   * @param columns columns to hash
    +   * @return the new ColumnVector of 56 character hex strings representing each row's hash value.
    +   */
    +  public static ColumnVector sha224Hash(ColumnView... columns) {
    +    return new ColumnVector(sha224(getNativeViews("SHA-224", columns)));
    +  }
    +
    +  /**
    +   * Create a new column containing the SHA-256 hash of each row in the table.
    +   *
    +   * @param columns columns to hash
    +   * @return the new ColumnVector of 64 character hex strings representing each row's hash value.
    +   */
    +  public static ColumnVector sha256Hash(ColumnView... columns) {
    +    return new ColumnVector(sha256(getNativeViews("SHA-256", columns)));
    +  }
    +
    +  /**
    +   * Create a new column containing the SHA-384 hash of each row in the table.
    +   *
    +   * @param columns columns to hash
    +   * @return the new ColumnVector of 96 character hex strings representing each row's hash value.
    +   */
    +  public static ColumnVector sha384Hash(ColumnView... columns) {
    +    return new ColumnVector(sha384(getNativeViews("SHA-384", columns)));
    +  }
    +
    +  /**
    +   * Create a new column containing the SHA-512 hash of each row in the table.
    +   *
    +   * @param columns columns to hash
    +   * @return the new ColumnVector of 128 character hex strings representing each row's hash value.
    +   */
    +  public static ColumnVector sha512Hash(ColumnView... columns) {
    +    return new ColumnVector(sha512(getNativeViews("SHA-512", columns)));
    +  }
    +
    +  /**
    +   * Create a new column containing the MurmurHash3_x86_32 hash of each row in the table.
    +   *
    +   * @param seed the hash seed; its bits are used as an unsigned 32-bit value.
    +   * @param columns columns to hash
    +   * @return the new UINT32 ColumnVector of hash values.
    +   */
    +  public static ColumnVector murmurHash3x86_32(int seed, ColumnView... columns) {
    +    return new ColumnVector(murmurHash32(seed, getNativeViews("MurmurHash3_x86_32", columns)));
    +  }
    +
    +  /**
    +   * Create a new column containing the Apache Spark-compatible MurmurHash3_x86_32 hash of each row
    +   * in the table.
    +   *
    +   * @param seed the initial hash seed; its bits are used as an unsigned 32-bit value. Spark's
    +   *             SQL {@code hash()} uses 42.
    +   * @param columns columns to hash
    +   * @return the new INT32 ColumnVector of hash values.
    +   */
    +  public static ColumnVector sparkMurmurHash3x86_32(int seed, ColumnView... columns) {
    +    return new ColumnVector(
    +        sparkMurmurHash32(seed, getNativeViews("Spark MurmurHash3_x86_32", columns)));
    +  }
    +
    +  /**
    +   * Create a new table containing the MurmurHash3_x64_128 hash of each row in the table.
    +   *
    +   * @param seed the hash seed; its bits are used as an unsigned 64-bit value.
    +   * @param columns columns to hash
    +   * @return a new Table of two UINT64 columns holding the two 64-bit halves of each row's hash.
    +   */
    +  public static Table murmurHash3x64_128(long seed, ColumnView... columns) {
    +    return new Table(murmurHash128(seed, getNativeViews("MurmurHash3_x64_128", columns)));
    +  }
    +
    +  /**
    +   * Create a new column containing the xxHash32 hash of each row in the table.
    +   *
    +   * @param seed the hash seed; its bits are used as an unsigned 32-bit value.
    +   * @param columns columns to hash
    +   * @return the new UINT32 ColumnVector of hash values.
    +   */
    +  public static ColumnVector xxhash32(int seed, ColumnView... columns) {
    +    return new ColumnVector(xxHash32(seed, getNativeViews("xxHash32", columns)));
    +  }
    +
    +  /**
    +   * Create a new column containing the xxHash64 hash of each row in the table.
    +   *
    +   * @param seed the hash seed; its bits are used as an unsigned 64-bit value.
    +   * @param columns columns to hash
    +   * @return the new UINT64 ColumnVector of hash values.
    +   */
    +  public static ColumnVector xxhash64(long seed, ColumnView... columns) {

    The javadoc here doesn't fully say how the hash is obtained. For example, the reader doesn't know whether list<uint8> is hashed as series of consecutive bytes (the way https://github.com/NVIDIA/cudf/pull/25357 wanted it), or differently (which I guess is the case).

    findepi findepi commented on Nov 19, 2026 15:25 UTC
    Contributor

    Could you add a test for xxhash64 over a single INT64 column, checked against reference XXH64 values with seed 0 (e.g. 0, -1, Long.MIN_VALUE, Long.MAX_VALUE)? That would pin down that a single fixed-width column hashes to the plain XXH64 of its 8 little-endian bytes.

    findepi findepi commented on code on Nov 19, 2026 15:27 UTC
    Code Review
    java/src/main/java/ai/rapids/cudf/ColumnVector.java:1
    @@ -777,16 +783,105 @@ public static ColumnVector md5Hash(ColumnView... columns) {
        * @return the new ColumnVector of 40 character hex strings representing each row's hash value.
        */
       public static ColumnVector sha1Hash(ColumnView... columns) {
    -    if (columns.length < 1) {
    -      throw new IllegalArgumentException("Sha1 hashing requires at least 1 column of input");
    -    }
    -    long[] columnViews = new long[columns.length];
    +    return new ColumnVector(sha1(getNativeViews("Sha1", columns)));
    +  }
     
    -    for(int i = 0; i < columns.length; i++) {
    -      assert columns[i] != null : "Column vectors passed may not be null";
    -      columnViews[i] = columns[i].getNativeView();
    -    }
    -    return new ColumnVector(sha1(columnViews));
    +  /**
    +   * Create a new column containing the SHA-224 hash of each row in the table.
    +   *
    +   * @param columns columns to hash
    +   * @return the new ColumnVector of 56 character hex strings representing each row's hash value.
    +   */
    +  public static ColumnVector sha224Hash(ColumnView... columns) {
    +    return new ColumnVector(sha224(getNativeViews("SHA-224", columns)));
    +  }
    +
    +  /**
    +   * Create a new column containing the SHA-256 hash of each row in the table.
    +   *
    +   * @param columns columns to hash
    +   * @return the new ColumnVector of 64 character hex strings representing each row's hash value.
    +   */
    +  public static ColumnVector sha256Hash(ColumnView... columns) {

    Also, the NULL treatment should be documented.

    ttnghia ttnghia commented on code on Nov 27, 2026 03:15 UTC
    Code Review
    java/src/main/java/ai/rapids/cudf/ColumnVector.java:1
    @@ -745,27 +745,33 @@ public static ColumnVector listConcatenateByRow(boolean ignoreNull, ColumnView..
         return new ColumnVector(concatListByRow(columnViews, ignoreNull));
       }
     
    +  private static long[] getNativeViews(String hashName, ColumnView... columns) {
    +    if (columns.length < 1) {
    +      throw new IllegalArgumentException(hashName + " hashing requires at least 1 column of input");

    I don't see why we actually need hashName here. If this throw, we always have the stacktrace in Java.

    Reviewers
    Assignees
    bdice bdice
    Labels
    risk: low confidence: 83.1% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 58.3% (MEDIUM) · Higher = larger blast radius
    58.3%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 83.1% · Lower = rushed or shallow review
    83.1%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 9.8% · Safe to merge
    9.8%
    Repository