{"record":{"id":"416c11aed4523ed4","repo":"prestodb/presto","slug":"unsupported-type-416c11","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/reader/SelectiveStreamReaders.java","lineNumber":134,"sourceCode":"                return new ListSelectiveStreamReader(streamDescriptor, filters, requiredSubfields, null, 0, outputType, options, systemMemoryContext, isLowMemory);\n            case STRUCT:\n                verifyStreamType(streamDescriptor, outputType, RowType.class::isInstance);\n                return new StructSelectiveStreamReader(streamDescriptor, filters, requiredSubfields, outputType, options, systemMemoryContext, isLowMemory);\n            case MAP:\n                verifyStreamType(streamDescriptor, outputType, MapType.class::isInstance);\n                return new MapSelectiveStreamReader(streamDescriptor, filters, requiredSubfields, outputType, options, systemMemoryContext, isLowMemory);\n            case DECIMAL: {\n                verifyStreamType(streamDescriptor, outputType, DecimalType.class::isInstance);\n                if (streamDescriptor.getOrcType().getPrecision().get() <= MAX_SHORT_PRECISION) {\n                    return new ShortDecimalSelectiveStreamReader(streamDescriptor, getOptionalOnlyFilter(type, filters), outputType, systemMemoryContext.newOrcLocalMemoryContext(SelectiveStreamReaders.class.getSimpleName()));\n                }\n                else {\n                    return new LongDecimalSelectiveStreamReader(streamDescriptor, getOptionalOnlyFilter(type, filters), outputType, systemMemoryContext.newOrcLocalMemoryContext(SelectiveStreamReaders.class.getSimpleName()));\n                }\n            }\n            case UNION:\n            default:\n                throw new IllegalArgumentException(\"Unsupported type: \" + type);\n        }\n    }\n\n    private static void verifyStreamType(StreamDescriptor streamDescriptor, Optional<Type> outputType, Predicate<Type> predicate)\n    {\n        if (outputType.isPresent()) {\n            ReaderUtils.verifyStreamType(streamDescriptor, outputType.get(), predicate);\n        }\n    }\n\n    private static Optional<TupleDomainFilter> getOptionalOnlyFilter(OrcTypeKind type, Map<Subfield, TupleDomainFilter> filters)\n    {\n        if (filters.isEmpty()) {\n            return Optional.empty();\n        }\n\n        checkArgument(filters.size() == 1, format(\"Stream reader for %s doesn't support multiple range filters\", type));\n        return Optional.of(Iterables.getOnlyElement(filters.values()));","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-orc/src/main/java/com/facebook/presto/orc/reader/SelectiveStreamReaders.java#L116-L152","documentation":"SelectiveStreamReaders.createStreamReader builds selective readers per ORC type kind. UNION types have no selective reader implementation and every unrecognized kind falls into the default branch, which throws IllegalArgumentException. It means the requested type is not supported by the selective reader path.","triggerScenarios":"Calling createStreamReader for a column whose ORC type kind is UNION (or any kind not handled by an explicit case), often reached from createNestedStreamReader for nested union columns.","commonSituations":"Reading Hive/ORC tables containing uniontype columns with selective reader enabled; nested union fields under structs/maps in subfield-pruned reads.","solutions":["Avoid UNION columns or cast them to a supported type in the table definition","Rewrite the data replacing unions with structs or nullable columns","Disable the selective reader path so the column uses the legacy reader","Upgrade Presto if union support has been added"],"exampleFix":"// before\nthrow new IllegalArgumentException(\"Unsupported type: \" + type);\n// after\nif (type == UNION) { return new UnionBatchStreamReader(descriptor, ...); } // or reject earlier in planning","handlingStrategy":"validation","validationCode":"if (type == OrcTypeKind.UNION) { throw new UnsupportedTypeException(\"UNION columns are not supported by the selective reader\"); }","typeGuard":"boolean hasSelectiveReader(OrcTypeKind t) { return t != UNION && t != null; }","tryCatchPattern":"try { reader = SelectiveStreamReaders.createStreamReader(descriptor, ...); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith(\"Unsupported type\")) { reader = legacyStreamReaders.createStreamReader(descriptor, ...); } else throw e; }","preventionTips":["Avoid uniontype columns in Hive/ORC tables read by Presto","Replace unions with structs or nullable columns at write time","Set session/config flags to bypass the selective reader for union columns","Pin reader version to one that matches the data's feature set"],"tags":["orc","union-type","unsupported-type","selective-reader"],"backgroundTag":"unsupported-orc-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"}