NoahKusaba opened a new pull request, #63:
URL: https://github.com/apache/datafusion-iceberg/pull/63

   ## Which issue does this PR close?
   
   - Follows up on 
https://github.com/apache/datafusion-iceberg/pull/20#discussion_r4203549998 and 
https://github.com/apache/datafusion-iceberg/pull/20#discussion_r4203509539.
   
   ## Rationale for this change
   
   #20 made `IcebergDataSource::new_with_predicate` public so that a codec can 
rebuild a scan from its accessors. It takes every part of the scan as a 
positional argument. A scan option added later would mean adding an argument, 
which is a breaking change. A builder lets new options be added without 
breaking callers.
   
   ## What changes are included in this PR?
   
   - Replaces `IcebergDataSource::new_with_predicate` with 
`IcebergDataSource::builder(table, schema)`. The builder has 
`with_snapshot_id`, `with_predicates` and `with_fetch`, and is exported from 
`datafusion_iceberg::read` as `IcebergDataSourceBuilder`. The optional setters 
take an `Option`, as DataFusion's builders do, so a codec can pass the 
accessors' values straight through:
   
     ```rust
     IcebergDataSource::builder(scan.table().clone(), scan.schema())
         .with_snapshot_id(scan.snapshot_id())
         .with_predicates(scan.predicates().cloned())
         .with_fetch(scan.fetch())
         .build()
     ```
   
   - Renames the fallible crate-internal constructor `IcebergDataSource::new` 
to `try_new`, and documents its error.
   
   ## Are there any user-facing changes?
   
   Yes. `IcebergDataSource::new_with_predicate` is removed in favor of the 
builder. It was added in #20 and isn't in any release.
   
   ## Are these changes tested?
   
   Yes. The integration tests that rebuild a scan from its accessors now use 
the builder, including the scan built over part of the table's columns.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to