Skip to content

[Feature] Export the pinned table's write Arrow schema through the C API #1328

Description

@suxiaogang223

Search before asking

  • I searched the issues and pull requests for a matching schema-export API.

Motivation

A C/C++ caller must construct Arrow batches matching the Paimon table's write
schema. The C API can create a table from resolved schema JSON but does not
expose its corresponding Arrow schema. Reimplementing the type mapping in
each caller can diverge from the Rust writer's validation; querying a catalog
again can also select a different table schema.

Solution

Add an additive C function:

paimon_error *paimon_table_export_arrow_schema(
    const paimon_table *table, void *schema);

schema points to an initialized empty ArrowSchema. Reuse the core write
schema conversion and the Arrow C Data Interface, borrowing the table and
giving the output an independent release callback. Do not refresh catalog
metadata or change the core type rules. Reject null pointers and a live output
instead of overwriting it.

Anything else?

Cover type/order/nullability/field-ID mapping, a real write using the exported
schema, table/output lifetimes, release and reuse, and invalid pointers. This
proposal was prepared with AI assistance; it does not add another type mapping.

Willingness to contribute

  • I'm willing to submit a PR!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions