prestodb/presto · error · PrestoException
DRUID_SEGMENT_LOAD_ERROR
DRUID_SEGMENT_LOAD_ERROR
Error message
Internal file %s doesn't exist
What it means
Thrown when a requested internal (smoosh) column name is absent from the parsed metadata of a Druid smooshed segment. The column-to-chunk mapping (columnSmoosh) has no entry for the name, so the connector cannot locate the data inside the segment files.
Source
Thrown at presto-druid/src/main/java/com/facebook/presto/druid/segment/SmooshedColumnSource.java:62
}
@Override
public int getVersion()
{
try {
return ByteBuffer.wrap(indexFileSource.readFile(VERSION_FILE_NAME)).getInt();
}
catch (IOException e) {
throw new PrestoException(DRUID_SEGMENT_LOAD_ERROR, e);
}
}
@Override
public byte[] getColumnData(String name)
{
SmooshFileMetadata metadata = columnSmoosh.get(name);
if (metadata == null) {
throw new PrestoException(DRUID_SEGMENT_LOAD_ERROR, format("Internal file %s doesn't exist", name));
}
String fileName = makeChunkFileName(metadata.getFileCount());
int fileStart = metadata.getStartOffset();
int fileSize = metadata.getEndOffset() - fileStart;
byte[] buffer = new byte[fileSize];
try {
indexFileSource.readFile(fileName, fileStart, buffer);
}
catch (IOException e) {
throw new PrestoException(DRUID_SEGMENT_LOAD_ERROR, e);
}
return buffer;
}
private void loadSmooshFileMetadata()
{
try {View on GitHub (pinned to 55bb57d202)
Solutions
- List available columns in the segment metadata and query only existing ones
- Re-fetch/refresh segment metadata so the descriptor matches the smoosh files
- Check for Druid segment version skew; re-publish the segment
- Fix the query or column mapping to use the correct column name
Example fix
// before
SmooshFileMetadata metadata = columnSmoosh.get(name);
if (metadata == null) { throw ... }
// after (caller-side guard)
if (!availableColumns.contains(columnName)) { return Optional.empty(); } Defensive patterns
Strategy: validation
Validate before calling
// caller-side pre-check against segment metadata
Set<String> columns = columnNamesFromSegmentMetadata(segmentMetadata);
if (!columns.contains(columnName)) {
throw new PrestoException(NOT_FOUND, "Column not in segment: " + columnName);
} Type guard
function hasColumn(metadata, name) { return metadata != null && metadata.getColumns().hasOwnProperty(name); } Try / catch
try {
byte[] data = columnSource.getColumnData(name);
} catch (PrestoException e) {
if (e.getErrorCode().getName().equals("DRUID_SEGMENT_LOAD_ERROR") && e.getMessage().contains("doesn't exist")) {
return Optional.empty();
}
throw e;
} Prevention
- Always validate column names against segment metadata.json before reading
- Keep the segment descriptor and smoosh files from the same segment version
- Invalidate caches when segments are replaced or re-published
- Log the available column set when this error occurs to speed diagnosis
When it happens
Trigger: getColumnData(name) is called with a column name that does not exist in the segment's metadata.json-derived smoosh index — e.g. querying a column not present in the Druid segment or a stale schema.
Common situations: Querying columns added after the segment was published, pointing at a mismatched segment version, typos in column names, schema drift between Druid datasource and cached segment descriptors.
Related errors
- DRUID_SEGMENT_LOAD_ERROR
- DRUID_SEGMENT_LOAD_ERROR
- NOT_FOUND
- DRUID_PUSHDOWN_UNSUPPORTED_EXPRESSION
- DRUID_BROKER_RESULT_ERROR
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/d149ecb258c19fbf.
Report an issue: GitHub.