apache/druid · error · IAE

An inline input source must provide one or more columns

Error message

An inline input source must provide one or more columns

What it means

InlineInputSourceDefn.validate requires an inline external table to declare at least one column. Columns define the schema against which the inline data rows are parsed. Thrown as IllegalArgumentException when the table spec's column list is null or empty.

Source

Thrown at server/src/main/java/org/apache/druid/catalog/model/table/InlineInputSourceDefn.java:83

        new Parameter(DATA_PROPERTY, ParameterType.VARCHAR_ARRAY, false)
    );
  }

  @Override
  public TableFunction partialTableFn(ResolvedExternalTable table)
  {
    return new PartialTableFunction(table, Collections.emptyList());
  }

  @Override
  public void validate(ResolvedExternalTable table)
  {
    // For inline, format is required to match the data
    if (table.inputFormatMap == null) {
      throw new IAE("An inline input source must provide a format.");
    }
    if (CollectionUtils.isNullOrEmpty(table.resolvedTable().spec().columns())) {
      throw new IAE("An inline input source must provide one or more columns");
    }

    super.validate(table);
  }

  @Override
  protected void convertArgsToSourceMap(Map<String, Object> jsonMap, Map<String, Object> args)
  {
    jsonMap.put(InputSource.TYPE_PROPERTY, InlineInputSource.TYPE_KEY);
    List<String> data = CatalogUtils.getStringArray(args, DATA_PROPERTY);

    // Would be nice, from a completeness perspective, for the inline data
    // source to allow zero rows of data. However, such is not the case.
    if (CollectionUtils.isNullOrEmpty(data)) {
      throw new IAE(
          "An inline table requires one or more rows of data in the '%s' property",
          DATA_PROPERTY
      );

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Add one or more ColumnSpec entries to the table spec
  2. If columns are inferred elsewhere, pass them explicitly to convertCompletedTable instead of relying on empty columns
  3. Check the serialized spec JSON to confirm a non-empty columns array

Example fix

// before
{"source":{"type":"inline","data":"1,x"},"format":{"type":"csv"},"columns":[]}
// after
{"source":{"type":"inline","data":"1,x"},"format":{"type":"csv"},"columns":[{"name":"n","type":"long"},{"name":"s","type":"string"}]}
Defensive patterns

Strategy: validation

Validate before calling

if (spec.getSource().getType().equals("inline")
    && (spec.getColumns() == null || spec.getColumns().isEmpty())) {
  throw new IllegalArgumentException("inline source requires at least one column");
}

Try / catch

try { defn.validate(table); } catch (IAE e) { if (e.getMessage().contains("one or more columns")) { /* add columns to spec */ } else { throw e; } }

Prevention

When it happens

Trigger: Validating an inline ResolvedExternalTable whose spec().columns() is empty or null, even if a format and data are provided.

Common situations: Defining an inline table with only data and format but no schema; programmatic spec generation that skips the columns array; UI flows where column entry was skipped.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07). Data as JSON: /api/errors/c95ca861efdfd8db. Report an issue: GitHub.