Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!(ffi): Make get_partition_column* work on a snapshot. #697

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

nicklan
Copy link
Collaborator

@nicklan nicklan commented Feb 13, 2025

What changes are proposed in this pull request?

Make get_partition_column_count and get_partition_columns take a snapshot so engines can work this out at planning time without creating a scan.

The previous methods to get this info out of a scan have been removed.

Yes, the old functions have had _scan_ added to the name, so this is a breaking change. (but I don't know of anyone who was using the old ones other than read_table.c.

How was this change tested?

New unit test

Also rename the old ones to get_scan_partition_column*
@github-actions github-actions bot added the breaking-change Change that will require a version bump label Feb 13, 2025
Copy link

codecov bot commented Feb 13, 2025

Codecov Report

Attention: Patch coverage is 95.16129% with 3 lines in your changes missing coverage. Please review.

Project coverage is 84.42%. Comparing base (72b585d) to head (974b6ea).

Files with missing lines Patch % Lines
ffi/src/lib.rs 93.87% 0 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #697      +/-   ##
==========================================
+ Coverage   84.19%   84.42%   +0.22%     
==========================================
  Files          77       77              
  Lines       17960    18004      +44     
  Branches    17960    18004      +44     
==========================================
+ Hits        15122    15199      +77     
+ Misses       2121     2087      -34     
- Partials      717      718       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It's anyway a breaking change; should we just delete this redundant API to have one right way of doing things?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Given it's a breaking change, pls make the conventional commit a feat!

/// Get an iterator of the list of partition columns for this snapshot.
///
/// # Safety
/// Caller is responsible for passing a valid snapshot handle.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should the caller also be freeing the strings? Mention it in the docs if it's worth mentioning.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Should the caller also be freeing the strings?

No. String slices by definition are not owned.

In this specific case, the strings will be freed by the iterator itself when it gets dropped.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Given it's a breaking change, pls make the conventional commit a feat!

Copy link
Collaborator

@zachschuermann zachschuermann left a comment

Choose a reason for hiding this comment

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

looks great :) seems similar to my schema changes in #709 - glad we are improving these!

pub enum TestAction {
Add(String),
Remove(String),
Metadata,
}

/// Convert a vector of actions into a newline delimited json string
// TODO: We need a better way to mock tables :)
Copy link
Collaborator

Choose a reason for hiding this comment

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

agree - should we track an issue and try to size/prioritize it?

@zachschuermann zachschuermann changed the title feat: Make get_partition_column* work on a snapshot. feat!: Make get_partition_column* work on a snapshot. Feb 21, 2025
@zachschuermann zachschuermann changed the title feat!: Make get_partition_column* work on a snapshot. feat!(ffi): Make get_partition_column* work on a snapshot. Feb 21, 2025
Copy link
Collaborator

@scovich scovich left a comment

Choose a reason for hiding this comment

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

LGTM, but make sure to update the PR description -- it still claims the old code was renamed instead of deleted.

/// Get an iterator of the list of partition columns for this snapshot.
///
/// # Safety
/// Caller is responsible for passing a valid snapshot handle.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should the caller also be freeing the strings?

No. String slices by definition are not owned.

In this specific case, the strings will be freed by the iterator itself when it gets dropped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change Change that will require a version bump
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants