{"record":{"id":"531f6f2ae19c2b9a","repo":"prestodb/presto","slug":"unsupported-type-s","errorCode":null,"errorMessage":"unsupported type: %s","messagePattern":"unsupported type: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"presto-hive-metastore/src/main/java/com/facebook/presto/hive/metastore/thrift/ThriftMetastoreUtil.java","lineNumber":785,"sourceCode":"            case LONG:\n                return createLongStatistics(columnName, columnType, statistics);\n            case FLOAT:\n            case DOUBLE:\n                return createDoubleStatistics(columnName, columnType, statistics);\n            case STRING:\n            case VARCHAR:\n            case CHAR:\n                return createStringStatistics(columnName, columnType, statistics, rowCount);\n            case DATE:\n                return createDateStatistics(columnName, columnType, statistics);\n            case TIMESTAMP:\n                return createLongStatistics(columnName, columnType, statistics);\n            case BINARY:\n                return createBinaryStatistics(columnName, columnType, statistics, rowCount);\n            case DECIMAL:\n                return createDecimalStatistics(columnName, columnType, statistics);\n            default:\n                throw new IllegalArgumentException(format(\"unsupported type: %s\", columnType));\n        }\n    }\n\n    private static ColumnStatisticsObj createBooleanStatistics(String columnName, HiveType columnType, HiveColumnStatistics statistics)\n    {\n        BooleanColumnStatsData data = new BooleanColumnStatsData();\n        statistics.getNullsCount().ifPresent(data::setNumNulls);\n        statistics.getBooleanStatistics().ifPresent(booleanStatistics -> {\n            booleanStatistics.getFalseCount().ifPresent(data::setNumFalses);\n            booleanStatistics.getTrueCount().ifPresent(data::setNumTrues);\n        });\n        return new ColumnStatisticsObj(columnName, columnType.toString(), booleanStats(data));\n    }\n\n    private static ColumnStatisticsObj createLongStatistics(String columnName, HiveType columnType, HiveColumnStatistics statistics)\n    {\n        LongColumnStatsData data = new LongColumnStatsData();\n        statistics.getIntegerStatistics().ifPresent(integerStatistics -> {","sourceCodeStart":767,"sourceCodeEnd":803,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-hive-metastore/src/main/java/com/facebook/presto/hive/metastore/thrift/ThriftMetastoreUtil.java#L767-L803","documentation":"createMetastoreColumnStatistics converts Presto HiveColumnStatistics back into a Metastore ColumnStatisticsObj. It switches on the Hive type's TypeEnum; types not covered by createBooleanStatistics/…/createDecimalStatistics (e.g. LIST, MAP, STRUCT, UNIONTYPE — complex/nested types) reach the default branch and throw IllegalArgumentException. Presto cannot represent column statistics for complex Hive types in the Metastore statistics API.","triggerScenarios":"Running ANALYZE (or any code path that publishes column statistics) on a column of a complex/nested type (array, map, struct) whose HiveType falls outside the primitive switch at ThriftMetastoreUtil.java:785.","commonSituations":"ANALYZE TABLE ... COMPUTE STATISTICS FOR COLUMNS on tables with array/map/struct columns; connectors that blindly publish stats for every column including nested ones.","solutions":["Exclude complex-type columns from ANALYZE statistics collection (analyze only primitive columns)","Skip statistics publication for non-primitive columns in the calling code before invoking createMetastoreColumnStatistics","Upgrade Presto if support for the type has since been added"],"exampleFix":"// before: publish stats for every column\nfor (Column col : columns) {\n    stats.add(createMetastoreColumnStatistics(col.getName(), col.getType(), ...));\n}\n// after: only primitive types\nif (col.getType().getTypeInfo().getPrimitiveTypeName() == null) continue; // or a primitive-type whitelist\nstats.add(createMetastoreColumnStatistics(col.getName(), col.getType(), ...));","handlingStrategy":"validation","validationCode":"// only publish stats for primitive Hive types\nif (!(columnType.getTypeInfo() instanceof PrimitiveTypeInfo)) {\n    log.debug(\"Skipping stats publication for complex type %s\", columnType);\n    return;\n}","typeGuard":"boolean isPrimitiveHiveType(HiveType t) {\n    return t != null && t.getTypeInfo() instanceof PrimitiveTypeInfo;\n}","tryCatchPattern":"try {\n    obj = ThriftMetastoreUtil.createMetastoreColumnStatistics(name, type, stats, rowCount);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"unsupported type\")) {\n        log.debug(\"No metastore stats support for %s\", type);\n        return null; // omit this column's stats\n    }\n    throw e;\n}","preventionTips":["Restrict ANALYZE column lists to primitive columns","Skip complex-type columns in stats-collection code paths","Keep Presto updated for extended stats type coverage"],"tags":["hive","column-statistics","complex-types","analyze"],"backgroundTag":"unsupported-column-type","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"}