apache/druid · error · IAE
For a local input source, set either
Error message
For a local input source, set either %s or %s
What it means
A baseDir-based local external table used via a table function must receive at least one of: a stored filter property, a files function argument, or a filter function argument. Otherwise there is no way to select which files under baseDir to read, so convertCompletedTable throws this IAE.
Solutions
- Pass a files argument: TABLE(t, FILES => ARRAY['a.json'])
- Pass a filter argument: TABLE(t, FILTER => '*.json')
- Set a filter property on the table definition itself
Example fix
// before SELECT * FROM TABLE(localTable(FORMAT => 'json')) // after SELECT * FROM TABLE(localTable(FORMAT => 'json', FILTER => '*.json'))
Defensive patterns
Strategy: validation
Validate before calling
// Java
boolean storedFilter = hasNonEmpty(table.inputSourceMap.get("filter"));
if (!storedFilter && !hasParam(args,"files") && !hasParam(args,"filter"))
throw new IllegalArgumentException("pass FILES or FILTER to the table function"); Try / catch
try { fn.call(args); } catch (IAE e) { if (e.getMessage().contains("set either")) { args.put("filter","*.json"); fn.call(args); } else throw e; } Prevention
- baseDir alone selects nothing — always supply files or filter at some layer
- Set a default filter property on the table if the same pattern is always used
- Include file selection in SQL-generation checklists
When it happens
Trigger: Calling TABLE(baseDirTable) with no arguments where the table defines only baseDir (no filter) — no files or filter argument passed.
Common situations: Calling a table function with just format arguments and forgetting file selection; assuming the baseDir alone reads all files; older clients that predate the files/filter function parameters.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- A local input source requires one parameter of
- If a local input source sets parameter
- The local input source has a file list: do not provide…
- A local input source can set parameter
- Use a table function to set either
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/a76cfe7b9dbfe9e1.
Report an issue: GitHub.
Appendix: source
Thrown at server/src/main/java/org/apache/druid/catalog/model/table/LocalInputSourceDefn.java:227
if (hasFiles) {
if (!args.isEmpty()) {
throw new IAE("The local input source has a file list: do not provide other arguments");
}
} else {
final String baseDir = CatalogUtils.getString(sourceMap, BASE_DIR_FIELD);
if (Strings.isNullOrEmpty(baseDir)) {
throw new IAE(
"When a local external table is used with a table function, %s must be set",
BASE_DIR_FIELD
);
}
final boolean hasFilter = !Strings.isNullOrEmpty(CatalogUtils.getString(sourceMap, FILTER_FIELD));
final List<String> filesParam = CatalogUtils.getStringArray(args, FILES_PARAMETER);
final boolean hasFilesParam = !CollectionUtils.isNullOrEmpty(filesParam);
final String filterParam = CatalogUtils.getString(args, FILTER_PARAMETER);
final boolean hasFilterParam = !Strings.isNullOrEmpty(filterParam);
if (!hasFilter && !hasFilesParam && !hasFilterParam) {
throw new IAE(
"For a local input source, set either %s or %s",
FILES_PARAMETER,
FILTER_PARAMETER
);
}
if (hasFilesParam) {
// Special workaround: if the user provides a base dir, and files, convert
// the files to be absolute paths relative to the base dir. Then, remove
// the baseDir, since the Druid input source does not allow both a baseDir
// and a list of files.
sourceMap.remove(FILTER_FIELD);
sourceMap.remove(BASE_DIR_FIELD);
sourceMap.put(FILES_FIELD, absolutePath(baseDir, filesParam));
} else if (filterParam != null) {
sourceMap.put(FILTER_FIELD, filterParam);
}
}
return convertPartialFormattedTable(table, args, columns, sourceMap);View on GitHub (pinned to 9b90983fd2)