Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@

public interface CallContextCatalogFactory {

static final String WAREHOUSE_LOCATION_BASEDIR = "/tmp/iceberg_rest_server_warehouse_data/";

Catalog createCallContextCatalog(
CallContext context,
AuthenticatedPolarisPrincipal authenticatedPrincipal,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import jakarta.ws.rs.core.SecurityContext;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import org.apache.iceberg.CatalogProperties;
import org.apache.iceberg.catalog.Catalog;
import org.apache.polaris.core.auth.AuthenticatedPolarisPrincipal;
Expand Down Expand Up @@ -106,11 +104,16 @@ public Catalog createCallContextCatalog(
String defaultBaseLocation = catalog.getDefaultBaseLocation();
LOGGER.debug(
"Looked up defaultBaseLocation {} for catalog {}", defaultBaseLocation, catalogKey);
catalogProperties.put(
CatalogProperties.WAREHOUSE_LOCATION,
Objects.requireNonNullElseGet(
defaultBaseLocation,
() -> Paths.get(WAREHOUSE_LOCATION_BASEDIR, catalogKey).toString()));

if (defaultBaseLocation == null) {
throw new IllegalStateException(
String.format(
"Catalog '%s' does not have a configured warehouse location. "
+ "Please configure a default base location for this catalog.",
catalogKey));
}

catalogProperties.put(CatalogProperties.WAREHOUSE_LOCATION, defaultBaseLocation);

// TODO: The initialize properties might need to take more from CallContext and the
// CatalogEntity.
Expand Down
Loading