Skip to content

Conversation

@jonathanc-n
Copy link
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
Contributor Author

cc @CTTY

Copy link
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
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
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";

/// 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
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
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
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
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
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
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
Contributor Author

@CTTY I added it and to the default const

Copy link
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
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make fanout/clustered mode configurable for datafusion write

2 participants