Search in sources :

Example 1 with TableBase

use of org.h2.table.TableBase in project ignite by apache.

the class GridSqlQueryParser method parseTable.

/**
     * @param tbl Table.
     */
private GridSqlElement parseTable(Table tbl) {
    GridSqlElement res = (GridSqlElement) h2ObjToGridObj.get(tbl);
    if (res == null) {
        // Table here is semantically equivalent to a table filter.
        if (tbl instanceof TableBase)
            return new GridSqlTable(tbl);
        // different table filters anyways. Thus the semantics will be correct.
        if (tbl instanceof TableView) {
            Query qry = VIEW_QUERY.get((TableView) tbl);
            res = new GridSqlSubquery(parseQuery(qry));
        } else if (tbl instanceof FunctionTable)
            res = parseExpression(FUNC_EXPR.get((FunctionTable) tbl), false);
        else if (tbl instanceof RangeTable) {
            res = new GridSqlFunction(GridSqlFunctionType.SYSTEM_RANGE);
            res.addChild(parseExpression(RANGE_MIN.get((RangeTable) tbl), false));
            res.addChild(parseExpression(RANGE_MAX.get((RangeTable) tbl), false));
        } else
            assert0(false, "Unexpected Table implementation [cls=" + tbl.getClass().getSimpleName() + ']');
        h2ObjToGridObj.put(tbl, res);
    }
    return res;
}
Also used : Query(org.h2.command.dml.Query) FunctionTable(org.h2.table.FunctionTable) TableBase(org.h2.table.TableBase) TableView(org.h2.table.TableView) RangeTable(org.h2.table.RangeTable)

Aggregations

Query (org.h2.command.dml.Query)1 FunctionTable (org.h2.table.FunctionTable)1 RangeTable (org.h2.table.RangeTable)1 TableBase (org.h2.table.TableBase)1 TableView (org.h2.table.TableView)1