prestodb/presto · error · PrestoException
HIVE_UNSUPPORTED_FORMAT
HIVE_UNSUPPORTED_FORMAT
Error message
Attempted to build SQL for unknown S3SelectDataType
What it means
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.
Source
Thrown at presto-hive/src/main/java/com/facebook/presto/hive/IonSqlQueryBuilder.java:106
// WHERE clause
List<String> clauses = toConjuncts(columns, tupleDomain);
if (!clauses.isEmpty()) {
sql.append(" WHERE ")
.append(Joiner.on(" AND ").join(clauses));
}
return sql.toString();
}
private String getFullyQualifiedColumnName(HiveColumnHandle column)
{
switch (s3SelectDataType) {
case CSV:
return format("s._%d", column.getHiveColumnIndex() + 1);
case JSON:
return format("s.%s", column.getName());
default:
throw new PrestoException(HIVE_UNSUPPORTED_FORMAT, "Attempted to build SQL for unknown S3SelectDataType");
}
}
private List<String> toConjuncts(List<HiveColumnHandle> columns, TupleDomain<HiveColumnHandle> tupleDomain)
{
Builder<String> builder = builder();
for (HiveColumnHandle column : columns) {
Type type = column.getHiveType().getType(typeManager);
if (tupleDomain.getDomains().isPresent() && isSupported(type)) {
Domain domain = tupleDomain.getDomains().get().get(column);
if (domain != null) {
builder.add(toPredicate(domain, type, column));
}
}
}
return builder.build();
}
View on GitHub (pinned to 55bb57d202)
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.
Example fix
// before: pushdown enabled on unsupported format SET SESSION s3_select_pushdown_enabled = true; SELECT * FROM s3_select_table WHERE col = 'x'; // after: fall back to normal reads SET SESSION s3_select_pushdown_enabled = false; SELECT * FROM s3_select_table WHERE col = 'x';
Defensive patterns
Strategy: validation
Validate before calling
-- Only enable S3 Select pushdown for CSV/JSON text tables
SELECT "{"$path"} p FROM s3_select_table LIMIT 1; -- inspect file format
SET SESSION s3_select_pushdown_enabled = <format is csv or json>; Type guard
boolean s3SelectSupported(S3SelectDataType t) {
return t == S3SelectDataType.CSV || t == S3SelectDataType.JSON;
} Try / catch
try {
return runQuery(sql);
} catch (PrestoException e) {
if ("HIVE_UNSUPPORTED_FORMAT".equals(e.getErrorCode().getName())) {
return runQuery(sqlWithoutS3SelectPushdown);
}
throw e;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- HIVE_UNSUPPORTED_FORMAT
- HIVE_UNSUPPORTED_FORMAT
- HIVE_UNSUPPORTED_FORMAT
- Can't handle type:
- GENERIC_INTERNAL_ERROR
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/4f2c0220af60e2e4.
Report an issue: GitHub.