{"record":{"id":"d149ecb258c19fbf","repo":"prestodb/presto","slug":"druid-segment-load-error-d149ec","errorCode":"DRUID_SEGMENT_LOAD_ERROR","errorMessage":"Internal file %s doesn't exist","messagePattern":"Internal file (.+?) doesn't exist","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-druid/src/main/java/com/facebook/presto/druid/segment/SmooshedColumnSource.java","lineNumber":62,"sourceCode":"    }\n\n    @Override\n    public int getVersion()\n    {\n        try {\n            return ByteBuffer.wrap(indexFileSource.readFile(VERSION_FILE_NAME)).getInt();\n        }\n        catch (IOException e) {\n            throw new PrestoException(DRUID_SEGMENT_LOAD_ERROR, e);\n        }\n    }\n\n    @Override\n    public byte[] getColumnData(String name)\n    {\n        SmooshFileMetadata metadata = columnSmoosh.get(name);\n        if (metadata == null) {\n            throw new PrestoException(DRUID_SEGMENT_LOAD_ERROR, format(\"Internal file %s doesn't exist\", name));\n        }\n        String fileName = makeChunkFileName(metadata.getFileCount());\n        int fileStart = metadata.getStartOffset();\n        int fileSize = metadata.getEndOffset() - fileStart;\n\n        byte[] buffer = new byte[fileSize];\n        try {\n            indexFileSource.readFile(fileName, fileStart, buffer);\n        }\n        catch (IOException e) {\n            throw new PrestoException(DRUID_SEGMENT_LOAD_ERROR, e);\n        }\n        return buffer;\n    }\n\n    private void loadSmooshFileMetadata()\n    {\n        try {","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-druid/src/main/java/com/facebook/presto/druid/segment/SmooshedColumnSource.java#L44-L80","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nSmooshFileMetadata metadata = columnSmoosh.get(name);\nif (metadata == null) { throw ... }\n// after (caller-side guard)\nif (!availableColumns.contains(columnName)) { return Optional.empty(); }","handlingStrategy":"validation","validationCode":"// caller-side pre-check against segment metadata\nSet<String> columns = columnNamesFromSegmentMetadata(segmentMetadata);\nif (!columns.contains(columnName)) {\n    throw new PrestoException(NOT_FOUND, \"Column not in segment: \" + columnName);\n}","typeGuard":"function hasColumn(metadata, name) { return metadata != null && metadata.getColumns().hasOwnProperty(name); }","tryCatchPattern":"try {\n    byte[] data = columnSource.getColumnData(name);\n} catch (PrestoException e) {\n    if (e.getErrorCode().getName().equals(\"DRUID_SEGMENT_LOAD_ERROR\") && e.getMessage().contains(\"doesn't exist\")) {\n        return Optional.empty();\n    }\n    throw e;\n}","preventionTips":["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"],"tags":["druid","segment","column","missing-file"],"backgroundTag":"column-not-found","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}