Skip to content

Conversation

@RussellSpitzer
Copy link
Member

Allows for a Table Operations which references a specfic metadata version
file. This operation will not change even if the base table it was derived
from is changed. This enables it to act like a ReadOnly view of the table's
state at a given time.

Allows for a Table Operations which references a specfic metadata version
file. This operation will not change even if the base table it was derived
from is changed. This enables it to act like a ReadOnly view of the table's
state at a given time.
@RussellSpitzer
Copy link
Member Author

@rdblue + @aokolnychyi As we were talking about, a StaticTableOperations class for implementing #1344

*/
@Override
public Table load(String location) {
TableOperations ops = newTableOps(location);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An alternative to this implementation that I considered was modifying findTable itself. The problem with this is that to do that implementation we need to extract the loadMetadataTable from below. I think this is a cleaner solution but we could do something where we make a StaticTables.java which findTables uses to either return a basetable or metadataTable

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this. It is more straightforward than the previous implementation.

@Test
public void testMetadataTables() {
for (MetadataTableType type: MetadataTableType.values()) {
String enumName = type.name().replace("_","").toLowerCase();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When is this needed?

Also, style nit: no space between arguments to replace.

Copy link
Member Author

@RussellSpitzer RussellSpitzer Aug 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ALL_DATA_FILES, ALL_MANIFESTS, ALL_ENTRIES

All the style things just make me want to upgrade the Checkstyle version even more :) I forgot to run in Intellij where I can force the newer version

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought those were loaded using all_data_files, all_manifests, etc. and not alldatafiles.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are just comparing the ClassName here, so we are comparing AllDataFilesTable.class with ALL_DATA_FILES

I may be misunderstanding your comment here, I'm just making sure that we get back the Class with the right name based on the MetadataType we request.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I see. Nevermind, then.

}

@Test(expected = UnsupportedOperationException.class)
public void testCannotBeAddedTo(){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure we need both this and the next test, but it's okay to have them.

public Table load(String location) {
TableOperations ops = newTableOps(location);
if (ops.current() == null) {
//Possibly Load a Metadata Table
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about parse out the metadata table name, if present?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a different implementation here where we will instead do

Name, Type = tryParseMetadataLocation

if (name, type).{
  loadMetadata
} else {
  loadBasic
}

@rdblue
Copy link
Contributor

rdblue commented Aug 14, 2020

Thanks @RussellSpitzer! Overall this is the right approach and I think the implementation looks good. Just a few minor things.

Cleanup various style mistakes
Slightly redo logic around parsing MetadataTableNames
Fix test cases which were missing refreshes
@RussellSpitzer
Copy link
Member Author

Updated

@RussellSpitzer
Copy link
Member Author

@rdblue just a friendly ping, once this gets in I"ll redo the ExpireSnapshots branch, that should be very straightforward

@rdblue rdblue merged commit d026e0b into apache:master Aug 19, 2020
@rdblue
Copy link
Contributor

rdblue commented Aug 19, 2020

Looks great! Thank you @RussellSpitzer!

@RussellSpitzer
Copy link
Member Author

Thanks!

@RussellSpitzer RussellSpitzer deleted the StaticTableOperations branch August 19, 2020 18:09
rdblue pushed a commit to rdblue/iceberg that referenced this pull request Aug 20, 2020
…1342)

Allows for a Table Operations which references a specfic metadata version
file. This operation will not change even if the base table it was derived
from is changed. This enables it to act like a ReadOnly view of the table's
state at a given time.
parthchandra pushed a commit to parthchandra/iceberg that referenced this pull request Oct 22, 2025
parthchandra pushed a commit to parthchandra/iceberg that referenced this pull request Oct 22, 2025
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.

2 participants