prestodb/presto · error · SemanticException

NOT_SUPPORTED

NOT_SUPPORTED

Error message

Only predicates that can be pushed down are supported in the SHOW STATS WHERE clause

What it means

Show-stats rewrite error: the WHERE clause of SHOW STATS FOR ... WHERE contains a predicate that cannot be pushed down to the connector as a TupleDomain. Only simple pushdown-able predicates on the stats columns are supported; complex expressions are rejected by this guard in the rewrite.

Source

Thrown at presto-main-base/src/main/java/com/facebook/presto/sql/rewrite/ShowStatsRewrite.java:242

                    .map(ColumnMetadata::getName)
                    .map(columnHandles::get)
                    .filter(Objects::nonNull)
                    .collect(Collectors.toList()));
            TableStatistics tableStatistics = metadata.getTableStatistics(session, tableHandle, nonHiddenColumns, constraint);
            List<String> statsColumnNames = buildColumnsNames();
            List<SelectItem> selectItems = buildSelectItems(statsColumnNames);
            List<Expression> resultRows = buildStatisticsRows(tableMetadata, columnHandles, tableStatistics);

            return simpleQuery(selectAll(selectItems),
                    aliased(new Values(resultRows),
                            "table_stats_for_" + table.getName(),
                            statsColumnNames));
        }

        private static void check(boolean condition, ShowStats node, String message)
        {
            if (!condition) {
                throw new SemanticException(NOT_SUPPORTED, node, message);
            }
        }

        @Override
        protected Node visitNode(Node node, Void context)
        {
            return node;
        }

        private Constraint<ColumnHandle> getConstraint(Plan plan)
        {
            Optional<TableScanNode> scanNode = searchFrom(plan.getRoot())
                    .where(TableScanNode.class::isInstance)
                    .findSingle();

            if (!scanNode.isPresent()) {
                return Constraint.alwaysFalse();
            }

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Simplify the WHERE clause to basic comparisons on stats columns
  2. Move complex filtering to a wrapper query over SHOW STATS output
  3. Reference only supported stats columns (e.g. column_name, data_size)
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at presto-main-base/src/main/java/com/facebook/presto/sql/rewrite/ShowStatsRewrite.java:242 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class

Background: Presto NOT_SUPPORTED error: what "not supported" means and how to fix it — this error's family across 3 libraries.


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