{"record":{"id":"0eee507f52504968","repo":"prestodb/presto","slug":"columnmetadata-not-set-in-encryption-with-footer-k","errorCode":null,"errorMessage":"ColumnMetaData not set in Encryption with Footer key","messagePattern":"ColumnMetaData not set in Encryption with Footer key","errorType":"exception","errorClass":"ParquetCryptoRuntimeException","httpStatus":null,"severity":"error","filePath":"presto-parquet/src/main/java/com/facebook/presto/parquet/cache/MetadataReader.java","lineNumber":227,"sourceCode":"                    ColumnMetaData metaData = columnChunk.meta_data;\n                    ColumnCryptoMetaData cryptoMetaData = columnChunk.getCrypto_metadata();\n                    ColumnPath columnPath = null;\n                    boolean encryptedMetadata = false;\n\n                    if (null == cryptoMetaData) { // Plaintext column\n                        columnPath = getPath(metaData);\n                        if (fileDecryptor.isPresent() && !fileDecryptor.get().plaintextFile()) {\n                            // mark this column as plaintext in encrypted file decryptor\n                            fileDecryptor.get().setColumnCryptoMetadata(columnPath, false, false, (byte[]) null, columnOrdinal);\n                        }\n                    }\n                    else {  // Encrypted column\n                        if (cryptoMetaData.isSetENCRYPTION_WITH_FOOTER_KEY()) { // Column encrypted with footer key\n                            if (!encryptedFooter) {\n                                throw new ParquetCryptoRuntimeException(\"Column encrypted with footer key in file with plaintext footer\");\n                            }\n                            if (null == metaData) {\n                                throw new ParquetCryptoRuntimeException(\"ColumnMetaData not set in Encryption with Footer key\");\n                            }\n                            if (!fileDecryptor.isPresent()) {\n                                throw new ParquetCryptoRuntimeException(\"Column encrypted with footer key: No keys available\");\n                            }\n                            columnPath = getPath(metaData);\n                            fileDecryptor.get().setColumnCryptoMetadata(columnPath, true, true, (byte[]) null, columnOrdinal);\n                        }\n                        else { // Column encrypted with column key\n                            try {\n                                // TODO: We decrypted data before filter projection. This could send unnecessary traffic to KMS. This so far not seen a problem in production.\n                                // In parquet-mr, it uses lazy decryption but that required to change ColumnChunkMetadata. We will improve it later.\n                                EncryptionWithColumnKey columnKeyStruct = cryptoMetaData.getENCRYPTION_WITH_COLUMN_KEY();\n                                List<String> pathList = columnKeyStruct.getPath_in_schema();\n                                byte[] columnKeyMetadata = columnKeyStruct.getKey_metadata();\n                                columnPath = ColumnPath.get(pathList.toArray(new String[pathList.size()]));\n                                metaData = decryptMetadata(rowGroup, columnKeyMetadata, columnChunk, fileDecryptor.get(), columnOrdinal, columnPath);\n                            }\n                            catch (KeyAccessDeniedException e) {","sourceCodeStart":209,"sourceCodeEnd":245,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-parquet/src/main/java/com/facebook/presto/parquet/cache/MetadataReader.java#L209-L245","documentation":"When a column is encrypted with the footer key, the thrift EncryptionAlgorithm's metadata must carry the ColumnMetaData (the column's schema/type info) since it can't be read from the encrypted footer. This error is thrown when that ColumnMetaData field is missing, so the column path and type cannot be reconstructed.","triggerScenarios":"During convertToParquetMetadata, a column cryptoMetaData with ENCRYPTION_WITH_FOOTER_KEY is encountered and the associated metaData object is null — i.e. the writer omitted ColumnMetaData from the encrypted column metadata.","commonSituations":"Files produced by buggy or nonconformant encryption writers; truncated/corrupted Parquet files where thrift fields failed to deserialize; hand-crafted or converted files missing required encrypted-metadata structures.","solutions":["Rewrite the file with a spec-compliant encryption writer that populates ColumnMetaData for footer-key-encrypted columns","Validate the file with parquet-tools / parquet-mr metadata reader to confirm corruption","If the source is a pipeline, check for truncation or bad conversion steps upstream","Upgrade the writer library to a version with the encryption-spec bug fixed"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    readParquetMetadata(dataSource);\n} catch (ParquetCryptoRuntimeException e) {\n    if (e.getMessage().contains(\"ColumnMetaData not set\")) {\n        // file written by a nonconformant writer; mark unreadable and report\n        reportUnreadableFile(path, e);\n    } else throw e;\n}","preventionTips":["Use only encryption-spec-compliant writers","Run parquet-tools metadata validation on files produced by new/unknown pipelines","Checksum files end-to-end to detect truncation"],"tags":["parquet","encryption","corrupt-file","metadata"],"backgroundTag":"missing-column-metadata-encrypted-parquet","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"}