Skip to content

feat(java): support list versions and checkout version in Dataset#3945

Merged
jackye1995 merged 3 commits intolance-format:mainfrom
majin1102:verson
Jun 6, 2025
Merged

feat(java): support list versions and checkout version in Dataset#3945
jackye1995 merged 3 commits intolance-format:mainfrom
majin1102:verson

Conversation

@majin1102
Copy link
Copy Markdown
Contributor

close #3944

@github-actions github-actions Bot added enhancement New feature or request java labels Jun 5, 2025
Comment thread java/core/src/main/java/com/lancedb/lance/Version.java Outdated
Comment thread java/core/src/main/java/com/lancedb/lance/Version.java Outdated
Comment thread java/core/src/main/java/com/lancedb/lance/Dataset.java Outdated
Comment thread java/core/src/main/java/com/lancedb/lance/Dataset.java
throw new IllegalArgumentException("Version must be greater than 0");
}

public Dataset checkout(long version) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change this name? The original name seems fine to me

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have discuessed with @yanghua earlier
There will be

Dataset checkout(String tag)
Dataset checkout(long timestamp) // or dataTime

We both feel overload checkout to both tag and version more elegent and concise

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you really want to go with this, then let's follow the breaking change policy and adjust the PR title and description: https://github.com/lancedb/lance/blob/main/release_process.md#breaking-change-policy

To me, I think we can just go with checkoutVersion, checkoutTag, checkoutTimestamp, but I am not super opinionated about this.

btw, if you plan to use long for timestamp, shouldn't you also use long for private final ZonedDateTime dataTime?

Copy link
Copy Markdown
Contributor Author

@majin1102 majin1102 Jun 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, if you plan to use long for timestamp, shouldn't you also use long for private final ZonedDateTime dataTime?

I'm not quite sure about using timestamp as the parameter. This is only for discussion. I checked rust and python there is no similar api. Using ZonedDateTime is because rust code using DataTime<Utc>

I'm OK with checkoutVersion as well as checkoutTag.

PTAL when you have time

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, then let's just stick with ZonedDateTime then, although it's always UTC so a bit redundant but that's fine I guess.

try (LockManager.ReadLock readLock = lockManager.acquireReadLock()) {
Preconditions.checkArgument(nativeDatasetHandle != 0, "Dataset is closed");

if (this.version() == version) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is wrong with this logic?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic is inconsistency and redundant with rust code here(underlying rust checkout):

image

Copy link
Copy Markdown
Contributor

@jackye1995 jackye1995 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me!

@jackye1995 jackye1995 merged commit 80e07d0 into lance-format:main Jun 6, 2025
8 checks passed
@majin1102 majin1102 deleted the verson branch September 10, 2025 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request java

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement version control api in JAVA

2 participants