apache/seatunnel · error · IllegalArgumentException

`table_name` must not be blank when `use_regex` is enabled

Error message

`table_name` must not be blank when `use_regex` is enabled

What it means

HiveTableNamePattern.parse validates the raw `table_name` string before splitting it into database and table regex fragments. A null or whitespace-only pattern cannot yield meaningful database/table fragments, so parse rejects it immediately with this dedicated message. It duplicates the check in HiveSourceTableDiscovery as a defensive guard inside the parser itself.

Source

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

package org.apache.seatunnel.connectors.seatunnel.hive.source.config;

import java.util.Optional;

final class HiveTableNamePattern {

    private static final String DOT_PLACEHOLDER = "__$DOT$__";

    private final String databasePattern;
    private final String tablePattern;

    private HiveTableNamePattern(String databasePattern, String tablePattern) {
        this.databasePattern = databasePattern;
        this.tablePattern = tablePattern;
    }

    static HiveTableNamePattern parse(String rawPattern) {
        if (rawPattern == null || rawPattern.trim().isEmpty()) {
            throw new IllegalArgumentException(
                    "`table_name` must not be blank when `use_regex` is enabled");
        }

        String processed = rawPattern.trim().replace("\\.", DOT_PLACEHOLDER);
        Optional<Integer> separatorIndex = findTableSeparator(processed);
        if (!separatorIndex.isPresent()) {
            throw new IllegalArgumentException(
                    "Hive `table_name` must use `databasePattern.tablePattern` when `use_regex` is enabled. "
                            + "Invalid `table_name`: "
                            + processed.replace(DOT_PLACEHOLDER, "."));
        }

        int index = separatorIndex.get();
        String databasePattern = processed.substring(0, index).trim();
        String tablePattern = processed.substring(index + 1).trim();

        if (databasePattern.isEmpty() || tablePattern.isEmpty()) {
            throw new IllegalArgumentException(

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Provide a non-blank `table_name` such as "mydb.\\.*"
  2. Turn off use_regex if regex discovery is not intended
  3. Trim the configured value in upstream config generation so an all-whitespace value becomes visible/absent rather than silently invalid

Example fix

// before
table_name = "   "

// after
table_name = "mydb.\\.*"
Defensive patterns

Strategy: validation

Validate before calling

String raw = config.getOptional(HiveSourceOptions.TABLE_NAME).orElse("");
if (raw.trim().isEmpty()) {
    throw new IllegalArgumentException("table_name must not be blank when use_regex is enabled");
}

Prevention

When it happens

Trigger: Calling HiveTableNamePattern.parse(null), parse(""), or parse(" ") — reachable whenever the `table_name` option is missing or blank while use_regex is enabled.

Common situations: Same as error 1350: use_regex enabled without a table_name; whitespace-only value from a templated config; unit tests calling parse directly with null.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


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