{"record":{"id":"70fff7519b4ea885","repo":"prestodb/presto","slug":"generic-internal-error-70fff7","errorCode":"GENERIC_INTERNAL_ERROR","errorMessage":"Cannot have both table and column level settings. Given: %s","messagePattern":"Cannot have both table and column level settings\\. Given: (.+?)","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-hive/src/main/java/com/facebook/presto/hive/DwrfEncryptionMetadata.java","lineNumber":66,"sourceCode":"    private final String encryptionProvider;\n\n    /**\n     * Visible only for JSON deserialization. In code use {@link this#forPerField} or {@link this#forTable} methods.\n     */\n    @JsonCreator\n    public DwrfEncryptionMetadata(\n            @JsonProperty Map<String, byte[]> fieldToKeyData,\n            @JsonProperty Map<String, String> extraMetadata,\n            @JsonProperty String encryptionAlgorithm,\n            @JsonProperty String encryptionProvider)\n    {\n        this.fieldToKeyData = ImmutableMap.copyOf(requireNonNull(fieldToKeyData, \"fieldToKeyData is null\"));\n        this.extraMetadata = ImmutableMap.copyOf(requireNonNull(extraMetadata, \"extraMetadata is null\"));\n        this.encryptionAlgorithm = requireNonNull(encryptionAlgorithm, \"encryptionAlgorithm is null\");\n        this.encryptionProvider = requireNonNull(encryptionProvider, \"encryptionProvider is null\");\n\n        if (this.fieldToKeyData.containsKey(TABLE_IDENTIFIER) && this.fieldToKeyData.size() != 1) {\n            throw new PrestoException(GENERIC_INTERNAL_ERROR, format(\"Cannot have both table and column level settings. Given: %s\", fieldToKeyData.keySet().toString()));\n        }\n    }\n\n    @JsonProperty\n    public Map<String, byte[]> getFieldToKeyData()\n    {\n        return fieldToKeyData;\n    }\n\n    @JsonProperty\n    public Map<String, String> getExtraMetadata()\n    {\n        return extraMetadata;\n    }\n\n    @JsonProperty\n    public String getEncryptionAlgorithm()\n    {","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-hive/src/main/java/com/facebook/presto/hive/DwrfEncryptionMetadata.java#L48-L84","documentation":"DwrfEncryptionMetadata holds DWRF encryption settings as a map of field name to key data. A special TABLE_IDENTIFIER entry in the map means table-level encryption; any other key means column-level encryption. The library throws GENERIC_INTERNAL_ERROR when a metadata object contains both the table identifier and column keys, because the two encryption modes are mutually exclusive and such metadata can only be produced by a bug or corrupted/deserialized state.","triggerScenarios":"Constructing a DwrfEncryptionMetadata whose fieldToKeyData map contains TABLE_IDENTIFIER plus at least one column key (size != 1), e.g. when building encryption metadata from Hive properties that mix ENCRYPT_TABLE='true' with per-column entries, or when a writer merges per-column key material into table-level metadata.","commonSituations":"Malformed DWRF encryption properties on a Hive table (both table and column encryption configured), a version mismatch where the writer serialized combined metadata, or a connector bug combining key maps.","solutions":["Inspect the table's DWRF encryption properties and remove either the table-level setting or the column-level entries so only one mode is configured","Recreate the table encryption metadata using only ENCRYPT_TABLE or only ENCRYPT_COLUMNS, not both","Check that whatever code constructs DwrfEncryptionMetadata does not merge table and column keys into one map","If metadata was written by an older writer, rewrite the table with current Presto tooling"],"exampleFix":"// before\nMap<String, byte[]> keys = ImmutableMap.<String, byte[]>builder()\n    .put(TABLE_IDENTIFIER, tableKey)\n    .put(\"col_a\", colKeyA)\n    .build();\nnew DwrfEncryptionMetadata(keys, extraMetadata, algorithm, provider);\n// after\nMap<String, byte[]> keys = ImmutableMap.of(TABLE_IDENTIFIER, tableKey); // table-level only\nnew DwrfEncryptionMetadata(keys, extraMetadata, algorithm, provider);","handlingStrategy":"validation","validationCode":"if (fieldToKeyData.containsKey(TABLE_IDENTIFIER) && fieldToKeyData.size() != 1) {\n    throw new IllegalArgumentException(\"Use either table-level or column-level encryption, not both\");\n}\nnew DwrfEncryptionMetadata(fieldToKeyData, extraMetadata, algorithm, provider);","typeGuard":"boolean isTableLevelOnly(Map<String, byte[]> keys) {\n    return !keys.containsKey(TABLE_IDENTIFIER) || keys.size() == 1;\n}","tryCatchPattern":"try {\n    new DwrfEncryptionMetadata(keys, extra, algo, provider);\n} catch (PrestoException e) {\n    if (\"GENERIC_INTERNAL_ERROR\".equals(e.getErrorCode().getName())) {\n        // log keys.keySet() and rebuild with a single encryption scope\n    }\n    throw e;\n}","preventionTips":["Never mix TABLE_IDENTIFIER with column keys in one fieldToKeyData map","Validate encryption scope before constructing metadata","Generate metadata exclusively through DwrfTableEncryptionProperties helpers"],"tags":["hive","dwrf","encryption","metadata"],"backgroundTag":"conflicting-encryption-scope","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"}