apache/beam · error · ParseException

SHOW TABLES FROM/IN accepts at most a catalog name and a…

Error message

SHOW TABLES FROM/IN accepts at most a catalog name and a database name.

What it means

Apache Beam's SQL (Calcite-based) parser rejects SHOW TABLES statements whose FROM/IN clause references more than two name components. Only a catalog name plus a database name (or a single database name) is accepted; any deeper qualification has no meaning in the catalog model.

Solutions

  1. Reduce the FROM/IN qualifier to at most `catalog.database` (2 components).
  2. If you only need the current catalog, use a single database name: `SHOW TABLES FROM mydb`.
  3. Omit the clause entirely to default to the current catalog and current database.

Example fix

// before
Statement st = conn.createStatement();
st.execute("SHOW TABLES FROM project.dataset.region_tables");
// after
st.execute("SHOW TABLES FROM dataset"); // or 'FROM catalog.dataset' at most
Defensive patterns

Strategy: validation

Validate before calling

const parts = qualifier.split('.');
if (parts.length > 2) throw new Error('SHOW TABLES FROM/IN allows at most catalog.database');

Prevention

When it happens

Trigger: Executing a SQL query like `SHOW TABLES FROM catalog.db.extra` or `SHOW TABLES IN a.b.c` — i.e., a dotted identifier path with 3+ components passed to the SHOW TABLES parser rule.

Common situations: Copying SHOW TABLES syntax from MySQL/Spark (which allow fully qualified names) into Beam SQL; building the identifier programmatically from user-supplied connection strings with too many dot-separated parts.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/641cf251dba4836b. Report an issue: GitHub.

Appendix: source

Thrown at sdks/java/extensions/sql/src/main/codegen/includes/parserImpls.ftl:742

        path.add("beamsystem");
        path.add("tables");
        SqlNodeList selectList = SqlNodeList.of(SqlIdentifier.star(s.end(this)));
        SqlNode where = null;
        if (regex != null) {
            SqlIdentifier nameIdentifier = new SqlIdentifier("NAME", s.end(this));
            where = SqlStdOperatorTable.LIKE.createCall(
                s.end(this),
                nameIdentifier, regex);
        }
        if (databaseCatalog != null) {
            List<String> components = databaseCatalog.names;
            if (components.size() == 1) {
                path.add("__current_catalog__");
                path.add(components.get(0));
            } else if (components.size() == 2) {
                path.addAll(components);
            } else {
                throw new ParseException(
                    "SHOW TABLES FROM/IN accepts at most a catalog name and a database name.");
            }
        } else {
            path.add("__current_catalog__");
            path.add("__current_database__");
        }
        SqlIdentifier from = new SqlIdentifier(path, s.end(this));

        return new SqlSelect(
            s.end(this),
            null,
            selectList,
            from,
            where,
            null,
            null,
            null,
            null,

View on GitHub (pinned to 12126d8942)