Skip to content

Commit

Permalink
Revert "Core: Use encoding/decoding methods for namespaces and deprec…
Browse files Browse the repository at this point in the history
…ate Spli…" (#11574)

This reverts commit 5fc1413.
  • Loading branch information
nastra authored Nov 19, 2024
1 parent e71e3cb commit 3badfe0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ public List<Namespace> listNamespaces(SessionContext context, Namespace namespac

Map<String, String> queryParams = Maps.newHashMap();
if (!namespace.isEmpty()) {
queryParams.put("parent", RESTUtil.encodeNamespace(namespace));
queryParams.put("parent", RESTUtil.NAMESPACE_JOINER.join(namespace.levels()));
}

ImmutableList.Builder<Namespace> namespaces = ImmutableList.builder();
Expand Down
16 changes: 3 additions & 13 deletions core/src/main/java/org/apache/iceberg/rest/RESTUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,14 @@
import org.apache.iceberg.relocated.com.google.common.collect.Maps;

public class RESTUtil {
private static final char NAMESPACE_SEPARATOR = '\u001f';
public static final Joiner NAMESPACE_JOINER = Joiner.on(NAMESPACE_SEPARATOR);
public static final Splitter NAMESPACE_SPLITTER = Splitter.on(NAMESPACE_SEPARATOR);
private static final String NAMESPACE_ESCAPED_SEPARATOR = "%1F";
private static final Joiner NAMESPACE_ESCAPED_JOINER = Joiner.on(NAMESPACE_ESCAPED_SEPARATOR);
private static final Splitter NAMESPACE_ESCAPED_SPLITTER =
Splitter.on(NAMESPACE_ESCAPED_SEPARATOR);

/**
* @deprecated since 1.7.0, will be made private in 1.8.0; use {@link
* RESTUtil#encodeNamespace(Namespace)} instead.
*/
@Deprecated public static final Joiner NAMESPACE_JOINER = Joiner.on(NAMESPACE_ESCAPED_SEPARATOR);

/**
* @deprecated since 1.7.0, will be made private in 1.8.0; use {@link
* RESTUtil#decodeNamespace(String)} instead.
*/
@Deprecated
public static final Splitter NAMESPACE_SPLITTER = Splitter.on(NAMESPACE_ESCAPED_SEPARATOR);

private RESTUtil() {}

public static String stripTrailingSlash(String path) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,11 @@ public <T extends RESTResponse> T handleRequest(
if (asNamespaceCatalog != null) {
Namespace ns;
if (vars.containsKey("parent")) {
ns = RESTUtil.decodeNamespace(vars.get("parent"));
ns =
Namespace.of(
RESTUtil.NAMESPACE_SPLITTER
.splitToStream(vars.get("parent"))
.toArray(String[]::new));
} else {
ns = Namespace.empty();
}
Expand Down

0 comments on commit 3badfe0

Please sign in to comment.