You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "revanthgss (via GitHub)" <gi...@apache.org> on 2026/06/28 15:38:50 UTC

[I] GCP: Support write-time object context annotations in GCS FileIO (equivalent of S3 write.tags) [iceberg]

revanthgss opened a new issue, #16995:
URL: https://github.com/apache/iceberg/issues/16995

   ### Feature Request / Improvement
   
   ## Background
   
   The AWS module supports attaching arbitrary key-value tags to S3 objects at write time via
   `s3.write.tags.<key>=<value>` catalog properties (see `S3FileIOProperties` and `S3OutputStream`).
   These tags are embedded in the upload request with no extra API call and can drive S3 lifecycle
   policies.
   
   GCS has a direct equivalent called **object contexts** — key-value metadata embedded
   during the object write. The GCS Java SDK supports this via
   `BlobInfo.Builder.setContexts(ObjectContexts)` since
   [commit `485aefd`](https://github.com/googleapis/java-storage/commit/485aefd3047c52c98d8bd913033c8aee1473e988)
   (google-cloud-storage ≥ 2.57).
   
   ## Proposed change
   
   Add `gcs.write.object-context.<key>=<value>` catalog property support, mirroring the S3 design. This would be useful to add additional metadata like environment, team and table info to the catalog files that are created in GCS.
   
   - **`GCPProperties`** — new constant `GCS_WRITE_OBJECT_CONTEXT_PREFIX = "gcs.write.object-context."`;
     constructor collects all matching properties into an immutable `Map<String, String> writeObjectContexts`;
     new accessor `writeObjectContexts()`
   - **`GCSOutputStream`** — new private `buildBlobInfo(BlobId, GCPProperties)` that calls
     `builder.setContexts(ObjectContexts)` when contexts are configured before passing `BlobInfo` to
     `storage.writer()`. No changes to the stream mechanics.
   - No changes to `GCSFileIO`, `GCSOutputFile`, or any module outside `gcp/`
   
   ## Example usage
   
   ```properties
   spark.sql.catalog.my_catalog.gcs.write.object-context.env=prod
   spark.sql.catalog.my_catalog.gcs.write.object-context.team=data-platform
   spark.sql.catalog.my_catalog.gcs.write.object-context.iceberg-table=orders
   ```
   
   ## Related
   
   - S3 write-tags: apache/iceberg#4259
   - GCS object contexts SDK commit: [[googleapis/java-storage@485aefd](https://github.com/googleapis/java-storage/commit/485aefd3047c52c98d8bd913033c8aee1473e988)](https://github.com/googleapis/java-storage/commit/485aefd3047c52c98d8bd913033c8aee1473e988)
   - GCS object context docs: https://cloud.google.com/storage/docs/use-object-contexts
   
   ### Query engine
   
   None
   
   ### Willingness to contribute
   
   - [x] I can contribute this improvement/feature independently
   - [x] I would be willing to contribute this improvement/feature with guidance from the Iceberg community
   - [ ] I cannot contribute this improvement/feature at this time


-- 
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: issues-unsubscribe@iceberg.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org