```
drop table IF EXISTS numbers_indexed;
drop table IF EXISTS squares;

create table numbers_indexed Engine=MergeTree ORDER BY number PARTITION BY bitShiftRight(number,8) SETTINGS index_granularity=8 AS SELECT * FROM numbers(16384); 

CREATE VIEW squares AS WITH number*2 AS square_number SELECT number, square_number FROM numbers_indexed;

SET max_rows_to_read=8, read_overflow_mode='throw';

-- ok
WITH number*2 AS square_number SELECT number, square_number FROM numbers_indexed WHERE number = 999;

-- fail
SELECT * FROM squares WHERE number = 999;
```
const Context & context_, const TablesWithColumns & tables_with_columns_, const Settings & settings)
    : enable_optimize_predicate_expression(settings.enable_optimize_predicate_expression)
    , enable_optimize_predicate_expression_to_final_subquery(settings.enable_optimize_predicate_expression_to_final_subquery)
    , context(context_)
    , tables_with_columns(tables_with_columns_)
{
}
bool PredicateExpressionsOptimizer::optimize(ASTSelectQuery & select_query)
{
    if (!enable_optimize_predicate_expression)
        return false;
    if (select_query.having() && (!select_query.group_by_with_cube && !select_query.group_by_with_rollup && !select_query.group_by_with_totals))
        tryMovePredicatesFromHavingToWhere(select_query);
    if (!select_query.tables() || select_query.tables()->children.empty())
        return false;
    if ((!select_query.where() && !select_query.prewhere()) || select_query.arrayJoinExpressionList())
        return false;
    const auto & tables_predicates = extractTablesPredicates(select_query.where(), select_query.prewhere());
    if (!tables_predicates.empty())
        return tryRewritePredicatesToTables(select_query.refTables()->children, tables_predicates);
    return false;
}
static ASTs splitConjunctionPredicate(const std::initializer_list<const ASTPtr> & predicates)