public static SqlOpQuery makeSelectOrTable(SqlOpQuery node) { String alias = aliasGenerator.next(); SqlOpQuery result = new SqlOpQuery(node.getSchema(), node.getQueryString(), alias); return result; }
public static SqlOpSelectBlock makeSelect(SqlOpQuery node) { SqlOpQuery opQuery = makeSelectOrTable(node); SqlOpSelectBlock result = SqlOpSelectBlock.create(opQuery); for (String columnName : opQuery.getSchema().getColumnNames()) { result .getProjection() .put(columnName, new ExprVar(opQuery.getAliasName() + "." + columnName)); } return result; }