-
Notifications
You must be signed in to change notification settings - Fork 533
Expand IcebergIO write API to cover all write options #5986
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b02d1e9
b47f6e5
ca2dd9e
c1958b1
658d37d
92f2c2a
445269b
e3a718a
4e2686c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,12 +34,20 @@ class IcebergSCollectionSyntax[T: RowType: Coder](self: SCollection[T]) { | |
| * @param catalogProperties | ||
| * any additional properties required by the Iceberg catalog; see: | ||
| * https://iceberg.apache.org/docs/latest/catalog-properties | ||
| * @param hadoopConfigProperties | ||
| * any additional Hadoop configuration properties | ||
| * @param tableProperties | ||
| * any additional Iceberg table properties to set during dynamic table creation; see: | ||
| * https://iceberg.apache.org/docs/latest/configuration/#write-properties | ||
| * @param sortFields | ||
| * list of field names defining the sort order for written files | ||
| * @param partitionFields | ||
| * list of field names defining the partition spec for the table | ||
| * @param triggeringFrequencySeconds | ||
| * (streaming only) frequency at which snapshots are produced | ||
| * @param directWriteByteLimit | ||
| * (streaming only) limit for lifting bundles into the direct write path. | ||
| * @param extraConfigProperties | ||
| * additional properties to pass to the Managed IO config, i.e. `distribution_mode: hash` or | ||
| * `autosharding: true` | ||
| * | ||
| * For a complete reference, see: | ||
| * https://docs.cloud.google.com/dataflow/docs/guides/managed-io-iceberg | ||
|
|
@@ -48,19 +56,24 @@ class IcebergSCollectionSyntax[T: RowType: Coder](self: SCollection[T]) { | |
| table: String, | ||
| catalogName: String = null, | ||
| catalogProperties: Map[String, String] = IcebergIO.WriteParam.DefaultCatalogProperties, | ||
| hadoopConfigProperties: Map[String, String] = | ||
| IcebergIO.WriteParam.DefaultHadoopConfigProperties, | ||
| tableProperties: Map[String, String] = IcebergIO.WriteParam.DefaultTableProperties, | ||
| sortFields: List[String] = IcebergIO.WriteParam.DefaultSortFields, | ||
| partitionFields: List[String] = IcebergIO.WriteParam.DefaultPartitionFields, | ||
| extraConfigProperties: Map[String, AnyRef] = IcebergIO.WriteParam.DefaultExtraConfigProperties, | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought this was more flexible than adding a dedicated named param for every new option added to the Iceberg write api (i.e.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah might be better this way indeed till the API stabilizes |
||
| triggeringFrequencySeconds: Int = IcebergIO.WriteParam.DefaultTriggeringFrequencySeconds, | ||
| directWriteByteLimit: Int = IcebergIO.WriteParam.DefaultDirectWriteByteLimit | ||
| ): ClosedTap[Nothing] = { | ||
|
|
||
| val params = IcebergIO.WriteParam( | ||
| catalogProperties, | ||
| hadoopConfigProperties, | ||
| tableProperties, | ||
| sortFields, | ||
| partitionFields, | ||
| Option(triggeringFrequencySeconds).filter( | ||
| _ != IcebergIO.WriteParam.DefaultTriggeringFrequencySeconds | ||
| ), | ||
| Option(directWriteByteLimit).filter(_ != IcebergIO.WriteParam.DefaultDirectWriteByteLimit) | ||
| Option(directWriteByteLimit).filter(_ != IcebergIO.WriteParam.DefaultDirectWriteByteLimit), | ||
| extraConfigProperties | ||
| ) | ||
| self.write(IcebergIO(table, Option(catalogName)))(params) | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a breaking change. We assume that there are not many affected users? Should we add some doc though?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah... not ideal, but AFAIK there are no users of this API. We weren't even publishing the scio-managed artifact until about a month ago, in 0.15.7 😅