apache/druid · error · IllegalArgumentException
No such virtual column
Error message
No such virtual column[%s]
What it means
VirtualColumns throws IAE when a selector requests a virtual column by name that does not exist in the VirtualColumns instance. It is a lookup failure: getVirtualColumn returned null for the requested columnName, meaning no virtual column with that name was configured.
Solutions
- Verify the column name is exactly the virtual column alias defined in the query/virtualColumns list (case-sensitive)
- Add or correct the virtual column definition in the query's virtualColumns block so the name exists
- If the column should be a regular column, remove it from the virtual-columns reference and use it directly
Example fix
// before
VirtualColumns.of("concat_expr") // referenced as "concat" in the filter
// after
// reference the alias exactly: filters on "concat_expr" or define the virtual column with the alias used in the query Defensive patterns
Strategy: validation
Validate before calling
if (!knownVirtualColumnNames.contains(columnName)) { throw new IllegalArgumentException("Unknown virtual column: " + columnName); }
VirtualColumns.of(...).getVirtualColumnForSelector(columnName); Try / catch
try { VirtualColumn vc = virtualColumns.virtualColumnForSelector(name); } catch (IAE e) { /* fall back to regular column lookup */ } Prevention
- Keep a registry of defined virtual column aliases and validate query references against it
- Unit-test query specs against the exact VirtualColumns instance
- Avoid hand-typed column names; derive them from shared constants
When it happens
Trigger: Calling VirtualColumns.getVirtualColumnForSelector(columnName) (directly or via virtualColumn(...)) with a name that is not a registered virtualized column.
Common situations: Typo in the column name in a Druid query or ingestion spec; referencing a virtual column expression by its alias before it is defined; query referencing a column removed between query versions; SQL planner passing a name that only exists in a different VirtualColumns scope.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- No such sink
- Self-referential column
- A-Not-B requires at least 1 sketch
- Access-Check-Result
- Action [ ] failed for worker [ ] with status ( )
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/ee63dc62b7f6e06d.
Report an issue: GitHub.
Appendix: source
Thrown at processing/src/main/java/org/apache/druid/segment/VirtualColumns.java:553
// id doesn't matter as there is only one kind of "VirtualColumns", so use 0.
return new CacheKeyBuilder((byte) 0).appendCacheablesIgnoringOrder(virtualColumns).build();
}
public boolean isEmpty()
{
return virtualColumns.isEmpty();
}
public List<String> getColumnNames()
{
return virtualColumnNames;
}
private VirtualColumn getVirtualColumnForSelector(String columnName)
{
VirtualColumn virtualColumn = getVirtualColumn(columnName);
if (virtualColumn == null) {
throw new IAE("No such virtual column[%s]", columnName);
}
return virtualColumn;
}
/**
* Detects cycles in the dependencies of a {@link VirtualColumn}.
*
* @param virtualColumn virtual column to check
* @param visited null on initial call. Internally, this method operates recursively, and uses this parameter
* to pass down the list of already-visited columns.
*/
private void detectCycles(VirtualColumn virtualColumn, @Nullable Set<String> visited)
{
// Copy "visited" to avoid modifying it
final Set<String> visitedCopy = visited == null
? Sets.newHashSet(virtualColumn.getOutputName())
: Sets.newHashSet(visited);
View on GitHub (pinned to 9b90983fd2)