apache/seatunnel · warning
InfluxDB query returned empty results, using default column
Error message
InfluxDB query returned empty results, using default column index mapping.
What it means
InfluxDBSource.initColumnsIndex issues a metadata query against InfluxDB to map field names to column indexes; when the query returns an empty result list, the connector falls back to a default column index mapping and logs this warning. Mapping may then not match the actual measurement schema, so downstream field ordering can be wrong.
Source
Thrown at seatunnel-connectors-v2/connector-influxdb/src/main/java/org/apache/seatunnel/connectors/seatunnel/influxdb/source/InfluxDBSource.java:119
private List<Integer> initColumnsIndex(InfluxDB influxdb) {
// query one row to get column info
String sql = sourceConfig.getSql();
String query = sql + QUERY_LIMIT;
// if sql contains tz(), can't be append QUERY_LIMIT at last . see bug #4231
int start = containTzFunction(sql.toLowerCase());
if (start > 0) {
StringBuilder tmpSql = new StringBuilder(sql);
tmpSql.insert(start - 1, QUERY_LIMIT).append(" ");
query = tmpSql.toString();
}
try {
QueryResult queryResult = influxdb.query(new Query(query, sourceConfig.getDatabase()));
List<QueryResult.Result> results = queryResult.getResults();
if (CollectionUtils.isEmpty(results)) {
log.warn(
"InfluxDB query returned empty results, using default column index mapping.");
return buildDefaultColumnsIndex();
}
List<QueryResult.Series> serieList = results.get(0).getSeries();
if (CollectionUtils.isEmpty(serieList)) {
log.warn(
"InfluxDB query returned no series (empty data), using default column index mapping.");
return buildDefaultColumnsIndex();
}
List<String> fieldNames = new ArrayList<>(serieList.get(0).getColumns());
return Arrays.stream(catalogTable.getSeaTunnelRowType().getFieldNames())
.map(fieldNames::indexOf)
.collect(Collectors.toList());
} catch (Exception e) {
throw new InfluxdbConnectorException(View on GitHub (pinned to cf67b549a7)
Solutions
- Verify the source config's database and measurement/query settings point at a database that exists and has data
- Run the same query manually (via influx CLI or HTTP /query endpoint) to confirm it returns results
- Check InfluxDB connectivity (URL, port, credentials) in the SeaTunnel config
- If the default mapping is unacceptable, define the schema explicitly via the source's schema configuration instead of relying on metadata discovery
Example fix
// before url = "http://localhost:8086" database = "metrics" // does not exist // after url = "http://influxdb:8086" database = "prod_metrics" // existing database with data
Defensive patterns
Strategy: validation
Validate before calling
QueryResult qr = influxdb.query(new Query("SHOW MEASUREMENTS", database));
boolean hasData = qr.getResults() != null
&& qr.getResults().stream().anyMatch(r -> r.getSeries() != null && !r.getSeries().isEmpty());
if (!hasData) throw new IllegalStateException("InfluxDB database '" + database + "' empty or unreachable"); Prevention
- Verify database and measurement names in the source config before launching
- Pre-seed or confirm the measurement has data for the query's filters
- Run the discovery query manually via the influx CLI first
- Prefer explicit SeaTunnel schema configuration over automatic metadata discovery in prod
When it happens
Trigger: Calling columnsIndexList/initColumnsIndex where influxdb.query(new Query(query, database)) returns QueryResult with null/empty results — e.g. the database doesn't exist, the measurement has no data, the query/measurement name is wrong, or InfluxDB is unreachable in a way that yields empty results rather than an error.
Common situations: Typo in database or measurement name in source config; querying an empty database in a fresh test environment; SQL/query field misconfigured so the SHOW FIELD KEYS-style query matches nothing; wrong InfluxDB URL pointing at another instance.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
- InfluxDB query returned no series (empty data), using defaul
- TABLE_NOT_EXISTED
- GET_COLUMN_INDEX_FAILED
- UNSUPPORTED_OPERATION
- CONNECT_FAILED
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/2bf2d4e89808dc5f.
Report an issue: GitHub.