prestodb/presto · error · IllegalArgumentException

Unsupported type:

Error message

Unsupported type: 

What it means

BatchStreamReaders.createStreamReader throws this IllegalArgumentException when the ORC type kind of the stream descriptor has no corresponding batch stream reader implementation (falls through the switch default, e.g. UNION). Presto's ORC reader does not support decoding that type into a block.

Source

Thrown at presto-orc/src/main/java/com/facebook/presto/orc/reader/BatchStreamReaders.java:66

            case STRING:
            case VARCHAR:
            case CHAR:
                return new SliceBatchStreamReader(type, streamDescriptor, systemMemoryContext, options.getMaxSliceSize(), options.isResetAllReaders());
            case TIMESTAMP:
            case TIMESTAMP_MICROSECONDS:
                boolean enableMicroPrecision = type == TIMESTAMP_MICROSECONDS;
                return new TimestampBatchStreamReader(type, streamDescriptor, enableMicroPrecision);
            case LIST:
                return new ListBatchStreamReader(type, streamDescriptor, options, systemMemoryContext);
            case STRUCT:
                return new StructBatchStreamReader(type, streamDescriptor, options, systemMemoryContext);
            case MAP:
                return new MapBatchStreamReader(type, streamDescriptor, options, systemMemoryContext);
            case DECIMAL:
                return new DecimalBatchStreamReader(type, streamDescriptor);
            case UNION:
            default:
                throw new IllegalArgumentException("Unsupported type: " + streamDescriptor.getOrcTypeKind());
        }
    }
}

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Remove or transform the unsupported column (e.g. UNION) in the upstream writer — explode UNION to a concrete type.
  2. Rewrite the ORC file with only supported types (struct/map/array/primitives).
  3. Upgrade Presto, as newer versions add support for more ORC types.
  4. Change the Hive table schema to exclude the unsupported column before querying.

Example fix

// before (writer side)
struct<id:int, payload:uniontype<int,string>>
// after
struct<id:int, payload:string>  -- normalize UNION to a concrete type before writing ORC
Defensive patterns

Strategy: validation

Validate before calling

// before querying, confirm no unsupported ORC types (e.g. UNION) in schema
// orc-tools meta file.orc | grep -i union

Type guard

boolean isSupportedOrcType(TypeKind kind) { return kind != TypeKind.UNION; }

Try / catch

try { reader = BatchStreamReaders.createStreamReader(...); } catch (IllegalArgumentException e) { throw new TableReadException("unsupported column type", e); }

Prevention

When it happens

Trigger: Reading an ORC file whose schema contains a type Presto's ORC reader cannot map (notably UNION types, or any kind missing from the switch) — encountered when a table/column is queried via the Hive connector.

Common situations: External pipelines (Spark/Hive jobs) writing ORC files with UNION columns that Presto tables then reference; schema drift where a column type changed in the writer but the Presto table still points at it.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/cfcdac854acb0885. Report an issue: GitHub.