[#10983] feat(lance): Upgrade lance to 4.0.1 and lance-namespace to 0.7.5#11060
[#10983] feat(lance): Upgrade lance to 4.0.1 and lance-namespace to 0.7.5#11060yuqi1129 wants to merge 12 commits into
Conversation
- Bump lance-core from 2.0.1 to 4.0.1 in gradle/libs.versions.toml - Bump lance-namespace-core from 0.4.5 to 0.7.5 in gradle/libs.versions.toml API changes addressed: - Transaction -> SourcedTransaction in LancePartitionStatisticStorage (Transaction.commit() removed; newTransactionBuilder() now returns SourcedTransaction.Builder) - CreateEmptyTableRequest/Response -> DeclareTableRequest/Response (createEmptyTable() removed from LanceNamespace interface) - TableApi.createTable() gains two new String params (properties, storageOptions); pass null for both since Gravitino reads from headers - AlterColumnsEntry.rename is now JsonNullable<String>; register JsonNullableModule via new JsonNullableMapperProvider for correct Jackson serialization in the lance-rest-server Testability fix: - Introduce DatasetHolder wrapper in LancePartitionStatisticStorage so that the cached Dataset is mockable in tests; lance 4.0.1 Dataset has many JNI native methods that prevent Mockito's inline mock maker from instrumenting the class directly Closes apache#10983 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR upgrades the Lance/Lance-namespace dependencies and updates Gravitino’s Lance integration to accommodate upstream API changes (declare table APIs, transaction builder type change, OpenAPI JsonNullable handling), including test adjustments to keep the suite stable with Lance 4.x’s JNI-heavy classes.
Changes:
- Bumped
lance-coreto 4.0.1 andlance-namespace-coreto 0.7.5 and migrated call sites (e.g.,declareTable, updatedTableApi.createTablesignature). - Added a JAX-RS
@Providerto registerJsonNullableModulefor correct (de)serialization ofJsonNullable<T>fields in lance-namespace models. - Refactored
LancePartitionStatisticStoragedataset caching to wrapDatasetin a mockable holder and updated related tests.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| lance/lance-rest-server/src/test/java/org/apache/gravitino/lance/service/rest/TestLanceNamespaceOperations.java | Updates REST tests for declare/create-empty changes and registers JsonNullableModule in the test ObjectMapper. |
| lance/lance-rest-server/src/test/java/org/apache/gravitino/lance/integration/test/LanceRESTServiceIT.java | Migrates integration tests from createEmptyTable to declareTable and updates TableApi.createTable call signature. |
| lance/lance-rest-server/src/main/java/org/apache/gravitino/lance/service/rest/LanceTableOperations.java | Updates create-empty endpoint to return the new response type (DeclareTableResponse). |
| lance/lance-rest-server/src/main/java/org/apache/gravitino/lance/service/rest/JsonNullableMapperProvider.java | Adds a Jersey ContextResolver<ObjectMapper> registering JsonNullableModule. |
| lance/lance-common/src/main/java/org/apache/gravitino/lance/common/ops/LanceTableOperations.java | Updates the deprecated createEmptyTable return type to align with the new model classes. |
| lance/lance-common/src/main/java/org/apache/gravitino/lance/common/ops/gravitino/GravitinoLanceTableOperations.java | Adapts the Gravitino-backed implementation to return DeclareTableResponse for the deprecated path. |
| gradle/libs.versions.toml | Bumps Lance dependency versions. |
| core/src/test/java/org/apache/gravitino/stats/storage/TestLancePartitionStatisticStorage.java | Adjusts tests to mock a dataset holder rather than Dataset directly. |
| core/src/main/java/org/apache/gravitino/stats/storage/LancePartitionStatisticStorage.java | Switches to caching a DatasetHolder, updates transaction builder usage, and adds safe closing behavior. |
- Transaction -> SourcedTransaction (variable type) - writeParams(Map) -> transactionProperties(Map) on SourcedTransaction.Builder - dataset.commitTransaction(trans) -> trans.commit() Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Code Coverage Report
Files
|
|
@FANNG1 |
|
Thanks for adding the matrix runners and documenting how to re-verify the Lance compatibility ranges. I think the CI strategy here needs to be called out explicitly before we merge this. My concern is that the full compatibility matrix should probably not become part of the default PR validation path. These tests are expensive, depend on external package ecosystems, and can become noisy when PyPI / Maven resolution changes upstream. That makes them a poor fit for the main per-PR signal. What seems more sustainable is a two-layer approach:
That would still keep the matrix exercised continuously enough to avoid script rot, but without making every PR pay the cost or absorb upstream ecosystem flakiness. If we go this direction, I also think the matrix runner should avoid floating dependencies by default (for example, not resolving Can we align on that execution model in this PR? Right now the tasks and docs are being added, but the intended automation boundary is still unclear. |
|
Thanks for your reply. By default, we will only run one version of |
What changes were proposed in this pull request?
Upgrades the Lance dependencies:
lance-core:2.0.1→4.0.1lance-namespace-core:0.4.5→0.7.5API-breaking changes addressed:
Transaction→SourcedTransactioninLancePartitionStatisticStorage:Dataset.newTransactionBuilder()now returnsSourcedTransaction.Builderinstead ofTransaction.Builder.CreateEmptyTableRequest/Response→DeclareTableRequest/Response:createEmptyTable()was removed from theLanceNamespaceinterface; all usages migrated todeclareTable().TableApi.createTable()signature: Two new optional parameters (properties,storageOptions) added; passnullfor both since Gravitino reads from HTTP headers.AlterColumnsEntry.renameis nowJsonNullable<String>: Added a JAX-RS@Provider(JsonNullableMapperProvider) that registersJsonNullableModulewith theObjectMapperused by the lance-rest-server.Testability fix:
DatasetHolderwrapper class inLancePartitionStatisticStorageso the Caffeine cache holdsDatasetHolderinstead ofDatasetdirectly. lance 4.0.1'sDatasethas many JNI native methods that prevent Mockito's inline mock-maker from instrumenting it.Why are the changes needed?
lance 4.0.1 and lance-namespace 0.7.5 are the latest stable releases. Keeping dependencies up to date ensures we receive bug fixes, performance improvements, and security patches.
Fix: #10983
Does this PR introduce any user-facing change?
No. The REST API contract is unchanged. The internal migration from
createEmptyTabletodeclareTableis transparent to users.How was this patch tested?
All unit tests in
:core:test,:lance:lance-common:test, and:lance:lance-rest-server:testpass (including the previously failingtestCloseReleasesCachedDatasetBeforeAllocatorandtestAlterColumns).