prestodb/presto · error · PrestoException

JDBC_ERROR

JDBC_ERROR

Error message

Failed to find remote table name: 

What it means

PrestoException (JDBC_ERROR) thrown while resolving a requested table name to its remote (physical) ClickHouse table name. When case-sensitive name mapping is enabled, the connector consults a mapping table; if a runtime exception occurs during that lookup, it is wrapped with 'Failed to find remote table name: <msg>'. The original exception is retained as cause.

Source

Thrown at presto-clickhouse/src/main/java/com/facebook/presto/plugin/clickhouse/ClickHouseClient.java:640

                            "Please switch to using 'case-sensitive-name-matching' for proper case sensitivity behavior."));
            try {
                com.facebook.presto.plugin.clickhouse.RemoteTableNameCacheKey cacheKey = new com.facebook.presto.plugin.clickhouse.RemoteTableNameCacheKey(identity, remoteSchema);
                Map<String, String> mapping = remoteTableNames.getIfPresent(cacheKey);
                if (mapping != null && !mapping.containsKey(tableName)) {
                    // This might be a table that has just been created. Force reload.
                    mapping = null;
                }
                if (mapping == null) {
                    mapping = listTablesByLowerCase(connection, remoteSchema);
                    remoteTableNames.put(cacheKey, mapping);
                }
                String remoteTable = mapping.get(tableName);
                if (remoteTable != null) {
                    return remoteTable;
                }
            }
            catch (RuntimeException e) {
                throw new PrestoException(JDBC_ERROR, "Failed to find remote table name: " + firstNonNull(e.getMessage(), e), e);
            }
        }

        try {
            DatabaseMetaData metadata = connection.getMetaData();
            if (metadata.storesUpperCaseIdentifiers() && !caseSensitiveNameMatchingEnabled) {
                return tableName.toUpperCase(ENGLISH);
            }
            return tableName;
        }
        catch (SQLException e) {
            throw new PrestoException(JDBC_ERROR, e);
        }
    }

    public void rollbackCreateTable(ClickHouseIdentity identity, ClickHouseOutputTableHandle handle)
    {
        dropTable(identity, new ClickHouseTableHandle(

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Read the nested cause message; it says why the mapping lookup failed.
  2. Verify case-sensitive-name-matching configuration (remote mapping JNDI/schema/table settings).
  3. Confirm the mapping source is reachable and the connecting user has SELECT rights on it.
  4. If case mapping is unnecessary, disable it so resolution uses plain JDBC metadata.
  5. Check that the target table exists with exactly the configured case.

Example fix

// before (properties)
case-sensitive-name-matching=true
// after: only enable with a valid, reachable mapping source
case-sensitive-name-matching=true
case-insensitive-name-mapping.config-file=/etc/presto/mapping.json  # verified path
Defensive patterns

Strategy: validation

Validate before calling

// check config before connecting
boolean nameMatching = Boolean.parseBoolean(props.getProperty("case-sensitive-name-mapping", "false"));
if (nameMatching && props.getProperty("remote-mapping.database") == null) {
    throw new IllegalStateException("remote mapping source must be configured when name matching is on");
}

Try / catch

try {
    metadata.getTableHandle(session, tableName);
} catch (PrestoException e) {
    if (e.getMessage().startsWith("Failed to find remote table name")) {
        log.error("name-mapping lookup failed", e.getCause());
        // fall back to exact-case table name without mapping
    }
    throw e;
}

Prevention

When it happens

Trigger: case-sensitive-name-matching is enabled and the code path resolving the mapping (remote mapping lookup / query against mapping source) throws a RuntimeException before falling through to JDBC metadata resolution.

Common situations: Mapping configuration errors (bad remote mapping JDBC URL/table); permission failures reading the mapping source; typo in case-insensitive-mapping settings; mapping table missing while name matching is enabled.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/5475d857e40da4d2. Report an issue: GitHub.