prestodb/presto · error · PrestoException
GENERIC_INTERNAL_ERROR
GENERIC_INTERNAL_ERROR
Error message
Cannot have both table and column level settings. Given: %s
What it means
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.
Source
Thrown at presto-hive/src/main/java/com/facebook/presto/hive/DwrfEncryptionMetadata.java:66
private final String encryptionProvider;
/**
* Visible only for JSON deserialization. In code use {@link this#forPerField} or {@link this#forTable} methods.
*/
@JsonCreator
public DwrfEncryptionMetadata(
@JsonProperty Map<String, byte[]> fieldToKeyData,
@JsonProperty Map<String, String> extraMetadata,
@JsonProperty String encryptionAlgorithm,
@JsonProperty String encryptionProvider)
{
this.fieldToKeyData = ImmutableMap.copyOf(requireNonNull(fieldToKeyData, "fieldToKeyData is null"));
this.extraMetadata = ImmutableMap.copyOf(requireNonNull(extraMetadata, "extraMetadata is null"));
this.encryptionAlgorithm = requireNonNull(encryptionAlgorithm, "encryptionAlgorithm is null");
this.encryptionProvider = requireNonNull(encryptionProvider, "encryptionProvider is null");
if (this.fieldToKeyData.containsKey(TABLE_IDENTIFIER) && this.fieldToKeyData.size() != 1) {
throw new PrestoException(GENERIC_INTERNAL_ERROR, format("Cannot have both table and column level settings. Given: %s", fieldToKeyData.keySet().toString()));
}
}
@JsonProperty
public Map<String, byte[]> getFieldToKeyData()
{
return fieldToKeyData;
}
@JsonProperty
public Map<String, String> getExtraMetadata()
{
return extraMetadata;
}
@JsonProperty
public String getEncryptionAlgorithm()
{View on GitHub (pinned to 55bb57d202)
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
Example fix
// before
Map<String, byte[]> keys = ImmutableMap.<String, byte[]>builder()
.put(TABLE_IDENTIFIER, tableKey)
.put("col_a", colKeyA)
.build();
new DwrfEncryptionMetadata(keys, extraMetadata, algorithm, provider);
// after
Map<String, byte[]> keys = ImmutableMap.of(TABLE_IDENTIFIER, tableKey); // table-level only
new DwrfEncryptionMetadata(keys, extraMetadata, algorithm, provider); Defensive patterns
Strategy: validation
Validate before calling
if (fieldToKeyData.containsKey(TABLE_IDENTIFIER) && fieldToKeyData.size() != 1) {
throw new IllegalArgumentException("Use either table-level or column-level encryption, not both");
}
new DwrfEncryptionMetadata(fieldToKeyData, extraMetadata, algorithm, provider); Type guard
boolean isTableLevelOnly(Map<String, byte[]> keys) {
return !keys.containsKey(TABLE_IDENTIFIER) || keys.size() == 1;
} Try / catch
try {
new DwrfEncryptionMetadata(keys, extra, algo, provider);
} catch (PrestoException e) {
if ("GENERIC_INTERNAL_ERROR".equals(e.getErrorCode().getName())) {
// log keys.keySet() and rebuild with a single encryption scope
}
throw e;
} Prevention
- Never mix TABLE_IDENTIFIER with column keys in one fieldToKeyData map
- Validate encryption scope before constructing metadata
- Generate metadata exclusively through DwrfTableEncryptionProperties helpers
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- HIVE_INVALID_ENCRYPTION_METADATA
- HIVE_INVALID_ENCRYPTION_METADATA
- HIVE_INVALID_ENCRYPTION_METADATA
- HIVE_INVALID_METADATA
- HIVE_INVALID_METADATA
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/70fff7519b4ea885.
Report an issue: GitHub.