/** Converts an expression "expr" into "expr AS alias". */ public static SqlNode addAlias(SqlNode expr, String alias) { final SqlParserPos pos = expr.getParserPosition(); final SqlIdentifier id = new SqlIdentifier(alias, pos); return SqlStdOperatorTable.AS.createCall(pos, expr, id); }
/** * Returns a node that can be included in the FROM clause or a JOIN. It has an alias that is * unique within the query. The alias is implicit if it can be derived using the usual rules * (For example, "SELECT * FROM emp" is equivalent to "SELECT * FROM emp AS emp".) */ public SqlNode asFrom() { if (neededAlias != null) { return SqlStdOperatorTable.AS.createCall(POS, node, new SqlIdentifier(neededAlias, POS)); } return node; }