Principle:Apache Druid SQL Input Format Configuration
| Knowledge Sources | |
|---|---|
| Domains | Data_Ingestion, SQL_Ingestion |
| Last Updated | 2026-02-10 00:00 GMT |
Overview
A format refinement principle for SQL-based ingestion that confirms the data format and generates typed column declarations for the EXTERN function.
Description
SQL Input Format Configuration refines the auto-detected input format from the source selection step and generates SqlColumnDeclaration objects that define the column types for the EXTERN() function call. This step bridges the gap between raw data formats and SQL-typed columns.
The step also determines:
- The time expression (which column or expression will become __time)
- The array ingest mode (how multi-value dimensions are handled: array, mvd, or none)
- The final signature — the list of typed columns available for the SQL query
Usage
Use this principle after source selection when the format needs refinement or when column type overrides are needed. The output feeds directly into the SQL query builder that constructs the INSERT/REPLACE statement.
Theoretical Basis
Format configuration follows a type inference and declaration pattern:
SampleData + InputFormat → SqlColumnDeclaration[]
SqlColumnDeclaration = { name: string, type: SqlType }
The declarations define the schema of the EXTERN() virtual table:
EXTERN(source, format, '[{"name":"col1","type":"VARCHAR"},...]')
Time expression extraction:
If a column looks like a timestamp → timeExpression = TIME_PARSE("col")
Otherwise → user must specify the time column