Skip to content

Custom metadata in data files #16

Closed

Description

@mccheah

(Migrated from Netflix/iceberg#106 with some extra details added)

It would be useful for consumers of Iceberg tables to be able to specify additional metadata in data files that enable them to know how to read the files. Some examples of custom metadata include:

  • Encryption keys required to read the file,
  • Compression codecs specified on the file without needing to have a specific file extension,
  • Metadata that's specific to a custom file format. Suppose we supported CSV tables in Iceberg down the road. It would be nice to attach the column delimiter on a per-file basis so that a table can be comprised of multiple files that may not necessarily be uniform in terms of the exact layout, but have compatible schemas.

The custom metadata field should be of type Map<String, String> and can be an optional column.

Finally, consider the I/O submodule proposed in #12. In FileIO there, the newOutputFile API should also return custom metadata specific to reading that file after it's written. Thus FileIO#newOutputFile should return a struct containing an OutputFile object for writing the bytes and a Map<String, String> collection of metadata to be saved in the manifest after the data file is written. Similarly, FileIO#newInputFile should also pass custom metadata for reading that file that can be interpreted by the specific implementation of FileIO.

Activity

  1. hiteshs commented on Nov 27, 2018

    @hiteshs
    Member

    If iceberg itself does not plan to parse or understand the map, could a json blob be considered instead?

    For CSV and compression codecs, instead of putting such info into a custom map, I think having these be recognized as first-class known entities will help iceberg data to be consistently/correctly readable by various systems (spark, etc.).

  2. rdsr commented on Nov 27, 2018

    @rdsr
    Contributor

    instead of putting such info into a custom map, I think having these be recognized as first-class known entities will help iceberg data to be consistently/correctly readable by various systems (spark, etc.)

    +1 to this.
    I wonder would there ever be a case where a json blob or a map with custom properties is required, which would be specific to a single platform. If a property/setting is required to correctly read the file, then why not just make it a first class entity?

  3. mccheah commented on Nov 27, 2018

    @mccheah
    ContributorAuthor

    We're planning to use Iceberg as an ephemeral table storage format so that we can take advantage of Iceberg's Data Source V2 implementation to read and write Parquet files. However, we intend to customize the way files are read and written that is specific to our representation of data (see #12). In such a case we need multiple metadata fields that we know will only make sense in our use case and no one else's, really - they're specific to our data platform.

    There are also some examples of metadata tags in the issue description.

    Map<String, String> is effectively a JSON Blob as it is, right? It's more strongly typed than just String. I'd prefer biasing more towards strongly typed schemas than the more loosely typed String.

  4. mccheah commented on Nov 29, 2018

    @mccheah
    ContributorAuthor

    @rdblue, @rdsr @hiteshs, just wanted to check in to see if this is still an acceptable proposal.

  5. rdblue commented on Nov 29, 2018

    @rdblue
    Contributor

    Where do you guys store this information now? Where would it be stored in Iceberg? Table metadata or file metadata?

  6. mccheah commented on Nov 29, 2018

    @mccheah
    ContributorAuthor

    We store the information in our internal system as per-file metadata. We want to be able to batch-fetch this information from our system and load it into the Iceberg table, before invoking the Iceberg data source reader. We would store the information per file in the DataFile object in Iceberg.

  7. mccheah commented on Dec 5, 2018

    @mccheah
    ContributorAuthor

    Closing in favor of #20 and #23.

  8. rdblue commented on Dec 6, 2018

    @rdblue
    Contributor

    Did you mean to close this? It's still open.

  9. rdblue commented on Dec 6, 2018

    @rdblue
    Contributor

    Funny, I accidentally closed it as I commented. Feel free to re-open if you intended to leave it open.

  10. added a commit that references this issue on Dec 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions