gaborkaszab commented on code in PR #13979:
URL: https://github.com/apache/iceberg/pull/13979#discussion_r2324633026
##########
core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java:
##########
@@ -367,46 +368,67 @@ public boolean tableExists(SessionContext context,
TableIdentifier identifier) {
}
private LoadTableResponse loadInternal(
- SessionContext context, TableIdentifier identifier, SnapshotMode mode) {
+ SessionContext context,
+ TableIdentifier identifier,
+ SnapshotMode mode,
+ Map<String, Object> viewContext) {
Endpoint.check(endpoints, Endpoint.V1_LOAD_TABLE);
AuthSession contextualSession = authManager.contextualSession(context,
catalogAuth);
+
+ // inject the context to query params
+ Map<String, String> queryParams = Maps.newHashMap(mode.params());
+
+ Object viewIdentifierObj =
viewContext.get(ContextAwareTableCatalog.VIEW_IDENTIFIER_KEY);
+ if (viewIdentifierObj instanceof String) {
+ String viewIdentifierString = (String) viewIdentifierObj;
+ String[] parts = viewIdentifierString.split("\\.");
+ if (parts.length >= 2) {
+ String[] namespaceParts = new String[parts.length - 1];
+ System.arraycopy(parts, 0, namespaceParts, 0, parts.length - 1);
+ String viewName = parts[parts.length - 1];
+ queryParams.put(
Review Comment:
Just for my understanding:
Let's take the following input: "ns1.ns2.view1"
We convert this to "ns1%1Fns2%1F.view1"
Is this because we wan't to tell the REST catalog which part is the
namespace and which is the view name? If we include a dot in the query params,
can't we just send the view path as it is with dots and let the catalog server
figure out the namespace/view name part that we do here? Or can we also use the
same special char between the namespace and the view name?
##########
core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java:
##########
@@ -367,46 +368,67 @@ public boolean tableExists(SessionContext context,
TableIdentifier identifier) {
}
private LoadTableResponse loadInternal(
- SessionContext context, TableIdentifier identifier, SnapshotMode mode) {
+ SessionContext context,
+ TableIdentifier identifier,
+ SnapshotMode mode,
+ Map<String, Object> viewContext) {
Endpoint.check(endpoints, Endpoint.V1_LOAD_TABLE);
AuthSession contextualSession = authManager.contextualSession(context,
catalogAuth);
+
+ // inject the context to query params
+ Map<String, String> queryParams = Maps.newHashMap(mode.params());
+
+ Object viewIdentifierObj =
viewContext.get(ContextAwareTableCatalog.VIEW_IDENTIFIER_KEY);
+ if (viewIdentifierObj instanceof String) {
Review Comment:
If there is a view identifier provided here but it's not string, or it has
less than 2 parts we silently omit the provided input. Shouldn't we raise an
illegal argument exception rather to tell the clients that whatever they
provided was incorrect?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]