{"record":{"id":"a0a26b1e0f86c8e8","repo":"prestodb/presto","slug":"not-supported-a0a26b","errorCode":"NOT_SUPPORTED","errorMessage":"Materialized view %s must have at least one column directly defined by a base table column.","messagePattern":"Materialized view (.+?) must have at least one column directly defined by a base table column\\.","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-hive/src/main/java/com/facebook/presto/hive/HiveMaterializedViewUtils.java","lineNumber":85,"sourceCode":"     * <p>\n     * A column is directly mapped to a base table column if it is derived directly or transitively from the base table column,\n     * by only selecting a column or an aliased column without any function or operator applied.\n     * For example, with SELECT column_b AS column_a, column_a is directly mapped to column_b.\n     * With SELECT column_b + column_c AS column_a, column_a is not directly mapped to any column.\n     * <p>\n     * {@code viewToBaseColumnMap} only contains direct column mappings.\n     */\n    public static void validateMaterializedViewPartitionColumns(\n            SemiTransactionalHiveMetastore metastore,\n            MetastoreContext metastoreContext,\n            Table viewTable,\n            MaterializedViewDefinition viewDefinition)\n    {\n        SchemaTableName viewName = new SchemaTableName(viewTable.getDatabaseName(), viewTable.getTableName());\n\n        Map<String, Map<SchemaTableName, String>> viewToBaseDirectColumnMap = viewDefinition.getDirectColumnMappingsAsMap();\n        if (viewToBaseDirectColumnMap.isEmpty()) {\n            throw new PrestoException(\n                    NOT_SUPPORTED,\n                    format(\"Materialized view %s must have at least one column directly defined by a base table column.\", viewName));\n        }\n\n        List<Column> viewPartitions = viewTable.getPartitionColumns();\n        if (viewPartitions.isEmpty()) {\n            throw new PrestoException(NOT_SUPPORTED, \"Unpartitioned materialized view is not supported.\");\n        }\n\n        List<Table> baseTables = viewDefinition.getBaseTables().stream()\n                .map(baseTableName -> metastore.getTable(metastoreContext, baseTableName.getSchemaName(), baseTableName.getTableName())\n                        .orElseThrow(() -> new TableNotFoundException(baseTableName)))\n                .collect(toImmutableList());\n\n        Map<Table, List<Column>> baseTablePartitions = baseTables.stream()\n                .collect(toImmutableMap(\n                        table -> table,\n                        Table::getPartitionColumns));","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-hive/src/main/java/com/facebook/presto/hive/HiveMaterializedViewUtils.java#L67-L103","documentation":"Materialized-view validation: none of the view's partition-driving columns maps directly to a base table column (every candidate applies functions/operators), so partition-column substitution for the view is impossible.","triggerScenarios":"Thrown at presto-hive/src/main/java/com/facebook/presto/hive/HiveMaterializedViewUtils.java:85 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Redefine the view so at least one partition column is a plain (aliased) base column","Drop partitioning from the materialized view definition"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}