From 3d1d940418057b2798a9c733ce90238ca1dc20b1 Mon Sep 17 00:00:00 2001 From: Gerald Berger Date: Thu, 17 Sep 2026 11:11:21 +0200 Subject: [PATCH] Auto-infer rest.auth.type explicitly in catalog_create_rest iceberg-rust's REST catalog client infers rest.auth.type=oauth2 from token/credential/oauth2-server-uri properties and logs a WARN every time it does, specifically to push callers toward setting the property explicitly instead of relying on inference. We can be that explicit caller ourselves in catalog_create_rest, so every caller (raicode included) stops getting spammed by this warning, rather than pushing the fix onto each of them individually. Co-Authored-By: Claude Sonnet 5 --- src/catalog.jl | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/catalog.jl b/src/catalog.jl index 5f340fa..b709092 100644 --- a/src/catalog.jl +++ b/src/catalog.jl @@ -195,6 +195,21 @@ mutable struct NestedStringListResponse NestedStringListResponse() = new(-1, C_NULL, 0, C_NULL, C_NULL, C_NULL) end +# iceberg-rust's REST catalog client infers `rest.auth.type=oauth2` whenever `token`, +# `credential`, or `oauth2-server-uri` is set and `rest.auth.type` itself isn't -- and logs a +# WARN every time it does, specifically to nudge callers into setting `rest.auth.type` +# explicitly instead of relying on inference (see `RestCatalogConfig::auth_type` in +# iceberg-catalog-rest). Since we already have the same information available here, we can +# be that explicit caller ourselves and avoid the warning entirely, rather than pushing this +# onto every caller of `catalog_create_rest`. +const _REST_OAUTH2_INFERENCE_PROPS = ("token", "credential", "oauth2-server-uri") + +function _with_inferred_rest_auth_type(properties::Dict{String,String}) + haskey(properties, "rest.auth.type") && return properties + any(k -> haskey(properties, k), _REST_OAUTH2_INFERENCE_PROPS) || return properties + return merge(properties, Dict("rest.auth.type" => "oauth2")) +end + """ catalog_create_rest( uri::String; @@ -252,6 +267,7 @@ function catalog_create_rest( end # Initialize the catalog with REST connection + properties = _with_inferred_rest_auth_type(properties) # Convert properties dict to array of PropertyEntry structs property_entries = [PropertyEntry(pointer(k), pointer(v)) for (k, v) in properties] properties_len = length(property_entries) @@ -369,6 +385,7 @@ function catalog_create_rest( end # Step 6: Initialize the catalog with REST connection + properties = _with_inferred_rest_auth_type(properties) # Convert properties dict to array of PropertyEntry structs property_entries = [PropertyEntry(pointer(k), pointer(v)) for (k, v) in properties] properties_len = length(property_entries)