[FEA] Add Java bindings for AST JIT operations#23117
Conversation
Signed-off-by: Haoyang Li <haoyangl@nvidia.com>
Signed-off-by: Haoyang Li <haoyangl@nvidia.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThis PR adds Java and JNI support for libcudf JIT AST execution, including runtime initialization, JIT operators and expressions, decimal literal serialization, native compilation and execution paths, and comprehensive validation and execution tests. ChangesJIT AST Execution
Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related issues
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai full review |
✅ Action performedFull review finished. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
java/src/main/java/ai/rapids/cudf/ast/Literal.java (1)
130-132: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUnverified doc claim: legacy
computeColumnsupport for DECIMAL32/64 literals.The javadoc states only
DECIMAL128literals requirecomputeColumnJit, implyingDECIMAL32/DECIMAL64decimal literals work with legacycomputeColumn. No test inCompiledExpressionTestexercises a decimal literal viacomputeColumn(alltestJitDecimalLiteralTransformcases usecomputeColumnJit), so this claim is currently untested here.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@java/src/main/java/ai/rapids/cudf/ast/Literal.java` around lines 130 - 132, The javadoc in Literal is making an unverified claim about decimal literal support with computeColumn versus computeColumnJit. Update the documentation to match the actual behavior for DECIMAL32/DECIMAL64/DECIMAL128 literals, and add or adjust coverage in CompiledExpressionTest (for example around testJitDecimalLiteralTransform and computeColumn) so the supported execution path is explicitly verified.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@java/src/main/java/ai/rapids/cudf/ast/Literal.java`:
- Around line 130-132: The javadoc in Literal is making an unverified claim
about decimal literal support with computeColumn versus computeColumnJit. Update
the documentation to match the actual behavior for
DECIMAL32/DECIMAL64/DECIMAL128 literals, and add or adjust coverage in
CompiledExpressionTest (for example around testJitDecimalLiteralTransform and
computeColumn) so the supported execution path is explicitly verified.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 61abb19d-7bb0-44a3-991b-d21254a99a70
📒 Files selected for processing (11)
java/src/main/java/ai/rapids/cudf/Cudf.javajava/src/main/java/ai/rapids/cudf/ast/AstExpression.javajava/src/main/java/ai/rapids/cudf/ast/CompiledExpression.javajava/src/main/java/ai/rapids/cudf/ast/JitErrorPolicy.javajava/src/main/java/ai/rapids/cudf/ast/JitOperation.javajava/src/main/java/ai/rapids/cudf/ast/JitOperator.javajava/src/main/java/ai/rapids/cudf/ast/Literal.javajava/src/main/native/src/CompiledExpression.cppjava/src/main/native/src/CudfJni.cppjava/src/main/native/src/jni_compiled_expr.hppjava/src/test/java/ai/rapids/cudf/ast/CompiledExpressionTest.java
…indings-main-upmerge
Signed-off-by: Haoyang Li <haoyangl@nvidia.com>
Signed-off-by: Haoyang Li <haoyangl@nvidia.com>
lamarrr
left a comment
There was a problem hiding this comment.
The C++ changes look good to me.
I took a look at the Java changes too, but I believe we'll need more eyes on it.
| auto const op_info = jni_to_jit_operator(jni_ast.read_byte()); | ||
| auto const error_policy = jni_to_jit_error_policy(jni_ast.read_byte()); | ||
| auto const arity = static_cast<int32_t>(jni_ast.read_byte()); | ||
| if (arity < 0) { throw std::invalid_argument("unexpected JNI AST JIT operator arity"); } |
There was a problem hiding this comment.
i think checking the arity comparison below is sufficient
|
/ok to test 30cceaf |
Description
Adds cuDF Java/JNI bindings for the libcudf AST JIT operations introduced by #22602.
Why
cudf-spark needs to lower fused ANSI and TRY expressions to libcudf row IR while preserving row-level overflow and error semantics. JIT-only AST operations also need an explicit Java execution path: routing them through the existing
CompiledExpression.computeColumnmakes execution depend on the process-levelLIBCUDF_JIT_ENABLEDbackend selection.What changed
JitOperation,JitOperator, andJitErrorPolicy, with Java and JNI validation for operator arity, error-policy use, and decimal target scales.CompiledExpression.computeColumnJit(Table)to callcudf::compute_column_jitdirectly.Cudf.initializeJitRuntime()as an idempotent JIT runtime and cache preflight. It does not change the backend selected bycomputeColumn.DECIMAL32,DECIMAL64, andDECIMAL128, including null and range validation.PROPAGATE/NULLIFY, shifts, casts, decimal precision and rescaling, conditionals, and nested legacy/JIT expression trees.API impact
This adds the public
JitOperation,JitOperator, andJitErrorPolicytypes,CompiledExpression.computeColumnJit(Table),Cudf.initializeJitRuntime(), andLiteral.ofDecimal(DType, BigInteger). Existing APIs remain source-compatible, andCompiledExpression.computeColumnretains its current backend-selection behavior. Expressions containingJitOperationmust be evaluated withcomputeColumnJitunless the process-level JIT backend is enabled.Validation
CompiledExpressionTestcases pass on a local GPU against matching locally built shared libcudf and JNI libraries withLIBCUDF_JIT_ENABLED=0.sql-plugincompile passes against the resulting JNI jar.Checklist