apache/seatunnel · error · IllegalArgumentException

Hive does not support schema in `table_name` when `use_regex

Error message

Hive does not support schema in `table_name` when `use_regex` is enabled. Please use `databasePattern.tablePattern` (only one unescaped '.') and escape dots in regex as '\.' (in HOCON string, write '\\.' instead). Examples: `db0.\.*`, `db1.user_table_[0-9]+`, `db[1-2].[app|web]order_\.*`. Invalid `table_name`: ${processedPattern}

What it means

`table_name` must contain exactly one unescaped dot, separating database regex from table regex. If more than one unescaped dot is found, the parser cannot decide which dot is the separator (Hive has no schema level; extra dots are usually regex that forgot escaping), so findTableSeparator throws with a detailed explanation and examples of valid patterns.

Source

Thrown at seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/source/config/HiveTableNamePattern.java:72

            throw new IllegalArgumentException(
                    "Hive `table_name` must use `databasePattern.tablePattern` when `use_regex` is enabled. "
                            + "Invalid `table_name`: "
                            + processed.replace(DOT_PLACEHOLDER, "."));
        }

        databasePattern = databasePattern.replace(DOT_PLACEHOLDER, ".");
        tablePattern = tablePattern.replace(DOT_PLACEHOLDER, ".");
        return new HiveTableNamePattern(databasePattern, tablePattern);
    }

    private static Optional<Integer> findTableSeparator(String processedPattern) {
        int firstDot = processedPattern.indexOf('.');
        if (firstDot < 0) {
            return Optional.empty();
        }
        int lastDot = processedPattern.lastIndexOf('.');
        if (firstDot != lastDot) {
            throw new IllegalArgumentException(
                    "Hive does not support schema in `table_name` when `use_regex` is enabled. "
                            + "Please use `databasePattern.tablePattern` (only one unescaped '.') and escape dots in regex as '\\.' "
                            + "(in HOCON string, write '\\\\.' instead). "
                            + "Examples: `db0.\\.*`, `db1.user_table_[0-9]+`, `db[1-2].[app|web]order_\\.*`. "
                            + "Invalid `table_name`: "
                            + processedPattern.replace(DOT_PLACEHOLDER, "."));
        }
        return Optional.of(firstDot);
    }

    String getDatabasePattern() {
        return databasePattern;
    }

    String getTablePattern() {
        return tablePattern;
    }
}

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Escape every literal dot inside the regex fragments with `\\.` (write `\\\\.` in a HOCON string), keeping exactly one unescaped separator dot: "db1.v\\.1.\\.*"
  2. Drop the schema segment — Hive only has database.table
  3. Follow the documented examples: `db0.\\.*`, `db1.user_table_[0-9]+`, `db[1-2].[app|web]order_\\.*`

Example fix

// before
table_name = "db.v1.orders" // two unescaped dots

// after
table_name = "db.v\\.1.\\.*" // separator dot unescaped, literal dots escaped
Defensive patterns

Strategy: validation

Validate before calling

int first = raw.indexOf('.');
int last = raw.lastIndexOf('.');
if (first != -1 && first != last) {
    throw new IllegalArgumentException("Only one unescaped dot allowed in table_name (escape literal dots with \\\\.)");
}

Prevention

When it happens

Trigger: HiveTableNamePattern.parse (via findTableSeparator) receives a pattern like "db.v1.orders" or "db\\.v1.orders" where escaping was missed — firstDot != lastDot among unescaped dots.

Common situations: Users coming from catalogs with schema layers (e.g. Iceberg/Trino three-part names) write db.schema.table; regex containing an unescaped literal dot such as version numbers (`db.v1.table`); HOCON escaping confusion so `\\.` becomes a real dot.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/c3bd5d1a77b703e8. Report an issue: GitHub.