{"record":{"id":"02308488e8029dbc","repo":"apache/druid","slug":"cannot-have-a-null-empty-columns-s-name-s","errorCode":null,"errorMessage":"Cannot have a null/empty columns[%s], name[%s]","messagePattern":"Cannot have a null/empty columns\\[(.+?)\\], name\\[(.+?)\\]","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"processing/src/main/java/org/apache/druid/segment/virtual/FallbackVirtualColumn.java","lineNumber":72,"sourceCode":" * If you are using this virtual column and want to have a decorator/extraction function on your DimensionSpec,\n * it is expected that you will put it on the specs in the list rather than on the spec that references this\n * virtual column.  That is, when this virtual column resolves a dimension, it ignores the decoration from the\n * spec that it was given and instead uses the spec as defined in the list as-is to delegate to the column that\n * it chose.\n */\npublic class FallbackVirtualColumn implements VirtualColumn\n{\n  private final String name;\n  private final ArrayList<DimensionSpec> columns;\n\n  @JsonCreator\n  public FallbackVirtualColumn(\n      @JsonProperty(\"name\") String name,\n      @JsonProperty(\"columns\") ArrayList<DimensionSpec> columns\n  )\n  {\n    if (columns == null || columns.isEmpty()) {\n      throw new IAE(\"Cannot have a null/empty columns[%s], name[%s]\", columns, name);\n    }\n\n    this.name = name;\n    this.columns = columns;\n  }\n\n  @JsonProperty(\"name\")\n  @Override\n  public String getOutputName()\n  {\n    return name;\n  }\n\n  @JsonProperty(\"columns\")\n  public ArrayList<DimensionSpec> getColumns()\n  {\n    return columns;\n  }","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/segment/virtual/FallbackVirtualColumn.java#L54-L90","documentation":"FallbackVirtualColumn delegates queries across a list of underlying columns and therefore requires at least one column. Constructing it with a null or empty column list throws IAE at construction/deserialization time to fail fast on a useless virtual column definition.","triggerScenarios":"Registering a fallback virtual column via query context ('useFallback': true, virtualColumns config) with an empty list; JSON deserialization of a spec missing the 'columns' field; programmatically calling the constructor with an empty ArrayList.","commonSituations":"Hand-written JSON specs where 'columns' was omitted or left empty; programmatic spec generation that produced no dimension specs; copy/paste of a virtual-column definition stripped of columns.","solutions":["Provide at least one entry in the 'columns' array of the virtual column definition","Fix spec generation code so it always emits the underlying dimension specs","If the intent is 'no columns', remove the virtual column registration entirely instead of passing an empty list"],"exampleFix":"// before\nnew FallbackVirtualColumn(\"vc\", new ArrayList<>());\n// after\nnew FallbackVirtualColumn(\"vc\", new ArrayList<>(List.of(DefaultDimensionSpec.of(\"realCol\"))));","handlingStrategy":"validation","validationCode":"if (columns == null || columns.isEmpty()) {\n  throw new IllegalArgumentException(\"FallbackVirtualColumn needs >=1 column\");\n}","typeGuard":"boolean valid = columns != null && !columns.isEmpty();","tryCatchPattern":"try { new FallbackVirtualColumn(name, cols); } catch (IllegalArgumentException e) { /* fix spec before registering */ }","preventionTips":["Validate virtual-column JSON specs before submitting ingestion/query","Ensure spec generators always emit at least one underlying dimension spec","Remove unused virtual column registrations instead of shipping empty ones"],"tags":["virtual-column","validation","config","illegal-argument"],"backgroundTag":"empty-required-field","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}