@Override public void accept(TableFilter f) { command.addTableFilter(f, false); } });
private Select parseValues() { Select command = new Select(session); currentSelect = command; TableFilter filter = parseValuesTable(0); ArrayList<Expression> list = New.arrayList(); list.add(new Wildcard(null, null)); command.setExpressions(list); command.addTableFilter(filter, true); command.init(); return command; }
private void parseJoinTableFilter(TableFilter top, final Select command) { top = readJoin(top); command.addTableFilter(top, true); boolean isOuter = false; while (true) { command.addTableFilter(join, false); } else { command.addTableFilter(join, true);
rightsChecked, currentSelect, 0, null); command.addTableFilter(filter, true); } else { parseSelectSimpleFromPart(command);
@Override public void accept(TableFilter f) { command.addTableFilter(f, false); } });
@Override public void accept(TableFilter f) { command.addTableFilter(f, false); } });
private void parseJoinTableFilter(TableFilter top, Select command) throws SQLException { top = readJoin(top, command, top.isJoinOuter()); command.addTableFilter(top, true); boolean isOuter = false; while (true) { TableFilter join = top.getJoin(); if (join == null) { break; } isOuter = isOuter | join.isJoinOuter(); if (isOuter) { command.addTableFilter(join, false); } else { // make flat so the optimizer can work better Expression on = join.getJoinCondition(); if (on != null) { command.addCondition(on); } join.removeJoinCondition(); top.removeJoin(); command.addTableFilter(join, true); } top = join; } }
private Select parseValues() { Select command = new Select(session); currentSelect = command; TableFilter filter = parseValuesTable(0); ArrayList<Expression> list = New.arrayList(); list.add(new Wildcard(null, null)); command.setExpressions(list); command.addTableFilter(filter, true); command.init(); return command; }
private Select parseValues() { Select command = new Select(session); currentSelect = command; TableFilter filter = parseValuesTable(0); ArrayList<Expression> list = New.arrayList(); list.add(new Wildcard(null, null)); command.setExpressions(list); command.addTableFilter(filter, true); command.init(); return command; }
private void parseJoinTableFilter(TableFilter top, final Select command) { top = readJoin(top, command, false, top.isJoinOuter()); command.addTableFilter(top, true); boolean isOuter = false; while (true) { command.addTableFilter(join, false); } else { command.addTableFilter(join, true);
private void parseJoinTableFilter(TableFilter top, final Select command) { top = readJoin(top, command, false, top.isJoinOuter()); command.addTableFilter(top, true); boolean isOuter = false; while (true) { command.addTableFilter(join, false); } else { command.addTableFilter(join, true);
public Expression optimizeInJoin(Session session, Select select) throws SQLException { if (all || compareType != Comparison.EQUAL) { return this; } if (!query.isEverything(ExpressionVisitor.EVALUATABLE)) { return this; } String alias = query.getFirstColumnAlias(session); query.setDistinct(true); if (alias == null) { return this; } TableView view = TableView.createTempView(session, session.getUser(), query); TableFilter filter = new TableFilter(session, view, view.getName(), false, select); select.addTableFilter(filter, true); ExpressionColumn column = new ExpressionColumn(session.getDatabase(), null, view.getName(), alias); Expression on = new Comparison(session, Comparison.EQUAL, left, column); on.mapColumns(filter, 0); on.createIndexConditions(session, filter); filter.addFilterCondition(on, true); return ValueExpression.get(ValueBoolean.get(true)); }
TableFilter filter = new TableFilter(session, dual, null, rightsChecked, currentSelect, 0); command.addTableFilter(filter, true); } else { parseSelectSimpleFromPart(command);
TableFilter filter = new TableFilter(session, dual, null, rightsChecked, currentSelect, 0); command.addTableFilter(filter, true); } else { parseSelectSimpleFromPart(command);
String viewName = session.getNextTempViewName(); TableFilter filter = new TableFilter(session, table, viewName, false, select); select.addTableFilter(filter, true); ExpressionColumn column = new ExpressionColumn(db, null, viewName, columnName); Comparison on = new Comparison(session, Comparison.EQUAL, left, column);
Table dual = new RangeTable(main, 1, 1); TableFilter filter = new TableFilter(session, dual, null, rightsChecked, currentSelect); command.addTableFilter(filter, true); } else { parseSelectSimpleFromPart(command);