Skip to content
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

add the process of snapshots queryParam for RESTCatalogAdapter #8519

Closed
wants to merge 1 commit into from

Conversation

FANNG1
Copy link

@FANNG1 FANNG1 commented Sep 7, 2023

#6850 add lazy snapshot loading for RESTCatalog, but RESTCatalogAdapter doesn't process the 'snapshots' queryParam.

return tableMetadata;
}

public static LoadTableResponse loadTable(
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we can just change a public method as that will break API compatibility: https://github.com/apache/iceberg/blob/master/CONTRIBUTING.md#semantic-versioning

@sandflee what's the expectation on your end for this PR? Are you expecting a backing catalog (such as JDBC) to also return either a single snapshot vs all snapshots when the snapshot-loading-mode is set?

Copy link
Author

Choose a reason for hiding this comment

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

I'm building a Iceberg RESTCatalog server with the ability of CatalogHandlers, and found CatalogHandlers#loadTable doesn't support snapshot queryParams, so I post this PR.

Copy link
Author

Choose a reason for hiding this comment

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

@nastra , is it necessary to process snapshot mode in CatalogHandlers ? if yes, maybe we could add another interface.

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 building a Iceberg RESTCatalog server with the ability of CatalogHandlers, and found CatalogHandlers#loadTable doesn't support snapshot queryParams, so I post this PR.

In that case wouldn't it be better to implement this functionality on the server rather than in CatalogHandlers?

Copy link
Author

Choose a reason for hiding this comment

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

ok, I'll implement it on the server, thanks for your review @nastra

RESTSessionCatalog.SnapshotMode snapshotMode =
RESTSessionCatalog.SnapshotMode.valueOf(
PropertyUtil.propertyAsString(
vars, "snapshots", RESTSessionCatalog.SnapshotMode.ALL.name()));
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't this be called snapshot-loading-mode rather than snapshots?

Copy link
Author

Choose a reason for hiding this comment

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

snapshot-loading-mode is the property name in RESTSessionCatalog to init snapshotMode. snapshots is the name of queryParams when REST client sending requests.

 enum SnapshotMode {
    ALL,
    REFS;

    // REST clients use it as queryParams
    Map<String, String> params() {
      return ImmutableMap.of("snapshots", this.name().toLowerCase(Locale.US));
    }
  }

\ org.apache.iceberg.catalog.TableIdentifier)"
new: "method org.apache.iceberg.rest.responses.LoadTableResponse org.apache.iceberg.rest.CatalogHandlers::loadTable(org.apache.iceberg.catalog.Catalog,\
\ org.apache.iceberg.catalog.TableIdentifier, org.apache.iceberg.rest.RESTSessionCatalog.SnapshotMode)"
justification: "add snapshot mode when load Table"
Copy link
Contributor

Choose a reason for hiding this comment

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

@FANNG1 FANNG1 closed this Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants