use of net.sf.jsqlparser.statement.select.UnionOp in project herddb by diennea.
the class JSQLParserPlanner method buildSetOperationList.
private PlannerOp buildSetOperationList(String defaultTableSpace, int maxRows, SetOperationList list, boolean forceScan) {
checkSupported(list.getFetch() == null);
checkSupported(list.getLimit() == null);
checkSupported(list.getOffset() == null);
checkSupported(list.getOrderByElements() == null);
checkSupported(list.getOperations().size() == 1);
checkSupported(list.getSelects().size() == 2);
final SetOperation operation = list.getOperations().get(0);
checkSupported(operation instanceof UnionOp);
UnionOp unionOp = (UnionOp) operation;
// only "UNION ALL"
checkSupported(unionOp.isAll());
checkSupported(!unionOp.isDistinct());
List<PlannerOp> inputs = new ArrayList<>();
for (SelectBody body : list.getSelects()) {
inputs.add(buildSelectBody(defaultTableSpace, -1, body, forceScan));
}
PlannerOp op = new UnionAllOp(inputs);
if (maxRows > 0) {
op = new LimitOp(op, new ConstantExpression(maxRows, ColumnTypes.NOTNULL_LONG), null);
}
return op;
}
Aggregations