{"record":{"id":"a07d974c97ea9287","repo":"prestodb/presto","slug":"unexpected-column-type","errorCode":null,"errorMessage":"Unexpected column type ","messagePattern":"Unexpected column type ","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"presto-hive/src/main/java/com/facebook/presto/hive/FilteringPageSource.java","lineNumber":280,"sourceCode":"                return filter.testDecimal(block.getLong(position, 0), block.getLong(position, Long.BYTES));\n            }\n        }\n\n        if (isVarcharType(type) || isCharType(type)) {\n            Slice slice = block.getSlice(position, 0, block.getSliceLength(position));\n            return filter.testBytes((byte[]) slice.getBase(), (int) slice.getAddress() - ARRAY_BYTE_BASE_OFFSET, slice.length());\n        }\n\n        if (type instanceof ArrayType || type instanceof MapType || type instanceof RowType) {\n            if (IS_NULL == filter) {\n                return block.isNull(position);\n            }\n            if (IS_NOT_NULL == filter) {\n                return !block.isNull(position);\n            }\n        }\n\n        throw new UnsupportedOperationException(\"Unexpected column type \" + type);\n    }\n\n    @Override\n    public long getCompletedBytes()\n    {\n        return delegate.getCompletedBytes();\n    }\n\n    @Override\n    public long getCompletedPositions()\n    {\n        return delegate.getCompletedPositions();\n    }\n\n    @Override\n    public long getReadTimeNanos()\n    {\n        return delegate.getReadTimeNanos();","sourceCodeStart":262,"sourceCodeEnd":298,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-hive/src/main/java/com/facebook/presto/hive/FilteringPageSource.java#L262-L298","documentation":"FilteringPageSource.testNonNullPosition applies a filter to a non-null position by dispatching on the column's Type; each supported type family has its own comparison logic. When the column's Type is not one of the supported families (and the filter is not IS_NULL/IS_NOT_NULL, handled before), it throws UnsupportedOperationException 'Unexpected column type'. This indicates a filter/type combination the filtering page source does not implement.","triggerScenarios":"A predicate filter is pushed down onto a column whose Presto type (e.g. a complex type like map/array/row, or an unhandled type) has no matching branch in testNonNullPosition.","commonSituations":"Querying a Hive table with an exotic/unsupported column type combined with a WHERE predicate on that column, or a newer type added to the engine but not to this page source's filter dispatch.","solutions":["Avoid pushing the filter on the unsupported type by casting the comparison in SQL so a different code path applies, or filter in an outer query","Drop or rewrite the predicate on the unsupported column type","Upgrade Presto, as newer versions add more type support to FilteringPageSource","If the type should be supported, file/patch the missing case in testNonNullPosition"],"exampleFix":"-- before: filter directly on unsupported type\nSELECT * FROM t WHERE complex_col = 'x';\n-- after: avoid unsupported type dispatch\nSELECT * FROM t WHERE CAST(complex_col AS varchar) = 'x';","handlingStrategy":"try-catch","validationCode":"Set<TypeFamily> supported = supportedTypesForFilterPushdown();\nif (!supported.contains(columnType)) {\n    // do not push the filter; keep it in the engine\n    return noPushdown(columnType);\n}","typeGuard":"boolean filterPushdownSupported(Type type) {\n    return type instanceof BigintType || type instanceof DoubleType || type instanceof BooleanType\n        || type instanceof VarcharType || type instanceof DateType || type instanceof TimestampType;\n}","tryCatchPattern":"try {\n    pageSource.filterBlock(block);\n} catch (UnsupportedOperationException e) {\n    if (e.getMessage().startsWith(\"Unexpected column type\")) {\n        // disable filter pushdown for this column and retry with engine-side filtering\n    }\n    throw e;\n}","preventionTips":["Only push down predicates on types known to be supported by FilteringPageSource","Check the Type before building the filter","Test complex-type filters without pushdown"],"tags":["hive","page-source","filter","unsupported-type"],"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"}