presto-main/src/main/java/io/prestosql/sql/rewrite/ShowStatsRewrite.java/ShowStatsRewrite/getConstraint
class ShowStatsRewrite:        private Constraint getConstraint(Plan plan)
        {
            Optional<TableScanNode> scanNode = searchFrom(plan.getRoot())
                    .where(TableScanNode.class::isInstance)
                    .findSingle();

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

            return new Constraint(metadata.getTableProperties(session, scanNode.get().getTable()).getPredicate());
        }