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

  1. Verify the file is a valid non-empty ORC file (check magic bytes and footer size)
  2. Re-generate or re-copy the file from the source
  3. Check for truncation in transfer/storage and compare checksums
  4. 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

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


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/fcdbab9f566eaf77. Report an issue: GitHub.