prestodb/presto · error · PrestoException
INVALID_TABLE_PROPERTY
INVALID_TABLE_PROPERTY
Error message
Key/value types of a MAP column must be plain types
What it means
Presto's TRUNCATE TABLE statement only works on real base tables. In TruncateTableTask.execute, the metadata resolver is asked whether the target qualifiesName refers to a materialized view; if so, a SemanticException with code NOT_SUPPORTED is thrown because truncating a materialized view would invalidate its refresh semantics and is not implemented by the engine.
Source
Thrown at presto-accumulo/src/main/java/com/facebook/presto/accumulo/AccumuloClient.java:181
validateColumns(meta);
validateLocalityGroups(meta);
if (!AccumuloTableProperties.isExternal(meta.getProperties())) {
validateInternalTable(meta);
}
}
private static void validateColumns(ConnectorTableMetadata meta)
{
// Check all the column types, and throw an exception if the types of a map are complex
// While it is a rare case, this is not supported by the Accumulo connector
ImmutableSet.Builder<String> columnNameBuilder = ImmutableSet.builder();
for (ColumnMetadata column : meta.getColumns()) {
if (Types.isMapType(column.getType())) {
if (Types.isMapType(Types.getKeyType(column.getType()))
|| Types.isMapType(Types.getValueType(column.getType()))
|| Types.isArrayType(Types.getKeyType(column.getType()))
|| Types.isArrayType(Types.getValueType(column.getType()))) {
throw new PrestoException(INVALID_TABLE_PROPERTY, "Key/value types of a MAP column must be plain types");
}
}
columnNameBuilder.add(column.getName().toLowerCase(Locale.ENGLISH));
}
// Validate the columns are distinct
if (columnNameBuilder.build().size() != meta.getColumns().size()) {
throw new PrestoException(INVALID_TABLE_PROPERTY, "Duplicate column names are not supported");
}
Optional<Map<String, Pair<String, String>>> columnMapping = AccumuloTableProperties.getColumnMapping(meta.getProperties());
if (columnMapping.isPresent()) {
// Validate there are no duplicates in the column mapping
long distinctMappings = columnMapping.get().values().stream().distinct().count();
if (distinctMappings != columnMapping.get().size()) {
throw new PrestoException(INVALID_TABLE_PROPERTY, "Duplicate column family/qualifier pair detected in column mapping, check the value of " + AccumuloTableProperties.COLUMN_MAPPING);
}View on GitHub (pinned to 55bb57d202)
Solutions
- Identify the object via `SHOW CREATE TABLE <name>` or system metadata; if it is a materialized view, drop and recreate it instead of truncating.
- If the goal is a full refresh, run `REFRESH MATERIALIZED VIEW <name>` (or drop/recreate) rather than TRUNCATE.
- If you intended to truncate an underlying storage table, truncate that base table, not the materialized view that reads from it.
- If you are the connector author needing truncate support, override the view/matview rejection by routing the statement to the base table handle in your connector rather than the matview name.
Example fix
-- before
TRUNCATE TABLE analytics.daily_sales_mv;
-- after
CALL system.runtime.refresh_materialized_view('analytics', 'daily_sales_mv');
-- or: DROP MATERIALIZED VIEW analytics.daily_sales_mv; then recreate Defensive patterns
Strategy: validation
When it happens
Trigger: Running `TRUNCATE TABLE <name>` where <name> resolves to an existing materialized view (metadataResolver.isMaterializedView returns true) and the schema itself exists.
Common situations: Developers assuming materialized views can be reset like tables to force a full recompute; migration scripts that blindly truncate a list of relations; automation that iterates information_schema without distinguishing views/matviews from tables.
Related errors
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/78bb0af32b46fc58.
Report an issue: GitHub.