gabotechs commented on code in PR #138:
URL:
https://github.com/apache/datafusion-iceberg/pull/138#discussion_r4736325781
##########
crates/datafusion/src/write/exec.rs:
##########
@@ -175,6 +179,25 @@ impl ExecutionPlan for IcebergWriteExec {
vec![false]
}
+ /// Without fanout, a partitioned table is written by the clustered
writer, which
+ /// needs each task's rows sorted by `_partition`. An invalid fanout
property
+ /// declares no requirement; `execute` reports it.
+ fn required_input_ordering(&self) -> Vec<Option<OrderingRequirements>> {
+ let metadata = self.table.metadata();
+ let fanout = metadata
+ .table_properties()
+ .write_datafusion_fanout_enabled();
+ let clustered = !metadata.default_partition_spec().is_unpartitioned()
+ && matches!(fanout, Ok(false));
+ let ordering = match col(PROJECTED_PARTITION_VALUE_COLUMN,
&self.input.schema()) {
+ Ok(partition) if clustered => {
+
Some(LexOrdering::from([PhysicalSortExpr::new_default(partition)]).into())
+ }
+ _ => None,
Review Comment:
If `_partition` is missing on a clustered table, the requirement is silently
dropped instead of raising a plan error like `sort_by_partition` did.
`IcebergWriteExec::new` is public, so a caller that skips
`project_with_partition` gets an unsorted plan and a confusing error from the
writer.
##########
AGENTS.md:
##########
@@ -100,13 +100,14 @@ Both providers report every filter as `Inexact`, so
DataFusion re-applies the or
input
→ project_with_partition partitioned tables only: appends a `_partition`
struct column computed by `PartitionExpr`
→ repartition hash on `_partition` for identity/bucket
transforms, otherwise round-robin; uses session target_partitions
Review Comment:
Until the follow-up, could the diagram mark `repartition` as currently
removed by the optimizer? As written it reads as a step that runs, which
contradicts the note on line 110.
--
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]