{"record":{"id":"1e6db35db20f1b16","repo":"prestodb/presto","slug":"writing-to-skewed-table-partition-is-not-supported","errorCode":null,"errorMessage":"Writing to skewed table/partition is not supported","messagePattern":"Writing to skewed table/partition is not supported","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"presto-hive-metastore/src/main/java/com/facebook/presto/hive/metastore/glue/converter/GlueInputConverter.java","lineNumber":107,"sourceCode":"        PartitionInput input = convertPartition(partitionWithStatistics.getPartition());\n        PartitionStatistics statistics = partitionWithStatistics.getStatistics();\n        return input.toBuilder().parameters(updateStatisticsParameters(input.parameters(), statistics.getBasicStatistics()))\n                .build();\n    }\n\n    public static PartitionInput convertPartition(Partition partition)\n    {\n        return PartitionInput.builder()\n                .values(partition.getValues())\n                .storageDescriptor(convertStorage(partition.getStorage(), partition.getColumns()))\n                .parameters(partition.getParameters())\n                .build();\n    }\n\n    private static StorageDescriptor convertStorage(Storage storage, List<Column> columns)\n    {\n        if (storage.isSkewed()) {\n            throw new IllegalArgumentException(\"Writing to skewed table/partition is not supported\");\n        }\n        SerDeInfo serDeInfo = SerDeInfo.builder()\n                .serializationLibrary(storage.getStorageFormat().getSerDeNullable())\n                .parameters(storage.getSerdeParameters())\n                .build();\n\n        StorageDescriptor.Builder sd = StorageDescriptor.builder()\n                .location(storage.getLocation())\n                .columns(columns.stream().map(GlueInputConverter::convertColumn).collect(toImmutableList()))\n                .serdeInfo(serDeInfo)\n                .inputFormat(storage.getStorageFormat().getInputFormatNullable())\n                .outputFormat(storage.getStorageFormat().getOutputFormatNullable())\n                .parameters(ImmutableMap.of());\n\n        Optional<HiveBucketProperty> bucketProperty = storage.getBucketProperty();\n        if (bucketProperty.isPresent()) {\n            sd.numberOfBuckets(bucketProperty.get().getBucketCount());\n            sd.bucketColumns(bucketProperty.get().getBucketedBy());","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-hive-metastore/src/main/java/com/facebook/presto/hive/metastore/glue/converter/GlueInputConverter.java#L89-L125","documentation":"GlueInputConverter.convertStorage rejects any storage definition marked skewed. Hive skew specifications have no faithful mapping into the Glue StorageDescriptor conversion used for writes, so the converter fails fast with IllegalArgumentException.","triggerScenarios":"Creating or altering a table/partition (convertTable or convertPartition -> convertStorage) whose Storage has isSkewed() true, e.g. table with SKEWED BY clause.","commonSituations":"Writing to legacy Hive tables created with SKEWED BY / STORED AS DIRECTORIES that Presto reads but refuses to write back through Glue.","solutions":["Remove the SKEWED BY specification from the table and rewrite data unskewed","Write to a different (non-skewed) table and swap via rename/partition exchange","Drop and recreate the table without skew metadata"],"exampleFix":"// before\nCREATE TABLE t (...) SKEWED BY (k) ON ('a','b');\n// after\nCREATE TABLE t (...); -- no SKEWED BY","handlingStrategy":"validation","validationCode":"if (tableProperties.containsKey(\"SKEWED\") || storage.isSkewed()) {\n    throw new IllegalArgumentException(\"Cannot write: table/partition is skewed\");\n}\n// proceed with write","typeGuard":"boolean writable = storage != null && !storage.isSkewed();","tryCatchPattern":"try {\n    metastoreResult = convertPartition(glueTable, partition, path);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"skewed\")) {\n        // redirect write to non-skewed table or fail with guidance\n    } else throw e;\n}","preventionTips":["Avoid SKEWED BY when creating tables intended for Presto writes","Audit legacy tables for skewed metadata before enabling writes","Recreate skewed tables as regular tables"],"tags":["glue","skewed-table","unsupported-write","hive"],"backgroundTag":"skewed-table-write-unsupported","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"}