feat(java): expose MemWAL shard delete#7688
Conversation
Mirror the Python ShardWriter.delete binding on the Java side. Adds a nativeDelete JNI entry point that streams Arrow key batches into the Rust core's ShardWriter::delete, plus a public delete(ArrowReader) wrapper and an integration test asserting a tombstone masks the deleted base row. All validation and tombstone construction stays in the Rust core; the binding is a thin wrapper mirroring put. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
java/src/test/java/org/lance/memwal/MemWalTest.java (1)
100-114: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider covering delete error paths.
The new Javadoc for
ShardWriter.deletedocuments several error conditions (missing PK column, non-nullable non-PK column, non-memtable mode), buttestShardWriterDeleteMasksBaseRowonly exercises the success path. Adding a test asserting these error cases would strengthen coverage for the new native call surface.Also applies to: 401-445
🤖 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/test/java/org/lance/memwal/MemWalTest.java` around lines 100 - 114, The delete-path tests only cover the happy case, so add coverage in MemWalTest for the error conditions documented by ShardWriter.delete: missing primary-key column, presence of a non-nullable non-PK column, and calling delete when not in memtable mode. Reuse the existing test setup around testShardWriterDeleteMasksBaseRow and keysRoot, and add focused assertions that the delete invocation fails with the expected errors for each case.
🤖 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/test/java/org/lance/memwal/MemWalTest.java`:
- Around line 100-114: The delete-path tests only cover the happy case, so add
coverage in MemWalTest for the error conditions documented by
ShardWriter.delete: missing primary-key column, presence of a non-nullable
non-PK column, and calling delete when not in memtable mode. Reuse the existing
test setup around testShardWriterDeleteMasksBaseRow and keysRoot, and add
focused assertions that the delete invocation fails with the expected errors for
each case.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 705e75e6-4247-40de-a20e-97c118d6479f
📒 Files selected for processing (3)
java/lance-jni/src/mem_wal.rsjava/src/main/java/org/lance/memwal/ShardWriter.javajava/src/test/java/org/lance/memwal/MemWalTest.java
What
Mirrors the Python
ShardWriter.deletebinding on the Java side, bringing the Java MemWAL bindings to parity with Python. The Rust coreShardWriter::deleteand the Python binding already exist; this wires up the Java surface.java/lance-jni/src/mem_wal.rs—nativeDeleteJNI entry point (inner_delete) that streams Arrow key batches intoShardWriter::delete, mirroringnativePut/inner_put.ShardWriter.java— publicdelete(ArrowReader)wrapper mirroringput, with Javadoc copied from the Rust core (tombstone semantics, nullable-column and primary-key constraints).MemWalTest.java— integration testtestShardWriterDeleteMasksBaseRowasserting a tombstone masks the deleted base row, mirroring the Pythontest_shard_writer_delete_binding_masks_base_row.All validation and tombstone construction stay centralized in the Rust core — the binding is a thin wrapper, per the cross-language binding guidelines.
Testing
cargo clippy --tests --manifest-path ./lance-jni/Cargo.toml— clean./mvnw spotless:check+cargo fmt— clean./mvnw test -Dtest=MemWalTest#testShardWriterDeleteMasksBaseRow—Tests run: 1, Failures: 0🤖 Generated with Claude Code
Summary by CodeRabbit