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): expose metadata in SchemaEngineVisitor ffi api #659

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

Conversation

kssenii
Copy link
Contributor

@kssenii kssenii commented Jan 23, 2025

  • new feature PR: "Expose metadata in SchemaEngineVisitor ffi api"

What changes are proposed in this pull request?

This PR affects the following public APIs

A new argument "metadata" was added to EngineSchemaVisitor visitor functions.

How was this change tested?

examples/read_table was updated to test the change.

Copy link

codecov bot commented Jan 23, 2025

Codecov Report

Attention: Patch coverage is 0% with 23 lines in your changes missing coverage. Please review.

Project coverage is 83.82%. Comparing base (d999b5c) to head (7ff0f01).

Files with missing lines Patch % Lines
ffi/src/schema.rs 0.00% 20 Missing ⚠️
ffi/src/scan.rs 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #659      +/-   ##
==========================================
- Coverage   83.92%   83.82%   -0.10%     
==========================================
  Files          75       75              
  Lines       17277    17297      +20     
  Branches    17277    17297      +20     
==========================================
  Hits        14500    14500              
- Misses       2078     2098      +20     
  Partials      699      699              

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

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.

looking good, left a couple comments!

ffi/src/scan.rs Outdated Show resolved Hide resolved
ffi/examples/read-table/schema.h Outdated Show resolved Hide resolved
@zachschuermann
Copy link
Collaborator

also looks like builds are red due to unused arg:

/Users/runner/work/delta-kernel-rs/delta-kernel-rs/ffi/examples/read-table/schema.h:88:33: error: unused parameter 'name' [-Werror,-Wunused-parameter]
void print_metadata(const char *name, const CStringMap* metadata)

@zachschuermann
Copy link
Collaborator

Oh I think due to the preprocessing? might need to IFDEF in such at way that it doesn't yell about unused vars..

@kssenii
Copy link
Contributor Author

kssenii commented Jan 23, 2025

also looks like builds are red due to unused arg:

fixed in the last commit

@scovich scovich added the breaking-change Change that will require a version bump label Jan 23, 2025
@scovich scovich changed the title feat(ffi): expose metadata in SchemaEngineVisitor ffi api feat!(ffi): expose metadata in SchemaEngineVisitor ffi api Jan 23, 2025
void print_physical_name(const char *name, const CStringMap* metadata)
{
#ifdef VERBOSE
char* key_str = "delta.columnMapping.physicalName";
Copy link
Collaborator

Choose a reason for hiding this comment

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

NOTE: This is an internal Delta column that should not actually be user-visible, see #583. That needs to be fixed in kernel proper (not here in the FFI layer), but when it does get fixed this example will stop working.

) -> usize {
let child_list_id = (visitor.make_field_list)(visitor.data, 1);
visit_schema_item(
"array_element",
&at.element_type,
contains_null,
metadata,
Copy link
Collaborator

Choose a reason for hiding this comment

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

This looks wrong. We're passing field metadata for the array itself to the visitor for its element type -- even tho the call macro already passed it to the visit_array callback. I'm pretty sure we need to pass an empty map here, because these internal fields don't have metadata associated with them

(same for map key/value visitors below)

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.

3 participants