mbutrovich commented on code in PR #112:
URL:
https://github.com/apache/datafusion-iceberg/pull/112#discussion_r4606469345
##########
crates/datafusion/src/read/scan.rs:
##########
@@ -150,21 +154,15 @@ impl IcebergDataSourceBuilder {
/// # Errors
///
/// Returns an error if the projection is out of bounds for the schema.
- pub fn build(self) -> Result<IcebergDataSource> {
+ pub fn try_build(self) -> Result<IcebergDataSource> {
Review Comment:
Should we keep the name `build()`? In DataFusion, `try_build` marks the
fallible twin of an infallible method, as in [`PruningPredicateBuilder::build`
and
`try_build`](https://github.com/apache/datafusion/blob/129d7f3ce0d99fde155786c267e6dbb16bb6f71a/datafusion/pruning/src/pruning_predicate.rs#L481-L505).
A builder whose only terminal method can fail calls it `build()` and returns
`Result`. DataFusion has 20 of those, including
[`LogicalPlanBuilder::build`](https://github.com/apache/datafusion/blob/129d7f3ce0d99fde155786c267e6dbb16bb6f71a/datafusion/expr/src/logical_plan/builder.rs#L1711).
iceberg's `TableScanBuilder`, which this file calls [further
down](https://github.com/apache/datafusion-iceberg/blob/61e91b241fc4a3c1c4cc5e90e9523a67531a10ae/crates/datafusion/src/read/scan.rs#L296-L301),
does the same. Since `IcebergDataSourceBuilder` has no infallible `build`, the
`try_` prefix doesn't distinguish it from anything, and it makes this crate's
builder read differently from the Da
taFusion and iceberg builders next to it.
This goes back on @gabotechs's [suggestion on
#67](https://github.com/apache/datafusion-iceberg/pull/67#discussion_r4374617101),
so I'd like to hear his view as well. If we keep `build()`, this PR becomes
the `projection` removal on its own.
--
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]