{"record":{"id":"4f2c0220af60e2e4","repo":"prestodb/presto","slug":"hive-unsupported-format-4f2c02","errorCode":"HIVE_UNSUPPORTED_FORMAT","errorMessage":"Attempted to build SQL for unknown S3SelectDataType","messagePattern":"Attempted to build SQL for unknown S3SelectDataType","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-hive/src/main/java/com/facebook/presto/hive/IonSqlQueryBuilder.java","lineNumber":106,"sourceCode":"        // WHERE clause\n        List<String> clauses = toConjuncts(columns, tupleDomain);\n        if (!clauses.isEmpty()) {\n            sql.append(\" WHERE \")\n                    .append(Joiner.on(\" AND \").join(clauses));\n        }\n\n        return sql.toString();\n    }\n\n    private String getFullyQualifiedColumnName(HiveColumnHandle column)\n    {\n        switch (s3SelectDataType) {\n            case CSV:\n                return format(\"s._%d\", column.getHiveColumnIndex() + 1);\n            case JSON:\n                return format(\"s.%s\", column.getName());\n            default:\n                throw new PrestoException(HIVE_UNSUPPORTED_FORMAT, \"Attempted to build SQL for unknown S3SelectDataType\");\n        }\n    }\n\n    private List<String> toConjuncts(List<HiveColumnHandle> columns, TupleDomain<HiveColumnHandle> tupleDomain)\n    {\n        Builder<String> builder = builder();\n        for (HiveColumnHandle column : columns) {\n            Type type = column.getHiveType().getType(typeManager);\n            if (tupleDomain.getDomains().isPresent() && isSupported(type)) {\n                Domain domain = tupleDomain.getDomains().get().get(column);\n                if (domain != null) {\n                    builder.add(toPredicate(domain, type, column));\n                }\n            }\n        }\n        return builder.build();\n    }\n","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-hive/src/main/java/com/facebook/presto/hive/IonSqlQueryBuilder.java#L88-L124","documentation":"IonSqlQueryBuilder builds S3 Select SQL predicates from Presto tuple domains, and column names differ per S3SelectDataType (CSV uses positional s._N, JSON uses s.fieldName). If the data type enum has no handled case (i.e. an unsupported/unmapped S3SelectDataType reaches the builder), Presto throws HIVE_UNSUPPORTED_FORMAT. It is a defensive default branch, so hitting it means the connector is being used with a data type it cannot generate SQL for.","triggerScenarios":"Reading a Hive table via the S3Select pushdown path (IonSqlQueryBuilder.getFullyQualifiedColumnName, invoked from toPredicate/column) where the configured S3SelectDataType is neither CSV nor JSON — e.g. a table format enabled for S3 Select pushdown that the builder doesn't support.","commonSituations":"Enabling S3 Select (hive.s3select-pushdown.enabled) against tables whose storage/text format maps to an unsupported S3SelectDataType; internal misconfiguration binding the wrong data type to the reader; running a Presto version where the format was added to the reader but not to SQL generation.","solutions":["Disable S3 Select pushdown for the table/session (set s3_select_pushdown_enabled=false or the connector config) so predicates are evaluated locally instead of via generated SQL.","Ensure the table's input format maps to CSV or JSON for S3 Select; convert unsupported formats (e.g. to JSON/CSV text) or use a regular Hive reader instead.","Upgrade Presto if a newer version supports the data type in IonSqlQueryBuilder.","If you control the code, add a case for the new S3SelectDataType in getFullyQualifiedColumnName."],"exampleFix":"// before: pushdown enabled on unsupported format\nSET SESSION s3_select_pushdown_enabled = true; SELECT * FROM s3_select_table WHERE col = 'x';\n\n// after: fall back to normal reads\nSET SESSION s3_select_pushdown_enabled = false; SELECT * FROM s3_select_table WHERE col = 'x';","handlingStrategy":"validation","validationCode":"-- Only enable S3 Select pushdown for CSV/JSON text tables\nSELECT \"{\"$path\"} p FROM s3_select_table LIMIT 1; -- inspect file format\nSET SESSION s3_select_pushdown_enabled = <format is csv or json>;","typeGuard":"boolean s3SelectSupported(S3SelectDataType t) {\n    return t == S3SelectDataType.CSV || t == S3SelectDataType.JSON;\n}","tryCatchPattern":"try {\n    return runQuery(sql);\n} catch (PrestoException e) {\n    if (\"HIVE_UNSUPPORTED_FORMAT\".equals(e.getErrorCode().getName())) {\n        return runQuery(sqlWithoutS3SelectPushdown);\n    }\n    throw e;\n}","preventionTips":["Enable S3 Select pushdown only on tables backed by CSV or JSON text files.","Keep connector config and table format mappings in sync when adding new formats.","Add fallback logic in clients that disables pushdown when unsupported-format errors appear."],"tags":["hive","s3-select","unsupported-format","predicate-pushdown"],"backgroundTag":"unsupported-format","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"}