/** {@inheritDoc} */ @Override public String getSQL() { StatementBuilder buff = new StatementBuilder(explain() ? "EXPLAIN \n" : ""); buff.append('(').append(left.getSQL()).append(')'); switch (unionType) { case SelectUnion.UNION_ALL: buff.append("\nUNION ALL\n"); break; case SelectUnion.UNION: buff.append("\nUNION\n"); break; case SelectUnion.INTERSECT: buff.append("\nINTERSECT\n"); break; case SelectUnion.EXCEPT: buff.append("\nEXCEPT\n"); break; default: throw new CacheException("type=" + unionType); } buff.append('(').append(right.getSQL()).append(')'); getSortLimitSQL(buff); return buff.toString(); }