You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@polaris.apache.org by "adutra (via GitHub)" <gi...@apache.org> on 2026/04/15 15:33:27 UTC
[PR] Improve namespace decoding [polaris]
adutra opened a new pull request, #4213:
URL: https://github.com/apache/polaris/pull/4213
This change removes calls to Iceberg `RESTUtil.decodeNamespace()` almost entirely, and replaces those with methods that are more suitable for use in Quarkus/Jersey.
The REST framework (Jersey) already ULR-decodes path segments. For example, when a REST resource method such as `IcebergRestCatalogApi.loadTable` is invoked, the parameters `namespace` and `table` are already URL-decoded.
But since `RESTUtil.decodeNamespace()` expects *encoded* inputs, we were forced to re-encode the namespace name before passing it to `decodeNamespace()`.
This change does NOT remove calls to `RESTUtil.decodeNamespace()` in the Polaris entity code โ this will be addressed later.
This change also does NOT change calls to `RESTUtil.encodeNamespace()` โ these are problematic but will be addressed later as well.
<!--
๐ Describe what changes you're proposing, especially breaking or user-facing changes.
๐ See https://github.com/apache/polaris/blob/main/CONTRIBUTING.md for more.
-->
## Checklist
- [ ] ๐ก๏ธ Don't disclose security issues! (contact security@apache.org)
- [ ] ๐ Clearly explained why the changes are needed, or linked related issues: Fixes #
- [ ] ๐งช Added/updated tests with good coverage, or manually tested (and explained how)
- [ ] ๐ก Added comments for complex logic
- [ ] ๐งพ Updated `CHANGELOG.md` (if needed)
- [ ] ๐ Updated documentation in `site/content/in-dev/unreleased` (if needed)
--
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@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve namespace decoding [polaris]
Posted by "adutra (via GitHub)" <gi...@apache.org>.
adutra commented on code in PR #4213:
URL: https://github.com/apache/polaris/pull/4213#discussion_r3087825354
##########
polaris-core/src/main/java/org/apache/polaris/core/rest/NamespaceUtils.java:
##########
@@ -0,0 +1,51 @@
+/*
+ * 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.polaris.core.rest;
+
+import com.google.common.base.Joiner;
+import com.google.common.base.Splitter;
+import com.google.common.collect.Iterables;
+import org.apache.iceberg.catalog.Namespace;
+
+/** Utility methods for encoding and decoding {@link Namespace} values. */
+public final class NamespaceUtils {
+
+ /**
+ * The default namespace separator: the ASCII Unit Separator character (U+001F).
+ *
+ * <p>This is the same separator declared in Iceberg's {@link org.apache.iceberg.rest.RESTUtil}
+ * class, but it's private there and cannot be referenced.
+ */
+ public static final String DEFAULT_NAMESPACE_SEPARATOR = "\u001f";
+
+ private NamespaceUtils() {}
+
+ /** Joins the levels of a namespace into a single string using the given {@code separator}. */
+ public static String joinNamespace(Namespace namespace, String separator) {
Review Comment:
I'm open to the opposite approach though: if we decide right now that in Polaris, the namespace separator will never change, then we could remove the `separator` parameter.
--
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@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve namespace decoding [polaris]
Posted by "adutra (via GitHub)" <gi...@apache.org>.
adutra commented on PR #4213:
URL: https://github.com/apache/polaris/pull/4213#issuecomment-4260308171
I'm going to merge this by EOD to unblock further changes to encoding/decoding logic, FYI.
--
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@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve namespace decoding [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #4213:
URL: https://github.com/apache/polaris/pull/4213#discussion_r3088077903
##########
polaris-core/src/main/java/org/apache/polaris/core/rest/NamespaceUtils.java:
##########
@@ -0,0 +1,51 @@
+/*
+ * 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.polaris.core.rest;
+
+import com.google.common.base.Joiner;
+import com.google.common.base.Splitter;
+import com.google.common.collect.Iterables;
+import org.apache.iceberg.catalog.Namespace;
+
+/** Utility methods for encoding and decoding {@link Namespace} values. */
+public final class NamespaceUtils {
+
+ /**
+ * The default namespace separator: the ASCII Unit Separator character (U+001F).
+ *
+ * <p>This is the same separator declared in Iceberg's {@link org.apache.iceberg.rest.RESTUtil}
+ * class, but it's private there and cannot be referenced.
+ */
+ public static final String DEFAULT_NAMESPACE_SEPARATOR = "\u001f";
+
+ private NamespaceUtils() {}
+
+ /** Joins the levels of a namespace into a single string using the given {@code separator}. */
+ public static String joinNamespace(Namespace namespace, String separator) {
Review Comment:
This makes sense in `polaris-core`, but perhaps we could have a convenience method in test code... just to reduce clutter as we never reconfigure it in tests, IIRC ๐ค
--
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@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve namespace decoding [polaris]
Posted by "adutra (via GitHub)" <gi...@apache.org>.
adutra commented on code in PR #4213:
URL: https://github.com/apache/polaris/pull/4213#discussion_r3087690673
##########
polaris-core/src/main/java/org/apache/polaris/core/rest/NamespaceUtils.java:
##########
@@ -0,0 +1,51 @@
+/*
+ * 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.polaris.core.rest;
+
+import com.google.common.base.Joiner;
+import com.google.common.base.Splitter;
+import com.google.common.collect.Iterables;
+import org.apache.iceberg.catalog.Namespace;
+
+/** Utility methods for encoding and decoding {@link Namespace} values. */
+public final class NamespaceUtils {
+
+ /**
+ * The default namespace separator: the ASCII Unit Separator character (U+001F).
+ *
+ * <p>This is the same separator declared in Iceberg's {@link org.apache.iceberg.rest.RESTUtil}
+ * class, but it's private there and cannot be referenced.
+ */
+ public static final String DEFAULT_NAMESPACE_SEPARATOR = "\u001f";
+
+ private NamespaceUtils() {}
+
+ /** Joins the levels of a namespace into a single string using the given {@code separator}. */
+ public static String joinNamespace(Namespace namespace, String separator) {
Review Comment:
I'm deliberately avoiding to provide an overloaded method without the `separator` argument that would just use the default separator. This is because in Iceberg 1.11 the namespace separator becomes configurable; I'm not sure Polaris would ever allow users to configure the namespace one day, but if this day arrives, it will be the caller's responsibility to figure out which separator to use.
--
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@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve namespace decoding [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #4213:
URL: https://github.com/apache/polaris/pull/4213#discussion_r3094381947
##########
polaris-core/src/main/java/org/apache/polaris/core/rest/NamespaceUtils.java:
##########
@@ -0,0 +1,51 @@
+/*
+ * 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.polaris.core.rest;
+
+import com.google.common.base.Joiner;
+import com.google.common.base.Splitter;
+import com.google.common.collect.Iterables;
+import org.apache.iceberg.catalog.Namespace;
+
+/** Utility methods for encoding and decoding {@link Namespace} values. */
+public final class NamespaceUtils {
+
+ /**
+ * The default namespace separator: the ASCII Unit Separator character (U+001F).
+ *
+ * <p>This is the same separator declared in Iceberg's {@link org.apache.iceberg.rest.RESTUtil}
+ * class, but it's private there and cannot be referenced.
+ */
+ public static final String DEFAULT_NAMESPACE_SEPARATOR = "\u001f";
+
+ private NamespaceUtils() {}
+
+ /** Joins the levels of a namespace into a single string using the given {@code separator}. */
+ public static String joinNamespace(Namespace namespace, String separator) {
Review Comment:
SGTM :+1:
--
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@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve namespace decoding [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on PR #4213:
URL: https://github.com/apache/polaris/pull/4213#issuecomment-4253996175
Nice, fix!.. long overdue :sweat_smile: Thanks, @adutra !
--
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@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve namespace decoding [polaris]
Posted by "adutra (via GitHub)" <gi...@apache.org>.
adutra commented on code in PR #4213:
URL: https://github.com/apache/polaris/pull/4213#discussion_r3093409595
##########
polaris-core/src/main/java/org/apache/polaris/core/rest/NamespaceUtils.java:
##########
@@ -0,0 +1,51 @@
+/*
+ * 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.polaris.core.rest;
+
+import com.google.common.base.Joiner;
+import com.google.common.base.Splitter;
+import com.google.common.collect.Iterables;
+import org.apache.iceberg.catalog.Namespace;
+
+/** Utility methods for encoding and decoding {@link Namespace} values. */
+public final class NamespaceUtils {
+
+ /**
+ * The default namespace separator: the ASCII Unit Separator character (U+001F).
+ *
+ * <p>This is the same separator declared in Iceberg's {@link org.apache.iceberg.rest.RESTUtil}
+ * class, but it's private there and cannot be referenced.
+ */
+ public static final String DEFAULT_NAMESPACE_SEPARATOR = "\u001f";
+
+ private NamespaceUtils() {}
+
+ /** Joins the levels of a namespace into a single string using the given {@code separator}. */
+ public static String joinNamespace(Namespace namespace, String separator) {
Review Comment:
Let's defer this enhancement to when we'll have to deal with configurable separators. My gut feeling is that the test infra code will also have to deal with configurable separators by then, in which case, I'm not sure the convenience method would make sense.
--
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@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve namespace decoding [polaris]
Posted by "adutra (via GitHub)" <gi...@apache.org>.
adutra merged PR #4213:
URL: https://github.com/apache/polaris/pull/4213
--
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@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org