Skip to content

feat: Make FanoutWriter writer configurable#1872

Closed
jonathanc-n wants to merge 5 commits intoapache:mainfrom
jonathanc-n:add-fanout_enabled-to-table-properties
Closed

feat: Make FanoutWriter writer configurable#1872
jonathanc-n wants to merge 5 commits intoapache:mainfrom
jonathanc-n:add-fanout_enabled-to-table-properties

Conversation

@jonathanc-n
Copy link
Copy Markdown
Contributor

Which issue does this PR close?

What changes are included in this PR?

Adds PROPERTY_WRITE_FANOUT_ENABLED to TableProperties

I made it write.fanout.enabled instead of write.fanout-enabled in case there is anything we want configurable with FanoutWriter in the future.

Are these changes tested?

Yes by existing tests.

@jonathanc-n
Copy link
Copy Markdown
Contributor Author

cc @CTTY

Copy link
Copy Markdown
Collaborator

@CTTY CTTY left a comment

Choose a reason for hiding this comment

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

Thanks for working on this! I've left some minor comments


/// Whether to use `FanoutWriter` for partitioned tables (handles unsorted data).
/// If false, uses `ClusteredWriter` (requires sorted data, more memory efficient).
pub const PROPERTY_WRITE_FANOUT_ENABLED: &str = "write.fanout.enabled";
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think write.datafusion.fanout.enabled will be a better property name since Java has

public static final String SPARK_WRITE_PARTITIONED_FANOUT_ENABLED = "write.spark.fanout.enabled";

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
pub const PROPERTY_WRITE_FANOUT_ENABLED: &str = "write.fanout.enabled";
pub const PROPERTY_DATAFUSION_WRITE_FANOUT_ENABLED: &str = "write.datafusion.fanout.enabled";

Comment thread crates/iceberg/src/spec/table_properties.rs
/// The default format for files.
pub write_format_default: String,
/// The target file size for files.
pub write_target_file_size_bytes: usize,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We need to add the property here as well

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was thinking about this, I think whether or not to place it in the TableProperty struct is currently a bit inconsistent. write_format_default and write_target_file_size_bytes don't seem to be called by table_property.<property> and are manually parsed in write.rs. I'm not sure why they are parsed differently, but should we standardize one way to do it?

The different ways are currently calling try_from or parsing the way it is done in this pull request.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

write_format_default and write_target_file_size_bytes don't seem to be called by table_property. and are manually parsed in write.rs

Yes, this is because table.metadata().properties() is actually &HashMap<String, String>, not a TableProperties instance. There is an issue tracking this: #1878

Once the issue above is fixed, we should definitely start thinking about standardize the way of fetching property.

All of these can be treated as a separate issue imo, and we should still add the new properties to TableProperties struct

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Should be good for another look!

Copy link
Copy Markdown
Collaborator

@CTTY CTTY left a comment

Choose a reason for hiding this comment

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

Just one minor change, otherwise looks good to me!


/// Whether to use `FanoutWriter` for partitioned tables (handles unsorted data).
/// If false, uses `ClusteredWriter` (requires sorted data, more memory efficient).
pub const PROPERTY_WRITE_FANOUT_ENABLED: &str = "write.fanout.enabled";
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
pub const PROPERTY_WRITE_FANOUT_ENABLED: &str = "write.fanout.enabled";
pub const PROPERTY_DATAFUSION_WRITE_FANOUT_ENABLED: &str = "write.datafusion.fanout.enabled";

@jonathanc-n
Copy link
Copy Markdown
Contributor Author

@CTTY I added it and to the default const

Copy link
Copy Markdown
Collaborator

@CTTY CTTY left a comment

Choose a reason for hiding this comment

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

LGTM! Looks like the CI is being flaky tho

@jonathanc-n
Copy link
Copy Markdown
Contributor Author

Yes tests seem to fail non deterministically. cc @liurenjie1024 good to go

/// The target file size for files.
pub write_target_file_size_bytes: usize,
/// Whether to use `FanoutWriter` for partitioned tables.
pub write_fanout_enabled: bool,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
pub write_fanout_enabled: bool,
pub write_datafusion_fanout_enabled: bool,

.map_err(|e| {
Error::new(
ErrorKind::DataInvalid,
"Invalid value for write.fanout.enabled, expected 'true' or 'false'",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
"Invalid value for write.fanout.enabled, expected 'true' or 'false'",
"Invalid value for {}, expected 'true' or 'false'", WRITE_DATAFUSION_FANOUT_ENABLED

@CTTY
Copy link
Copy Markdown
Collaborator

CTTY commented Dec 24, 2025

Hi @jonathanc-n , could you address the comments that Renjie left? Otherwise, I'd be happy to drive this PR to finish

liurenjie1024 pushed a commit that referenced this pull request Jan 6, 2026
## Which issue does this PR close?

- Closes #1834.

## What changes are included in this PR?


- Fellow on #1872.

## Are these changes tested?

---------

Signed-off-by: StandingMan <jmtangcs@gmail.com>
@github-actions
Copy link
Copy Markdown
Contributor

This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@iceberg.apache.org list. Thank you for your contributions.

@github-actions github-actions Bot added the stale label Feb 27, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 6, 2026

This pull request has been closed due to lack of activity. This is not a judgement on the merit of the PR in any way. It is just a way of keeping the PR queue manageable. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time.

@github-actions github-actions Bot closed this Mar 6, 2026
@CTTY CTTY reopened this Mar 6, 2026
@CTTY CTTY closed this Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make fanout/clustered mode configurable for datafusion write

3 participants