apache/seatunnel · error · IllegalArgumentException

Table format cannot be null or empty

Error message

Table format cannot be null or empty

What it means

HiveFormatUtils.validateFormat rejects null or blank (empty/whitespace-only) format strings before checking supported values. The table format is a required discriminator for configuring the storage descriptor, so an absent value cannot proceed.

Source

Thrown at seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/utils/HiveFormatUtils.java:103

                return "'orc.compress'='ZLIB',\n  'created_by'='seatunnel'";
            case "TEXTFILE":
                return "'created_by'='seatunnel'";
            default:
                return "'created_by'='seatunnel'";
        }
    }

    /** Check if compression should be enabled for the format */
    public static boolean shouldEnableCompression(String format) {
        format = format.toUpperCase();
        // Enable compression for PARQUET and ORC, not for TEXTFILE by default
        return "PARQUET".equals(format) || "ORC".equals(format);
    }

    /** Validate if the format is supported */
    public static void validateFormat(String format) {
        if (format == null || format.trim().isEmpty()) {
            throw new IllegalArgumentException("Table format cannot be null or empty");
        }

        format = format.toUpperCase();
        if (!"PARQUET".equals(format) && !"ORC".equals(format) && !"TEXTFILE".equals(format)) {
            throw new IllegalArgumentException(
                    "Unsupported table format: "
                            + format
                            + ". Supported formats: PARQUET, ORC, TEXTFILE");
        }
    }
}

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Set the format explicitly in the connector config (e.g. table_format = PARQUET).
  2. Ensure the Hive table declares a standard STORED AS PARQUET/ORC/TEXTFILE so the format can be derived.
  3. Guard upstream derivation code to default to a supported format instead of passing null.
  4. Add a pre-check on user config before submitting the job.

Example fix

// before
hive.source.table-format = ""
// after
hive.source.table-format = "PARQUET"
Defensive patterns

Strategy: validation

Validate before calling

HiveFormatUtils.validateFormat(configuredFormat); // call before submitting the job
// or inline:
if (configuredFormat == null || configuredFormat.trim().isEmpty()) {
    throw new IllegalArgumentException("table_format option is required");
}

Try / catch

try {
    HiveFormatUtils.validateFormat(format);
} catch (IllegalArgumentException e) {
    LOG.error("Set table_format (PARQUET/ORC/TEXTFILE) in config", e);
    throw e;
}

Prevention

When it happens

Trigger: Calling validateFormat(null) or validateFormat("") / validateFormat(" ") — typically when the format could not be derived from the table's input format class or a config option was not set.

Common situations: Config option (e.g. table_format) omitted by the user, or a Hive table whose input format class failed to map to a canonical format name upstream.

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/e5ce61b5d57a6741. Report an issue: GitHub.