apache/druid · error · IllegalArgumentException
Cannot create query type helper from invalid type
Error message
Cannot create query type helper from invalid type [%s]
What it means
SearchQueryRunner's makeColumnSelectorStrategy switch handles only STRING, LONG, FLOAT, and DOUBLE column capabilities; any other type (e.g. COMPLEX) reaches the default branch and throws IAE('Cannot create query type helper from invalid type [%s]'). It means a search was attempted on a column whose data type the search machinery cannot scan directly. Searching complex columns (e.g. nested/sketch columns) triggers it.
Solutions
- Restrict the search query's dimensions to string/long/float/double columns
- Use a virtual column or expression (e.g. JSON path expressions) to search inside complex columns
- Fix ingestion specs so the target column has a supported type, or re-ingest with the right type
Example fix
// before
{"queryType":"search","dimensions":["complexMetricColumn"]}
// after
{"queryType":"search","dimensions":["stringDimension"]} // or a nested virtual column Defensive patterns
Strategy: validation
Validate before calling
ColumnCapabilities caps = selector.getColumnCapabilities(dim); if (caps == null || !EnumSet.of(STRING, LONG, FLOAT, DOUBLE).contains(caps.getType())) { throw new IllegalArgumentException("unsupported search column: " + dim); } Type guard
boolean isSearchableType(ColumnCapabilities c) { return c != null && (c.getType() == ValueType.STRING || c.getType() == ValueType.LONG || c.getType() == ValueType.FLOAT || c.getType() == ValueType.DOUBLE); } Try / catch
try { runner.run(queryPlus, ctx); } catch (IAE e) { if (e.getMessage().contains("invalid type")) { rewriteQueryWithSupportedColumns(); } else throw e; } Prevention
- Check column types via segment metadata before issuing search queries
- Use virtual columns/expressions for complex columns
- Keep ingestion schemas aligned with the columns you search
When it happens
Trigger: Issuing a search query with dimensions referencing a COMPLEX or otherwise unsupported column type; schema changes leaving a column type unsupported by search strategies.
Common situations: Searching nested or metric (complex aggregator) columns; auto-detection assigning unexpected types during ingestion; typos hitting a complex column instead of a string dimension.
Related errors
- Unknown type[ ]
- Aggregation [ ] does not support column [ ] of type [ ]…
- Can only handle [ ], got [ ]
- Cannot create query type helper from invalid type
- Cannot handle column
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/53fb9a631f78ab07.
Report an issue: GitHub.
Appendix: source
Thrown at processing/src/main/java/org/apache/druid/query/search/SearchQueryRunner.java:85
{
@Override
public SearchColumnSelectorStrategy makeColumnSelectorStrategy(
ColumnCapabilities capabilities,
ColumnValueSelector selector,
String dimension
)
{
switch (capabilities.getType()) {
case STRING:
return new StringSearchColumnSelectorStrategy();
case LONG:
return new LongSearchColumnSelectorStrategy();
case FLOAT:
return new FloatSearchColumnSelectorStrategy();
case DOUBLE:
return new DoubleSearchColumnSelectorStrategy();
default:
throw new IAE("Cannot create query type helper from invalid type [%s]", capabilities.asTypeString());
}
}
@Override
public boolean supportsComplexTypes()
{
return false;
}
}
public interface SearchColumnSelectorStrategy<ValueSelectorType> extends ColumnSelectorStrategy
{
/**
* Read the current row from dimSelector and update the search result set.
* <p>
* For each row value:
* 1. Check if searchQuerySpec accept()s the value
* 2. If so, add the value to the result set and increment the counter for that valueView on GitHub (pinned to 9b90983fd2)