You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/04/01 20:19:00 UTC
[GitHub] [iceberg] rdblue opened a new pull request #4467: Core: Add ResourcePaths helper for REST
rdblue opened a new pull request #4467:
URL: https://github.com/apache/iceberg/pull/4467
This adds a helper class, `ResourcePaths` to construct resource paths in the REST catalog. This cleans up path construction to be based on REST resource and adds support for the `prefix` parameter in the REST spec.
This also adds tests for each resource and validates the multipart namespace (null byte) handling.
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] kbendick commented on a change in pull request #4467: Core: Add ResourcePaths helper for REST
Posted by GitBox <gi...@apache.org>.
kbendick commented on a change in pull request #4467:
URL: https://github.com/apache/iceberg/pull/4467#discussion_r840971016
##########
File path: core/src/test/java/org/apache/iceberg/rest/TestResourcePaths.java
##########
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iceberg.rest;
+
+import org.apache.iceberg.catalog.Namespace;
+import org.apache.iceberg.catalog.TableIdentifier;
+import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestResourcePaths {
+ private final String prefix = "ws/catalog";
+ private final ResourcePaths withPrefix = ResourcePaths.forCatalogProperties(ImmutableMap.of("prefix", prefix));
+ private final ResourcePaths withoutPrefix = ResourcePaths.forCatalogProperties(ImmutableMap.of());
+
+ @Test
+ public void testConfigPath() {
+ // prefix does not affect the config route because config is merged into catalog properties
+ Assert.assertEquals(ResourcePaths.config(), "v1/config");
+ }
Review comment:
Ok. That logic is sound to me. If somebody winds up requesting it later on, we can consider supporting it then.
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] kbendick commented on a change in pull request #4467: Core: Add ResourcePaths helper for REST
Posted by GitBox <gi...@apache.org>.
kbendick commented on a change in pull request #4467:
URL: https://github.com/apache/iceberg/pull/4467#discussion_r841017103
##########
File path: core/src/main/java/org/apache/iceberg/rest/RESTCatalog.java
##########
@@ -139,61 +138,57 @@ public void createNamespace(Namespace namespace, Map<String, String> metadata) {
.build();
// for now, ignore the response because there is no way to return it
- client.post("v1/namespaces", request, CreateNamespaceResponse.class, ErrorHandlers.namespaceErrorHandler());
+ client.post(paths.namespaces(), request, CreateNamespaceResponse.class, ErrorHandlers.namespaceErrorHandler());
}
@Override
public List<Namespace> listNamespaces(Namespace namespace) throws NoSuchNamespaceException {
Preconditions.checkArgument(namespace.isEmpty(), "Cannot list namespaces under parent: %s", namespace);
// String joined = NULL.join(namespace.levels());
ListNamespacesResponse response = client
- .get("v1/namespaces", ListNamespacesResponse.class, ErrorHandlers.namespaceErrorHandler());
+ .get(paths.namespaces(), ListNamespacesResponse.class, ErrorHandlers.namespaceErrorHandler());
Review comment:
This route is incorrect. List namespaces underneath a parent namespace is `GET /v1/namespaces?parent=accounting`, but this will generate `GET /v1/namespaces/accounting`.
iirc this is to make it easier to list the empty namespace (top-level namespace or unknown I guess) for systems that might _need_ the variable there in the path when it's expected
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] kbendick commented on a change in pull request #4467: Core: Add ResourcePaths helper for REST
Posted by GitBox <gi...@apache.org>.
kbendick commented on a change in pull request #4467:
URL: https://github.com/apache/iceberg/pull/4467#discussion_r840952171
##########
File path: core/src/test/java/org/apache/iceberg/rest/TestResourcePaths.java
##########
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iceberg.rest;
+
+import org.apache.iceberg.catalog.Namespace;
+import org.apache.iceberg.catalog.TableIdentifier;
+import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestResourcePaths {
+ private final String prefix = "ws/catalog";
+ private final ResourcePaths withPrefix = ResourcePaths.forCatalogProperties(ImmutableMap.of("prefix", prefix));
+ private final ResourcePaths withoutPrefix = ResourcePaths.forCatalogProperties(ImmutableMap.of());
+
+ @Test
+ public void testConfigPath() {
+ // prefix does not affect the config route because config is merged into catalog properties
+ Assert.assertEquals(ResourcePaths.config(), "v1/config");
+ }
+
+ @Test
+ public void testNamespaces() {
+ Assert.assertEquals("v1/ws/catalog/namespaces", withPrefix.namespaces());
+ Assert.assertEquals("v1/namespaces", withoutPrefix.namespaces());
+ }
+
+ @Test
+ public void testNamespace() {
+ Namespace ns = Namespace.of("ns");
+ Assert.assertEquals("v1/ws/catalog/namespaces/ns", withPrefix.namespace(ns));
+ Assert.assertEquals("v1/namespaces/ns", withoutPrefix.namespace(ns));
+ }
+
+ @Test
+ public void testNamespaceWithSlash() {
+ Namespace ns = Namespace.of("n/s");
+ Assert.assertEquals("v1/ws/catalog/namespaces/n%2Fs", withPrefix.namespace(ns));
+ Assert.assertEquals("v1/namespaces/n%2Fs", withoutPrefix.namespace(ns));
+ }
+
+ @Test
+ public void testNamespaceWithMultipartNamespace() {
+ Namespace ns = Namespace.of("n", "s");
+ Assert.assertEquals("v1/ws/catalog/namespaces/n%00s", withPrefix.namespace(ns));
+ Assert.assertEquals("v1/namespaces/n%00s", withoutPrefix.namespace(ns));
Review comment:
Ah ok good catch. Thank you for fixing it!
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] rdblue commented on a change in pull request #4467: Core: Add ResourcePaths helper for REST
Posted by GitBox <gi...@apache.org>.
rdblue commented on a change in pull request #4467:
URL: https://github.com/apache/iceberg/pull/4467#discussion_r840898196
##########
File path: core/src/test/java/org/apache/iceberg/rest/TestResourcePaths.java
##########
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iceberg.rest;
+
+import org.apache.iceberg.catalog.Namespace;
+import org.apache.iceberg.catalog.TableIdentifier;
+import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestResourcePaths {
+ private final String prefix = "ws/catalog";
+ private final ResourcePaths withPrefix = ResourcePaths.forCatalogProperties(ImmutableMap.of("prefix", prefix));
+ private final ResourcePaths withoutPrefix = ResourcePaths.forCatalogProperties(ImmutableMap.of());
+
+ @Test
+ public void testConfigPath() {
+ // prefix does not affect the config route because config is merged into catalog properties
+ Assert.assertEquals(ResourcePaths.config(), "v1/config");
+ }
+
+ @Test
+ public void testNamespaces() {
+ Assert.assertEquals("v1/ws/catalog/namespaces", withPrefix.namespaces());
+ Assert.assertEquals("v1/namespaces", withoutPrefix.namespaces());
+ }
+
+ @Test
+ public void testNamespace() {
+ Namespace ns = Namespace.of("ns");
+ Assert.assertEquals("v1/ws/catalog/namespaces/ns", withPrefix.namespace(ns));
+ Assert.assertEquals("v1/namespaces/ns", withoutPrefix.namespace(ns));
+ }
+
+ @Test
+ public void testNamespaceWithSlash() {
+ Namespace ns = Namespace.of("n/s");
+ Assert.assertEquals("v1/ws/catalog/namespaces/n%2Fs", withPrefix.namespace(ns));
+ Assert.assertEquals("v1/namespaces/n%2Fs", withoutPrefix.namespace(ns));
+ }
+
+ @Test
+ public void testNamespaceWithMultipartNamespace() {
+ Namespace ns = Namespace.of("n", "s");
+ Assert.assertEquals("v1/ws/catalog/namespaces/n%00s", withPrefix.namespace(ns));
+ Assert.assertEquals("v1/namespaces/n%00s", withoutPrefix.namespace(ns));
Review comment:
@kbendick, these tests failed at first and I had to update the null byte joiner. I think the problem was that the URL encoder was running on each namespace part and not on the whole thing, so null bytes were left unencoded.
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] kbendick commented on a change in pull request #4467: Core: Add ResourcePaths helper for REST
Posted by GitBox <gi...@apache.org>.
kbendick commented on a change in pull request #4467:
URL: https://github.com/apache/iceberg/pull/4467#discussion_r840971274
##########
File path: core/src/main/java/org/apache/iceberg/rest/ResourcePaths.java
##########
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iceberg.rest;
+
+import java.util.Map;
+import org.apache.iceberg.catalog.Namespace;
+import org.apache.iceberg.catalog.TableIdentifier;
+import org.apache.iceberg.relocated.com.google.common.base.Joiner;
+
+public class ResourcePaths {
Review comment:
Sounds good to me. When I was working on similar, having `V1` in the class name was rather ugly. So I actually prefer to avoid it if there’s a reasonable argument against it, which you’ve provided. Thanks.
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] rdblue commented on a change in pull request #4467: Core: Add ResourcePaths helper for REST
Posted by GitBox <gi...@apache.org>.
rdblue commented on a change in pull request #4467:
URL: https://github.com/apache/iceberg/pull/4467#discussion_r840962261
##########
File path: core/src/test/java/org/apache/iceberg/rest/TestResourcePaths.java
##########
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iceberg.rest;
+
+import org.apache.iceberg.catalog.Namespace;
+import org.apache.iceberg.catalog.TableIdentifier;
+import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestResourcePaths {
+ private final String prefix = "ws/catalog";
+ private final ResourcePaths withPrefix = ResourcePaths.forCatalogProperties(ImmutableMap.of("prefix", prefix));
+ private final ResourcePaths withoutPrefix = ResourcePaths.forCatalogProperties(ImmutableMap.of());
+
+ @Test
+ public void testConfigPath() {
+ // prefix does not affect the config route because config is merged into catalog properties
+ Assert.assertEquals(ResourcePaths.config(), "v1/config");
+ }
Review comment:
The reason why we don't support prefix like that right now is that we need an original config route, which may send back a `prefix`. We could add what you're talking about later, but we'd need to create an initial `ResourcePaths` and then a new one with the config that it returns. I think we should stick to the simple version for now and we can extend it later.
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] kbendick commented on a change in pull request #4467: Core: Add ResourcePaths helper for REST
Posted by GitBox <gi...@apache.org>.
kbendick commented on a change in pull request #4467:
URL: https://github.com/apache/iceberg/pull/4467#discussion_r841017103
##########
File path: core/src/main/java/org/apache/iceberg/rest/RESTCatalog.java
##########
@@ -139,61 +138,57 @@ public void createNamespace(Namespace namespace, Map<String, String> metadata) {
.build();
// for now, ignore the response because there is no way to return it
- client.post("v1/namespaces", request, CreateNamespaceResponse.class, ErrorHandlers.namespaceErrorHandler());
+ client.post(paths.namespaces(), request, CreateNamespaceResponse.class, ErrorHandlers.namespaceErrorHandler());
}
@Override
public List<Namespace> listNamespaces(Namespace namespace) throws NoSuchNamespaceException {
Preconditions.checkArgument(namespace.isEmpty(), "Cannot list namespaces under parent: %s", namespace);
// String joined = NULL.join(namespace.levels());
ListNamespacesResponse response = client
- .get("v1/namespaces", ListNamespacesResponse.class, ErrorHandlers.namespaceErrorHandler());
+ .get(paths.namespaces(), ListNamespacesResponse.class, ErrorHandlers.namespaceErrorHandler());
Review comment:
This route is incorrect. List namespaces underneath a parent namespace is `GET /v1/namespaces?parent=accounting`, but this will generate `GET /v1/namespaces/accounting`.
iirc this is because listing the empty namespace is `GET /v1/namspaces`, to make it easier for systems that might _need_ the variable there in the path when it's expected.
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] kbendick commented on a change in pull request #4467: Core: Add ResourcePaths helper for REST
Posted by GitBox <gi...@apache.org>.
kbendick commented on a change in pull request #4467:
URL: https://github.com/apache/iceberg/pull/4467#discussion_r840953456
##########
File path: core/src/main/java/org/apache/iceberg/rest/ResourcePaths.java
##########
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iceberg.rest;
+
+import java.util.Map;
+import org.apache.iceberg.catalog.Namespace;
+import org.apache.iceberg.catalog.TableIdentifier;
+import org.apache.iceberg.relocated.com.google.common.base.Joiner;
+
+public class ResourcePaths {
Review comment:
Do we want to make this `V1ResourcePaths` or just deal with the change to `V2` if / when there is a V2?
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] rdblue commented on a change in pull request #4467: Core: Add ResourcePaths helper for REST
Posted by GitBox <gi...@apache.org>.
rdblue commented on a change in pull request #4467:
URL: https://github.com/apache/iceberg/pull/4467#discussion_r841101944
##########
File path: core/src/main/java/org/apache/iceberg/rest/RESTCatalog.java
##########
@@ -139,61 +138,57 @@ public void createNamespace(Namespace namespace, Map<String, String> metadata) {
.build();
// for now, ignore the response because there is no way to return it
- client.post("v1/namespaces", request, CreateNamespaceResponse.class, ErrorHandlers.namespaceErrorHandler());
+ client.post(paths.namespaces(), request, CreateNamespaceResponse.class, ErrorHandlers.namespaceErrorHandler());
}
@Override
public List<Namespace> listNamespaces(Namespace namespace) throws NoSuchNamespaceException {
Preconditions.checkArgument(namespace.isEmpty(), "Cannot list namespaces under parent: %s", namespace);
// String joined = NULL.join(namespace.levels());
ListNamespacesResponse response = client
- .get("v1/namespaces", ListNamespacesResponse.class, ErrorHandlers.namespaceErrorHandler());
+ .get(paths.namespaces(), ListNamespacesResponse.class, ErrorHandlers.namespaceErrorHandler());
Review comment:
I think this is correct. We need to support passing parent still, but the path should be the namespaces resource, not the one with a specific namespace.
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] kbendick commented on a change in pull request #4467: Core: Add ResourcePaths helper for REST
Posted by GitBox <gi...@apache.org>.
kbendick commented on a change in pull request #4467:
URL: https://github.com/apache/iceberg/pull/4467#discussion_r840956250
##########
File path: core/src/test/java/org/apache/iceberg/rest/TestResourcePaths.java
##########
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iceberg.rest;
+
+import org.apache.iceberg.catalog.Namespace;
+import org.apache.iceberg.catalog.TableIdentifier;
+import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestResourcePaths {
+ private final String prefix = "ws/catalog";
+ private final ResourcePaths withPrefix = ResourcePaths.forCatalogProperties(ImmutableMap.of("prefix", prefix));
+ private final ResourcePaths withoutPrefix = ResourcePaths.forCatalogProperties(ImmutableMap.of());
+
+ @Test
+ public void testConfigPath() {
+ // prefix does not affect the config route because config is merged into catalog properties
+ Assert.assertEquals(ResourcePaths.config(), "v1/config");
+ }
Review comment:
We might consider allowing prefix for the config route as well, in case somebody wants to use prefix to support several different configs based on the full path (maybe a config returned for a different organization depending on the prefix).
So they could have:
`v1/dbas/config & v1/analysts/config` or maybe `v1/customer1/config & v1/customer2/config` or even `v1/resource_queue1/config & v1/resource_queue2/config` or however else they choose to interpret the use of `prefix`.
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] rdblue commented on a change in pull request #4467: Core: Add ResourcePaths helper for REST
Posted by GitBox <gi...@apache.org>.
rdblue commented on a change in pull request #4467:
URL: https://github.com/apache/iceberg/pull/4467#discussion_r840961658
##########
File path: core/src/main/java/org/apache/iceberg/rest/ResourcePaths.java
##########
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iceberg.rest;
+
+import java.util.Map;
+import org.apache.iceberg.catalog.Namespace;
+import org.apache.iceberg.catalog.TableIdentifier;
+import org.apache.iceberg.relocated.com.google.common.base.Joiner;
+
+public class ResourcePaths {
Review comment:
We're not sure how we're going to evolve them just yet, so I just hid version entirely in this class. We can extend that way later.
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org