{"record":{"id":"a38a377ae765c6ea","repo":"prestodb/presto","slug":"unsupported-type","errorCode":null,"errorMessage":"Unsupported type: ","messagePattern":"Unsupported type: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"presto-hive/src/main/java/com/facebook/presto/hive/orc/AggregatedOrcPageSource.java","lineNumber":228,"sourceCode":"                    Type definedType = hiveType.getType(typeManager);\n                    if (Decimals.isShortDecimal(definedType)) {\n                        blockBuilder.writeLong(value.unscaledValue().longValue());\n                    }\n                    else {\n                        type.writeSlice(blockBuilder, Decimals.encodeUnscaledValue(value.unscaledValue()));\n                    }\n                }\n                break;\n\n            case BYTE:\n            case BOOLEAN:\n            case BINARY:\n            case UNION:\n            case LIST:\n            case STRUCT:\n            case MAP:\n            default:\n                throw new IllegalArgumentException(\"Unsupported type: \" + orcType.getOrcTypeKind());\n        }\n    }\n\n    private void writeNonNullCount(int columnIndex, BlockBuilder blockBuilder)\n    {\n        ColumnStatistics columnStatistics = footer.getFileStats().get(columnIndex + 1);\n        if (!columnStatistics.hasNumberOfValues()) {\n            throw new UnsupportedOperationException(\"Number of values not set for orc file. Set session property hive.pushdown_partial_aggregations_into_scan=false and execute query again\");\n        }\n        blockBuilder.writeLong(columnStatistics.getNumberOfValues());\n    }\n\n    @Override\n    public long getSystemMemoryUsage()\n    {\n        return 0;\n    }\n","sourceCodeStart":210,"sourceCodeEnd":246,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-hive/src/main/java/com/facebook/presto/hive/orc/AggregatedOrcPageSource.java#L210-L246","documentation":"writeMinMax only supports scalar ORC types for pushed-down min/max aggregation; for BINARY, UNION, LIST, STRUCT, MAP (and the default branch) min/max statistics are not representable, so it throws IllegalArgumentException. The message is just the prefix 'Unsupported type: ' concatenated with the ORC type kind.","triggerScenarios":"A pushed-down partial aggregation (min/max) references a column whose ORC type kind is BINARY, UNION, LIST, STRUCT, or MAP; getNextPage -> writeMinMax hits the default switch branch.","commonSituations":"Aggregating min/max on complex columns (arrays, maps, structs, binary) against ORC with hive.pushdown_partial_aggregations_into_scan enabled; planner allows the column but the aggregated scan cannot serve it.","solutions":["Set session property hive.pushdown_partial_aggregations_into_scan=false and rerun","Restrict the aggregation to scalar columns (numeric, string, date, boolean) instead of complex types","Upgrade Presto if a newer version excludes complex types from pushdown planning"],"exampleFix":"// before\nSELECT max(tags) FROM events; // tags is array<string>\n\n// after (compute client-side or on a scalar)\nSET SESSION hive.pushdown_partial_aggregations_into_scan = false;\nSELECT max(tags) FROM events;","handlingStrategy":"validation","validationCode":"-- only push min/max onto scalar columns\nSELECT data_type FROM information_schema.columns\nWHERE table_name = 'events' AND column_name = 'tags'; -- must not be array/map/struct/binary/varbinary","typeGuard":"boolean isScalarPushdownSafe(String hiveType) {\n    return !hiveType.matches(\"(array|map|struct|binary|varbinary)(<.*\")\n        && !hiveType.equalsIgnoreCase(\"binary\");\n}","tryCatchPattern":"try {\n    return runQuery(aggSql);\n} catch (IllegalArgumentException e) {\n    if (String.valueOf(e.getMessage()).startsWith(\"Unsupported type:\")) {\n        return runQueryWithoutAggregatePushdown(aggSql);\n    }\n    throw e;\n}","preventionTips":["Aggregate only on scalar-typed columns; cast/extract complex fields first","Document which columns in a table are safe for aggregate pushdown","Keep pushdown session property off for ad-hoc analysis on denormalized/complex schemas"],"tags":["orc","hive","unsupported-type","complex-types","pushdown"],"backgroundTag":"orc-unsupported-type-pushdown","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"}