risingwavelabs/risingwave · error · iceberg::Error (ErrorKind::Unexpected)

register_table is not supported by JniCatalog

Error message

register_table is not supported by JniCatalog

What it means

JniCatalog intentionally does not implement Catalog::register_table; any call immediately returns this Unexpected error. Registering an existing metadata location under a new identifier is not wired through the JNI bridge.

Source

Thrown at src/connector/src/connector_common/iceberg/jni_catalog.rs:439

                iceberg::ErrorKind::Unexpected,
                "Failed to drop iceberg table.",
            )
            .with_source(e)
        })
    }

    async fn purge_table(&self, table: &TableIdent) -> iceberg::Result<()> {
        let table_info = self.load_table(table).await?;
        self.drop_table(table).await?;
        iceberg::drop_table_data(&table_info).await
    }

    async fn register_table(
        &self,
        _table_ident: &TableIdent,
        _metadata_location: String,
    ) -> iceberg::Result<Table> {
        Err(iceberg::Error::new(
            iceberg::ErrorKind::Unexpected,
            "register_table is not supported by JniCatalog",
        ))
    }

    /// Check if a table exists in the catalog.
    async fn table_exists(&self, table: &TableIdent) -> iceberg::Result<bool> {
        let inner = self.inner.clone();
        let table = table.clone();
        execute_blocking_jni(move || {
            execute_with_jni_env(inner.jvm, |env| {
                let table_name_str = table.to_string();

                let table_name_jstr = env.new_string(&table_name_str).unwrap();

                let exists =
                    call_method!(env, inner.java_catalog.as_obj(), {boolean tableExists(String)},
                    &table_name_jstr)

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Avoid register_table with a JniCatalog; use create_table/load_table flows instead
  2. Route register_table operations to a catalog implementation that supports it (REST/Hive/Glue/Nessie)
  3. If registration is required, extend JniCatalog with a JNI method exposing the Java catalog's registerTable and implement the trait method

Example fix

// before
let table = catalog.register_table(&ident, metadata_location).await?;
// after (choose a supported path)
let table = catalog.create_table(&ns, schema, partition, location, props).await?;
Defensive patterns

Strategy: fallback

Validate before calling

// Guard call sites: only invoke register_table on catalogs that support it
fn supports_register(catalog: &dyn Catalog) -> bool { !is_jni_catalog(catalog) }

Type guard

fn is_jni_catalog(c: &dyn Any) -> bool { c.is::<JniCatalog>() }

Try / catch

match catalog.register_table(&ident, location).await {
    Err(e) if e.message().contains("register_table is not supported") => {
        // fallback to create_table or a catalog that supports registration
    }
    other => other,
}

Prevention

When it happens

Trigger: Calling register_table on a JniCatalog handle — e.g. migrating a table by pointing an identifier at an existing metadata.json location, or code paths (recovery, re-registration) that use the generic Catalog trait against the JNI catalog.

Common situations: Framework code calling register_table as part of a generic iceberg catalog workflow while the configured catalog is a JniCatalog backend.

Related errors


AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11). Data as JSON: /api/errors/4902c24084d256e1. Report an issue: GitHub.