final int distionOption = x.getDistionOption(); if (SQLSetQuantifier.ALL == distionOption) { print0(ucase ? "ALL " : "all ");
if (x.getDistionOption() == 2) { result.getMergeContext().setDistinct(true);
if (SQLSetQuantifier.ALL == x.getDistionOption()) { print0(ucase ? "ALL " : "all "); } else if (SQLSetQuantifier.DISTINCT == x.getDistionOption()) { print0(ucase ? "DISTINCT " : "distinct "); } else if (SQLSetQuantifier.DISTINCTROW == x.getDistionOption()) { print0(ucase ? "DISTINCTROW " : "distinctrow ");
rewriteDistinct = visitSelectItems(x.getSelectList(), SQLSetQuantifier.DISTINCT == x.getDistionOption());
final int distionOption = x.getDistionOption(); if (SQLSetQuantifier.ALL == distionOption) { print0(ucase ? "ALL " : "all ");
private void parseAggGroupCommon(SchemaConfig schema, SQLStatement stmt, RouteResultset rrs, MySqlSelectQueryBlock mysqlSelectQuery, TableConfig tc) throws SQLException { Map<String, String> aliaColumns = new HashMap<>(); boolean isDistinct = (mysqlSelectQuery.getDistionOption() == SQLSetQuantifier.DISTINCT) || (mysqlSelectQuery.getDistionOption() == SQLSetQuantifier.DISTINCTROW); parseAggExprCommon(schema, rrs, mysqlSelectQuery, aliaColumns, tc, isDistinct); if (rrs.isNeedOptimizer()) { tryAddLimit(schema, tc, mysqlSelectQuery); rrs.setSqlStatement(stmt); return; } // distinct change to group by if (isDistinct) { mysqlSelectQuery.setDistionOption(0); SQLSelectGroupByClause groupBy = new SQLSelectGroupByClause(); for (String fieldName : aliaColumns.keySet()) { groupBy.addItem(new SQLIdentifierExpr(fieldName)); } mysqlSelectQuery.setGroupBy(groupBy); } // setGroupByCols if (mysqlSelectQuery.getGroupBy() != null) { List<SQLExpr> groupByItems = mysqlSelectQuery.getGroupBy().getItems(); String[] groupByCols = buildGroupByCols(groupByItems, aliaColumns); rrs.setGroupByCols(groupByCols); } if (isDistinct) { rrs.changeNodeSqlAfterAddLimit(statementToString(stmt), 0, -1); } }
if (tableNode != null && (sqlSelectQuery.getDistionOption() == SQLSetQuantifier.DISTINCT || sqlSelectQuery.getDistionOption() == SQLSetQuantifier.DISTINCTROW)) { this.tableNode.setDistinct(true);
if (SQLSetQuantifier.ALL == x.getDistionOption()) { print0(ucase ? "ALL " : "all "); } else if (SQLSetQuantifier.DISTINCT == x.getDistionOption()) { print0(ucase ? "DISTINCT " : "distinct "); } else if (SQLSetQuantifier.DISTINCTROW == x.getDistionOption()) { print0(ucase ? "DISTINCTROW " : "distinctrow ");
if (SQLSetQuantifier.ALL == x.getDistionOption()) { print0(ucase ? "ALL " : "all "); } else if (SQLSetQuantifier.DISTINCT == x.getDistionOption()) { print0(ucase ? "DISTINCT " : "distinct "); } else if (SQLSetQuantifier.DISTINCTROW == x.getDistionOption()) { print0(ucase ? "DISTINCTROW " : "distinctrow ");