Skip to content

Add metadata tables - #252

Merged
rdblue merged 6 commits into
apache:masterfrom
rdblue:add-entries-metadata-table
Jul 12, 2019
Merged

rdblue merged 6 commits into
apache:masterfrom
rdblue:add-entries-metadata-table

Conversation

@rdblue

@rdblue rdblue commented Jul 3, 2019 •

Copy link
Copy Markdown
Contributor

This commit adds metadata tables:

  • history -- the snapshot log
  • snapshots -- known snapshots
  • manifests -- manifest files for a snapshot
  • files -- data files for a snapshot
  • entries -- manifest entries for a snapshot

@rdblue
rdblue force-pushed the add-entries-metadata-table branch from 6102fe5 to 6ed83e3 Compare July 3, 2019 21:07
@rdblue
rdblue requested a review from danielcweeks July 3, 2019 21:28
@rdblue rdblue mentioned this pull request Jul 3, 2019
@rdblue rdblue changed the title Add entries metadata table Add Metadata tables Jul 4, 2019
@rdblue rdblue changed the title Add Metadata tables Add metadata tables Jul 4, 2019
@rdblue
rdblue force-pushed the add-entries-metadata-table branch 3 times, most recently from 10a0536 to b7a7765 Compare July 5, 2019 21:51
@rdblue rdblue added this to the 0.1.0 Release milestone Jul 6, 2019
if (ops.current() == null) {
throw new NoSuchTableException("Table does not exist: " + identifier);
String name = identifier.name();
TableType type = TableType.from(name);

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.

Does this prevent creating tables that match one of the catalog TableTypes?

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.

Yes, this would prevent creating a table named db.table.history if db.table exists and db.table.history is a valid table name. Usually this won't happen because namespaces are some fixed depth. Hive, for example, only supports a single identifier as a namespace, which guarantees that this would not happen.

@danielcweeks danielcweeks left a comment

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.

A few minor and specific comments/questions.

More generally, I think some more comments around the new classes/tables where terminology could be confusing (e.g. DataFilesTable) would be helpful.

@danielcweeks

Copy link
Copy Markdown
Contributor

LGTM +1

rdblue added 5 commits July 12, 2019 11:35
This adds a metadata table that uses another table's manifests as data
files. This is an easy way to view Iceberg metadata from a query engine.

This also adds additional setup for other metadata tables, like history,
snapshots, and manifests.
@rdblue
rdblue force-pushed the add-entries-metadata-table branch from b7a7765 to 9487c25 Compare July 12, 2019 18:35
@rdblue

rdblue commented Jul 12, 2019

Copy link
Copy Markdown
Contributor Author

Merging. Thanks for reviewing, @danielcweeks!

@lxynov

lxynov commented Sep 4, 2019

Copy link
Copy Markdown
Contributor

I'm confused about how we can use metadata tables. It looks like we have to pass table type names to Catalog##loadTable. But if so, how can we specify the real table name? Could you help me figure this out? Any example usage can be helpful. Thanks in advance @rdblue

https://github.com/apache/incubator-iceberg/blob/d7c7d0fbb28d711a4e4320c596cfdf4ce1caf93d/core/src/main/java/org/apache/iceberg/BaseMetastoreCatalog.java#L141

@rdblue

rdblue commented Sep 4, 2019

Copy link
Copy Markdown
Contributor Author

@lxynov

lxynov commented Sep 4, 2019

Copy link
Copy Markdown
Contributor

Thank you for the pointer. I see the point now. The name of the underlying table to be queried is stored in Namespace::levels when a metadata table is queried.

@rdblue

rdblue commented Sep 4, 2019

Copy link
Copy Markdown
Contributor Author

Yeah, the catalog first looks up the table name that is passed in and if it doesn't find that one, checks to see if the table name is a metadata table name and if the namespace is a table. If so, it will load the metadata table.

stevenzwu pushed a commit to stevenzwu/iceberg that referenced this pull request Jul 28, 2021
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.

3 participants