NoahKusaba commented on code in PR #138:
URL:
https://github.com/apache/datafusion-iceberg/pull/138#discussion_r4773298014
##########
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:
I made IcebergWriteExec::new -> try_new, which fails at planning when a
partitioned table's input has no _partition, with or without fanout.
rejects_partitioned_writes_without_partition_values covers it.
Thanks for the feedback.
--
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]