{"record":{"id":"d91408ce47d0c6e4","repo":"prestodb/presto","slug":"unsupported-type-d91408","errorCode":null,"errorMessage":"Unsupported type: ","messagePattern":"Unsupported type: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"presto-orc/src/main/java/com/facebook/presto/orc/metadata/statistics/StatisticsBuilders.java","lineNumber":61,"sourceCode":"            case LONG:\n                return IntegerStatisticsBuilder::new;\n            case FLOAT:\n            case DOUBLE:\n                return DoubleStatisticsBuilder::new;\n            case BINARY:\n                return BinaryStatisticsBuilder::new;\n            case VARCHAR:\n            case STRING:\n                int stringStatisticsLimit = columnWriterOptions.getStringStatisticsLimit();\n                return () -> new StringStatisticsBuilder(stringStatisticsLimit);\n            case TIMESTAMP:\n            case TIMESTAMP_MICROSECONDS:\n            case LIST:\n            case MAP:\n            case STRUCT:\n                return CountStatisticsBuilder::new;\n            default:\n                throw new IllegalArgumentException(\"Unsupported type: \" + orcType);\n        }\n    }\n\n    public static Map<Integer, ColumnStatistics> createEmptyColumnStatistics(List<OrcType> orcTypes, int nodeIndex, ColumnWriterOptions columnWriterOptions)\n    {\n        requireNonNull(orcTypes, \"orcTypes is null\");\n        checkArgument(nodeIndex >= 0, \"Invalid nodeIndex value: %s\", nodeIndex);\n\n        ImmutableMap.Builder<Integer, ColumnStatistics> columnStatistics = ImmutableMap.builder();\n        LinkedList<Integer> stack = new LinkedList<>();\n        stack.add(nodeIndex);\n\n        while (!stack.isEmpty()) {\n            int node = stack.removeLast();\n            OrcType orcType = orcTypes.get(node);\n            stack.addAll(orcType.getFieldTypeIndexes());\n\n            StatisticsBuilder statisticsBuilder = createStatisticsBuilderSupplier(orcType, columnWriterOptions).get();","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-orc/src/main/java/com/facebook/presto/orc/metadata/statistics/StatisticsBuilders.java#L43-L79","documentation":"StatisticsBuilders.createStatisticsBuilderSupplier() selects a column statistics builder supplier per OrcType. Types it cannot produce statistics for (falling to default) trigger IllegalArgumentException(\"Unsupported type: ...\"). It is an exhaustiveness guard during column statistics construction when writing ORC files.","triggerScenarios":"Creating a statistics builder for an OrcType whose case is missing from the switch (e.g. certain nested or newer types), invoked from statisticsBuilder during writer setup.","commonSituations":"Writing ORC files with column types lacking dedicated statistics support; forks adding new OrcType kinds without updating StatisticsBuilders; version skew after upgrades.","solutions":["Upgrade presto-orc so the type has a statistics builder mapping","Cast/replace the offending column type with one that has statistics support","Add the missing mapping in StatisticsBuilders if maintaining a fork (use CountStatisticsBuilder::new for opaque types)"],"exampleFix":"// before\nthrow new IllegalArgumentException(\"Unsupported type: \" + orcType);\n// after\ncase JSON:\ncase QUANTIZED_TOTAL_ORDER:\n    return CountStatisticsBuilder::new; // add missing mapping","handlingStrategy":"validation","validationCode":"// Verify the ORC column types have statistics builders before configuring the writer\nfor (OrcType t : orcTypes) {\n    checkArgument(SUPPORTED_STAT_TYPES.contains(t.getOrcTypeKind()), \"No statistics builder for ORC type %s\", t);\n}","typeGuard":null,"tryCatchPattern":"try {\n    supplier = StatisticsBuilders.createStatisticsBuilderSupplier(columnWriterOptions, orcType);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"Unsupported type:\")) {\n        supplier = CountStatisticsBuilder::new; // degrade to row-count-only stats\n    } else { throw e; }\n}","preventionTips":["Upgrade presto-orc before writing new OrcType kinds","Round-trip write/read tests covering every column type in the schema","Keep StatisticsBuilders switch exhaustive when forking"],"tags":["orc","statistics","unsupported-type","metadata-writer"],"backgroundTag":"unsupported-type-kind","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"}