prestodb/presto · critical · OrcCorruptionException
File has no columns
Error message
File has no columns
What it means
ORC reader error: the file's footer declares zero columns, so no data could be read. This guard fires while parsing the ORC file tail/footer — an ORC file must describe at least one column — and typically indicates a truncated, empty, or non-ORC file being read as ORC.
Source
Thrown at presto-orc/src/main/java/com/facebook/presto/orc/OrcReader.java:228
this.bufferSize = orcFileTail.getBufferSize();
this.compressionKind = orcFileTail.getCompressionKind();
this.decompressor = createOrcDecompressor(orcDataSource.getId(), compressionKind, bufferSize, orcReaderOptions.isOrcZstdJniDecompressionEnabled());
this.hiveWriterVersion = orcFileTail.getHiveWriterVersion();
try (InputStream footerInputStream = new OrcInputStream(
orcDataSource.getId(),
// Memory is not accounted as the buffer is expected to be tiny and will be immediately discarded
new SharedBuffer(NOOP_ORC_LOCAL_MEMORY_CONTEXT),
orcFileTail.getFooterSlice().getInput(),
decompressor,
Optional.empty(),
aggregatedMemoryContext,
orcFileTail.getFooterSize())) {
this.footer = metadataReader.readFooter(hiveWriterVersion, footerInputStream, dwrfEncryptionProvider, dwrfKeyProvider, orcDataSource, decompressor);
}
if (this.footer.getTypes().isEmpty()) {
throw new OrcCorruptionException(orcDataSource.getId(), "File has no columns");
}
fileIntrospector.ifPresent(introspector -> introspector.onFileFooter(footer));
Optional<DwrfEncryption> encryption = footer.getEncryption();
if (encryption.isPresent()) {
requireNonNull(dwrfEncryptionProvider, "dwrfEncryptionProvider is null");
requireNonNull(dwrfKeyProvider, "dwrfKeyProvider is null");
validateEncryption(footer, this.orcDataSource.getId());
this.dwrfEncryptionGroupMap = createNodeToGroupMap(
encryption.get().getEncryptionGroups().stream()
.map(EncryptionGroup::getNodes)
.collect(toImmutableList()),
footer.getTypes());
this.encryptionLibrary = Optional.of(dwrfEncryptionProvider.getEncryptionLibrary(encryption.get().getKeyProvider()));
this.columnsToIntermediateKeys = ImmutableMap.copyOf(dwrfKeyProvider.getIntermediateKeys(footer.getTypes()));
}
else {View on GitHub (pinned to 55bb57d202)
Solutions
- Verify the file is a valid non-empty ORC file (check magic bytes and footer size)
- Re-generate or re-copy the file from the source
- Check for truncation in transfer/storage and compare checksums
- Upgrade the writer library if it produced empty-schema files
Defensive patterns
Strategy: validation
Validate before calling
long size = fs.getContentSummary(path).getLength();
byte[] head = readFirstBytes(path, 4);
if (size < 100 || !Arrays.equals(head, new byte[]{'O','R','C'})) {
throw new InvalidInputException("Not a valid ORC file: " + path);
} Type guard
boolean looksLikeOrc(byte[] magic) {
return magic != null && magic.length >= 3 && magic[0]=='O' && magic[1]=='R' && magic[2]=='C';
} Try / catch
try (OrcReader r = new OrcReader(...)) { ... }
catch (OrcCorruptionException e) {
if (e.getMessage().contains("File has no columns")) { /* quarantine file, fail job */ }
} Prevention
- Validate file size and magic bytes before opening
- Verify checksums after transfer
- Avoid writing ORC with empty column schemas
When it happens
Trigger: OrcReader construction on a file whose footer.getTypes() is empty — e.g. a zero-byte or truncated footer, or a file written without any columns.
Common situations: Corrupted or truncated downloads, empty files mislabeled as .orc, writer bugs that emitted empty schemas, incompatible DWRF variants.
Related errors
- HIVE_CURSOR_ERROR
- Stripe encryption keys are missing, but file is encrypted
- Number of stripe encryption keys did not match number of enc
- Validation failed
- Invalid compressed stream
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/fcdbab9f566eaf77.
Report an issue: GitHub.