use of herddb.model.planner.UnionAllOp 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;
}
use of herddb.model.planner.UnionAllOp in project herddb by diennea.
the class CalcitePlanner method planEnumerableUnion.
private PlannerOp planEnumerableUnion(EnumerableUnion op, RelDataType rowType, boolean returnValues) {
if (!op.all) {
throw new StatementExecutionException("not suppoer UNION, all=false");
}
List<PlannerOp> inputs = new ArrayList<>(op.getInputs().size());
for (RelNode input : op.getInputs()) {
PlannerOp inputOp = convertRelNode(input, rowType, false, false).optimize();
inputs.add(inputOp);
}
return new UnionAllOp(inputs);
}
Aggregations