TableRef tableRef = context.getCurrentTable();
// Short circuit out if we're compiling an index query and the index isn't active.
// We must do this after the ColumnResolver resolves the table, as we may be updating the local
// cache of the index table and it may now be inactive.
if (tableRef.getTable().getType() == PTableType.INDEX && tableRef.getTable().getIndexState() != PIndexState.ACTIVE) {
return new DegenerateQueryPlan(context, select, tableRef);
}
PTable table = tableRef.getTable();
ParseNode viewNode = SQLParser.parseCondition(table.getViewExpression());
// Push VIEW expression into select
select = SelectStatement.create(select, viewNode);