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

Add ArrowReaderBuilder::schema() #94

Merged
merged 1 commit into from
Jun 19, 2024

Conversation

progval
Copy link
Contributor

@progval progval commented Jun 19, 2024

This allows getting the schema before building a reader; so users can apply transformations to the schema, like this:

let reader_builder = reader_builder
    .with_projection(projection.clone())
    .with_batch_size(ORC_BATCH_SIZE);

let schema = transform_schema(&reader_builder.schema());

let reader = reader_builder.with_schema(schema).build();

where transform_schema could, for example, be a function that changes the TimeUnit of Timestamp datatypes.

This allows getting the schema before building a reader; so users can
apply transformations to the schema, like this:

```
let reader_builder = reader_builder
    .with_projection(projection.clone())
    .with_batch_size(ORC_BATCH_SIZE);

let schema = transform_schema(&reader_builder.schema());

let reader = reader_builder.with_schema(schema).build();
```

where `transform_schema` could, for example, be a function that changes
the `TimeUnit` of `Timestamp` datatypes.
Copy link
Collaborator

@WenyXu WenyXu left a comment

Choose a reason for hiding this comment

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

Thanks!

@WenyXu WenyXu merged commit 16b5704 into datafusion-contrib:main Jun 19, 2024
9 checks passed
@progval progval deleted the builder-schema branch June 19, 2024 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants