提交 8bf0e51d 编写于 作者: L Liang Zhang 提交者: Zonglei Dong

Add more assertion for group by (#4080)

* Add more assertion for group by column item

* add assertOrderInfo

* Add more assertion for group by

* fix test case select_distinct_with_count_group_by

* fix test case select_distinct_with_single_count_group_by

* fix test case select_group_by_with_avg

* fix test case select_group_by_with_count

* fix test case select_group_by_with_count_without_column_name

* fix test case select_group_by_with_date_function

* fix test case select_group_by_with_date_function

* add index assertion

* fix test case for select_group_by_with_keyword_alias

* fix test case for select_group_by_with_limit

* fix test case for select_group_by_with_max

* fix test case for select_group_by_with_min

* fix test case for select_group_by_with_order_by_and_limit

* fix test case for select_group_by_with_order_by_desc

* fix test case for select_group_by_with_sum

* fix test case for select_group_by_without_grouped_column

* fix test case for select_pagination_with_group_by_and_order_by

* fix test case for select_pagination_with_row_number_and_diff_group_by_and_order_by

* fix test case for select_pagination_with_row_number_and_group_by_and_order_by

* fix test case for select_pagination_with_top_and_diff_group_by_and_order_by

* fix test case for select_pagination_with_top_and_group_by_and_order_by

* fix test case for select_with_item_alias_match_order_by_and_group_by_items
上级 bc7ad21a
......@@ -81,7 +81,7 @@ public final class SQLStatementAssert {
private static void assertSelectStatement(final SQLStatementAssertMessage assertMessage, final SelectStatement actual, final ParserResult expected, final SQLCaseType sqlCaseType) {
ProjectionAssert.assertIs(assertMessage, actual.getProjections(), expected.getProjections(), sqlCaseType);
assertWhere(assertMessage, actual, expected, sqlCaseType);
assertGroupBy(assertMessage, actual, expected);
assertGroupBy(assertMessage, actual, expected, sqlCaseType);
assertOrderBy(assertMessage, actual, expected);
assertLimit(assertMessage, actual, expected, sqlCaseType);
}
......@@ -95,10 +95,10 @@ public final class SQLStatementAssert {
}
}
private static void assertGroupBy(final SQLStatementAssertMessage assertMessage, final SelectStatement actual, final ParserResult expected) {
if (!expected.getGroupByColumns().isEmpty()) {
private static void assertGroupBy(final SQLStatementAssertMessage assertMessage, final SelectStatement actual, final ParserResult expected, final SQLCaseType sqlCaseType) {
if (null != expected.getGroupBy()) {
assertTrue(assertMessage.getText("Actual group by segment should exist."), actual.getGroupBy().isPresent());
GroupByAssert.assertIs(assertMessage, actual.getGroupBy().get().getGroupByItems(), expected.getGroupByColumns());
GroupByAssert.assertIs(assertMessage, actual.getGroupBy().get(), expected.getGroupBy(), sqlCaseType);
} else {
assertFalse(assertMessage.getText("Actual group by segment should not exist."), actual.getGroupBy().isPresent());
}
......
......@@ -20,15 +20,24 @@ package org.apache.shardingsphere.sql.parser.integrate.asserts.groupby;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.shardingsphere.sql.parser.integrate.asserts.SQLStatementAssertMessage;
import org.apache.shardingsphere.sql.parser.integrate.jaxb.impl.groupby.ExpectedGroupByColumn;
import org.apache.shardingsphere.sql.parser.integrate.jaxb.impl.groupby.ExpectedGroupBy;
import org.apache.shardingsphere.sql.parser.integrate.jaxb.impl.orderby.ExpectedColumnOrderByItem;
import org.apache.shardingsphere.sql.parser.integrate.jaxb.impl.orderby.ExpectedExpressionOrderByItem;
import org.apache.shardingsphere.sql.parser.integrate.jaxb.impl.orderby.ExpectedIndexOrderByItem;
import org.apache.shardingsphere.sql.parser.integrate.jaxb.impl.orderby.ExpectedOrderByItem;
import org.apache.shardingsphere.sql.parser.integrate.jaxb.impl.owner.ExpectedTableOwner;
import org.apache.shardingsphere.sql.parser.sql.segment.dml.order.GroupBySegment;
import org.apache.shardingsphere.sql.parser.sql.segment.dml.order.item.ColumnOrderByItemSegment;
import org.apache.shardingsphere.sql.parser.sql.segment.dml.order.item.ExpressionOrderByItemSegment;
import org.apache.shardingsphere.sql.parser.sql.segment.dml.order.item.IndexOrderByItemSegment;
import org.apache.shardingsphere.sql.parser.sql.segment.dml.order.item.OrderByItemSegment;
import java.util.Collection;
import java.util.List;
import org.apache.shardingsphere.sql.parser.sql.segment.generic.TableSegment;
import org.apache.shardingsphere.test.sql.SQLCaseType;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
/**
* Group by assert.
......@@ -39,28 +48,77 @@ import static org.junit.Assert.assertThat;
public final class GroupByAssert {
/**
* Assert actual group by item segments is correct with expected group by columns.
* Assert actual group by segment is correct with expected group by.
*
* @param assertMessage assert message
* @param actual actual group by items
* @param expected expected group by items
* @param actual actual group by segment
* @param expected expected group by
* @param sqlCaseType SQL case type
*/
public static void assertIs(final SQLStatementAssertMessage assertMessage, final Collection<OrderByItemSegment> actual, final List<ExpectedGroupByColumn> expected) {
assertThat(assertMessage.getText("Group by items size error: "), actual.size(), is(expected.size()));
public static void assertIs(final SQLStatementAssertMessage assertMessage, final GroupBySegment actual, final ExpectedGroupBy expected, final SQLCaseType sqlCaseType) {
assertThat(assertMessage.getText("Group by items size assertion error: "), actual.getGroupByItems().size(), is(expected.getItemSize()));
int count = 0;
for (OrderByItemSegment each : actual) {
for (OrderByItemSegment each : actual.getGroupByItems()) {
if (each instanceof ColumnOrderByItemSegment) {
assertGroupByItem(assertMessage, (ColumnOrderByItemSegment) each, expected.get(count));
assertOrderInfo(assertMessage, each, expected.getColumnItems().get(count));
assertColumnGroupByItem(assertMessage, (ColumnOrderByItemSegment) each, expected.getColumnItems().get(count), sqlCaseType);
count++;
}
}
for (OrderByItemSegment each : actual.getGroupByItems()) {
if (each instanceof IndexOrderByItemSegment) {
assertOrderInfo(assertMessage, each, expected.getIndexItems().get(count));
assertIndexGroupByItem(assertMessage, (IndexOrderByItemSegment) each, expected.getIndexItems().get(count), sqlCaseType);
count++;
}
count++;
}
for (OrderByItemSegment each : actual.getGroupByItems()) {
if (each instanceof ExpressionOrderByItemSegment) {
assertOrderInfo(assertMessage, each, expected.getExpressionItems().get(count));
assertExpressionGroupByItem(assertMessage, (ExpressionOrderByItemSegment) each, expected.getExpressionItems().get(count), sqlCaseType);
count++;
}
}
// TODO assert start index and stop index
// SQLSegmentAssert.assertIs(assertMessage, actual, expected, sqlCaseType);
}
private static void assertGroupByItem(final SQLStatementAssertMessage assertMessage, final ColumnOrderByItemSegment actual, final ExpectedGroupByColumn expected) {
assertThat(assertMessage.getText("Group by item owner assertion error: "),
actual.getColumn().getOwner().isPresent() ? actual.getColumn().getOwner().get().getTableName() : null, is(expected.getOwner()));
assertThat(assertMessage.getText("Group by item name assertion error: "), actual.getColumn().getName(), is(expected.getName()));
private static void assertOrderInfo(final SQLStatementAssertMessage assertMessage, final OrderByItemSegment actual, final ExpectedOrderByItem expected) {
assertThat(assertMessage.getText("Group by item order direction assertion error: "), actual.getOrderDirection().name(), is(expected.getOrderDirection()));
// TODO assert nullOrderDirection
}
private static void assertColumnGroupByItem(final SQLStatementAssertMessage assertMessage,
final ColumnOrderByItemSegment actual, final ExpectedColumnOrderByItem expected, final SQLCaseType sqlCaseType) {
assertThat(assertMessage.getText("Group by item column name assertion error: "), actual.getColumn().getName(), is(expected.getName()));
if (null != expected.getOwner()) {
assertTrue(assertMessage.getText("Actual owner should exist."), actual.getColumn().getOwner().isPresent());
assertOwner(assertMessage, actual.getColumn().getOwner().get(), expected.getOwner(), sqlCaseType);
} else {
assertFalse(assertMessage.getText("Actual owner should not exist."), actual.getColumn().getOwner().isPresent());
}
// TODO assert start index and stop index
// SQLSegmentAssert.assertIs(assertMessage, actual, expected, sqlCaseType);
}
private static void assertOwner(final SQLStatementAssertMessage assertMessage, final TableSegment actual, final ExpectedTableOwner expected, final SQLCaseType sqlCaseType) {
assertThat(assertMessage.getText("Group by column owner name assertion error: "), actual.getTableName(), is(expected.getName()));
assertThat(assertMessage.getText("Group by column owner name start delimiter assertion error: "), actual.getTableQuoteCharacter().getStartDelimiter(), is(expected.getStartDelimiter()));
assertThat(assertMessage.getText("Group by column owner name end delimiter assertion error: "), actual.getTableQuoteCharacter().getEndDelimiter(), is(expected.getEndDelimiter()));
// TODO assert start index and stop index
// SQLSegmentAssert.assertIs(assertMessage, actual, expected, sqlCaseType);
}
private static void assertIndexGroupByItem(final SQLStatementAssertMessage assertMessage,
final IndexOrderByItemSegment actual, final ExpectedIndexOrderByItem expected, final SQLCaseType sqlCaseType) {
assertThat(assertMessage.getText("Group by item index assertion error: "), actual.getColumnIndex(), is(expected.getIndex()));
// TODO assert start index and stop index
// SQLSegmentAssert.assertIs(assertMessage, actual, expected, sqlCaseType);
}
private static void assertExpressionGroupByItem(final SQLStatementAssertMessage assertMessage,
final ExpressionOrderByItemSegment actual, final ExpectedExpressionOrderByItem expected, final SQLCaseType sqlCaseType) {
assertThat(assertMessage.getText("Group by item expression assertion error: "), actual.getExpression(), is(expected.getExpression()));
// TODO assert start index and stop index
// SQLSegmentAssert.assertIs(assertMessage, actual, expected, sqlCaseType);
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.shardingsphere.sql.parser.integrate.jaxb.impl.groupby;
import lombok.Getter;
import lombok.Setter;
import org.apache.shardingsphere.sql.parser.integrate.jaxb.generic.AbstractExpectedSQLSegment;
import org.apache.shardingsphere.sql.parser.integrate.jaxb.impl.orderby.ExpectedColumnOrderByItem;
import org.apache.shardingsphere.sql.parser.integrate.jaxb.impl.orderby.ExpectedExpressionOrderByItem;
import org.apache.shardingsphere.sql.parser.integrate.jaxb.impl.orderby.ExpectedIndexOrderByItem;
import javax.xml.bind.annotation.XmlElement;
import java.util.LinkedList;
import java.util.List;
/**
* Expected group by.
*
* @author zhangliang
*/
@Getter
@Setter
public final class ExpectedGroupBy extends AbstractExpectedSQLSegment {
@XmlElement(name = "column-item")
private List<ExpectedColumnOrderByItem> columnItems = new LinkedList<>();
@XmlElement(name = "index-item")
private List<ExpectedIndexOrderByItem> indexItems = new LinkedList<>();
@XmlElement(name = "expression-item")
private List<ExpectedExpressionOrderByItem> expressionItems = new LinkedList<>();
/**
* Get item size.
*
* @return item size
*/
public int getItemSize() {
return columnItems.size() + indexItems.size() + expressionItems.size();
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.shardingsphere.sql.parser.integrate.jaxb.impl.orderby;
import lombok.Getter;
import lombok.Setter;
import org.apache.shardingsphere.sql.parser.integrate.jaxb.impl.owner.ExpectedTableOwner;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
/**
* Expected column order by item.
*
* @author zhangliang
*/
@Getter
@Setter
public final class ExpectedColumnOrderByItem extends ExpectedOrderByItem {
@XmlAttribute
private String name;
@XmlElement
private ExpectedTableOwner owner;
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.shardingsphere.sql.parser.integrate.jaxb.impl.orderby;
import lombok.Getter;
import lombok.Setter;
import javax.xml.bind.annotation.XmlAttribute;
/**
* Expected expression order by item.
*
* @author zhangliang
*/
@Getter
@Setter
public final class ExpectedExpressionOrderByItem extends ExpectedOrderByItem {
@XmlAttribute
private String expression;
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.shardingsphere.sql.parser.integrate.jaxb.impl.orderby;
import lombok.Getter;
import lombok.Setter;
import javax.xml.bind.annotation.XmlAttribute;
/**
* Expected index order by item.
*
* @author zhangliang
*/
@Getter
@Setter
public final class ExpectedIndexOrderByItem extends ExpectedOrderByItem {
@XmlAttribute
private int index;
}
......@@ -15,26 +15,23 @@
* limitations under the License.
*/
package org.apache.shardingsphere.sql.parser.integrate.jaxb.impl.groupby;
package org.apache.shardingsphere.sql.parser.integrate.jaxb.impl.orderby;
import lombok.Getter;
import lombok.Setter;
import org.apache.shardingsphere.sql.parser.integrate.jaxb.generic.AbstractExpectedDelimiterSQLSegment;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
/**
* Expected order by item.
*
* @author zhangliang
*/
@Getter
@Setter
@XmlAccessorType(XmlAccessType.FIELD)
public final class ExpectedGroupByColumn {
@XmlAttribute
private String owner;
@XmlAttribute
private String name;
public abstract class ExpectedOrderByItem extends AbstractExpectedDelimiterSQLSegment {
@XmlAttribute(name = "order-direction")
private String orderDirection;
private String orderDirection = "ASC";
}
......@@ -20,7 +20,7 @@ package org.apache.shardingsphere.sql.parser.integrate.jaxb.root;
import com.google.common.base.Splitter;
import lombok.Getter;
import lombok.Setter;
import org.apache.shardingsphere.sql.parser.integrate.jaxb.impl.groupby.ExpectedGroupByColumn;
import org.apache.shardingsphere.sql.parser.integrate.jaxb.impl.groupby.ExpectedGroupBy;
import org.apache.shardingsphere.sql.parser.integrate.jaxb.impl.insert.ExpectedInsertColumnsAndValues;
import org.apache.shardingsphere.sql.parser.integrate.jaxb.impl.orderby.ExpectedOrderByColumn;
import org.apache.shardingsphere.sql.parser.integrate.jaxb.impl.pagination.ExpectedPaginationValue;
......@@ -67,14 +67,13 @@ public final class ParserResult {
@XmlElement
private ExpectedTokens tokens = new ExpectedTokens();
@XmlElement(name = "group-by")
private ExpectedGroupBy groupBy;
@XmlElementWrapper(name = "order-by-columns")
@XmlElement(name = "order-by-column")
private List<ExpectedOrderByColumn> orderByColumns = new LinkedList<>();
@XmlElementWrapper(name = "group-by-columns")
@XmlElement(name = "group-by-column")
private List<ExpectedGroupByColumn> groupByColumns = new LinkedList<>();
@XmlElement
private ExpectedPaginationValue offset;
......
......@@ -1132,9 +1132,9 @@
</predicate>
</and-predicate>
</where>
<group-by-columns>
<group-by-column name="order_id" order-direction="ASC" />
</group-by-columns>
<group-by>
<column-item name="order_id" />
</group-by>
<order-by-columns>
<order-by-column name="order_id" order-direction="ASC" />
</order-by-columns>
......@@ -1148,9 +1148,9 @@
<aggregation-distinct-projection type="COUNT" inner-expression-start-index="12" distinct-expression="order_id" alias="c" start-index="7" stop-index="30" />
<column-projection name="order_id" start-index="35" stop-index="42" />
</projections>
<group-by-columns>
<group-by-column name="order_id" order-direction="ASC" />
</group-by-columns>
<group-by>
<column-item name="order_id" />
</group-by>
<order-by-columns>
<order-by-column name="order_id" order-direction="ASC" />
</order-by-columns>
......
......@@ -25,9 +25,9 @@
<aggregation-projection type="SUM" alias="orders_sum" inner-expression-start-index="10" start-index="7" stop-index="19" />
<column-projection name="user_id" start-index="36" stop-index="42" />
</projections>
<group-by-columns>
<group-by-column name="user_id" order-direction="ASC" />
</group-by-columns>
<group-by>
<column-item name="user_id" />
</group-by>
<order-by-columns>
<order-by-column name="user_id" order-direction="ASC" />
</order-by-columns>
......@@ -41,9 +41,9 @@
<aggregation-projection type="COUNT" alias="orders_count" inner-expression-start-index="12" start-index="7" stop-index="21" />
<column-projection name="user_id" start-index="40" stop-index="46" />
</projections>
<group-by-columns>
<group-by-column name="user_id" order-direction="ASC" />
</group-by-columns>
<group-by>
<column-item name="user_id" />
</group-by>
<order-by-columns>
<order-by-column name="user_id" order-direction="ASC" />
</order-by-columns>
......@@ -57,9 +57,9 @@
<aggregation-projection type="MAX" alias="max_order_id" inner-expression-start-index="10" start-index="7" stop-index="19" />
<column-projection name="user_id" start-index="38" stop-index="44" />
</projections>
<group-by-columns>
<group-by-column name="user_id" order-direction="ASC" />
</group-by-columns>
<group-by>
<column-item name="user_id" />
</group-by>
<order-by-columns>
<order-by-column name="user_id" order-direction="ASC" />
</order-by-columns>
......@@ -73,9 +73,9 @@
<aggregation-projection type="MIN" alias="min_order_id" inner-expression-start-index="10" start-index="7" stop-index="19" />
<column-projection name="user_id" start-index="38" stop-index="44" />
</projections>
<group-by-columns>
<group-by-column name="user_id" order-direction="ASC" />
</group-by-columns>
<group-by>
<column-item name="user_id" />
</group-by>
<order-by-columns>
<order-by-column name="user_id" order-direction="ASC" />
</order-by-columns>
......@@ -89,9 +89,9 @@
<aggregation-projection type="AVG" alias="orders_avg" inner-expression-start-index="10" start-index="7" stop-index="19" />
<column-projection name="user_id" start-index="36" stop-index="42" />
</projections>
<group-by-columns>
<group-by-column name="user_id" order-direction="ASC" />
</group-by-columns>
<group-by>
<column-item name="user_id" />
</group-by>
<order-by-columns>
<order-by-column name="user_id" order-direction="ASC" />
</order-by-columns>
......@@ -105,9 +105,9 @@
<aggregation-projection type="SUM" inner-expression-start-index="10" alias="orders_sum" start-index="7" stop-index="19" />
<column-projection name="user_id" start-index="36" stop-index="42" />
</projections>
<group-by-columns>
<group-by-column name="user_id" order-direction="ASC" />
</group-by-columns>
<group-by>
<column-item name="user_id" />
</group-by>
<order-by-columns>
<order-by-column name="orders_sum" order-direction="DESC" />
</order-by-columns>
......@@ -147,9 +147,11 @@
</predicate>
</and-predicate>
</where>
<group-by-columns>
<group-by-column name="user_id" owner="o" order-direction="ASC" />
</group-by-columns>
<group-by>
<column-item name="user_id">
<owner name="o" start-index="185" stop-index="185" literal-start-index="186" literal-stop-index="186" />
</column-item>
</group-by>
</parser-result>
<parser-result sql-case-id="select_group_by_with_limit" parameters="5">
......@@ -159,9 +161,9 @@
<projections start-index="7" stop-index="13">
<column-projection name="user_id" start-index="7" stop-index="13" />
</projections>
<group-by-columns>
<group-by-column name="user_id" order-direction="ASC" />
</group-by-columns>
<group-by>
<column-item name="user_id" />
</group-by>
<order-by-columns>
<order-by-column name="user_id" order-direction="ASC" />
</order-by-columns>
......@@ -176,9 +178,9 @@
<column-projection name="user_id" start-index="7" stop-index="13" />
<aggregation-projection type="SUM" inner-expression-start-index="19" alias="orders_sum" start-index="16" stop-index="28" />
</projections>
<group-by-columns>
<group-by-column name="user_id" order-direction="ASC" />
</group-by-columns>
<group-by>
<column-item name="user_id" />
</group-by>
<order-by-columns>
<order-by-column name="SUM(order_id)" order-direction="ASC" />
</order-by-columns>
......@@ -194,9 +196,11 @@
<owner name="o" start-index="7" stop-index="7" />
</column-projection>
</projections>
<group-by-columns>
<group-by-column name="user_id" owner="o" alias="uid" order-direction="ASC" />
</group-by-columns>
<group-by>
<column-item name="user_id">
<owner name="o" start-index="45" stop-index="45" />
</column-item>
</group-by>
<order-by-columns>
<order-by-column name="user_id" owner="o" order-direction="ASC" />
</order-by-columns>
......@@ -223,9 +227,9 @@
</predicate>
</and-predicate>
</where>
<group-by-columns>
<group-by-column name="date_format(creation_date,'%y-%m-%d')" order-direction="ASC" />
</group-by-columns>
<group-by>
<expression-item expression="date_format(creation_date,'%y-%m-%d')" start-index="140" stop-index="177" literal-start-index="146" literal-stop-index="183" />
</group-by>
</parser-result>
<parser-result sql-case-id="select_group_by_with_keyword_alias">
......@@ -236,9 +240,9 @@
<aggregation-projection type="SUM" inner-expression-start-index="10" alias="orders_sum" start-index="7" stop-index="19" />
<column-projection name="user_id" alias="key" start-index="36" stop-index="42" />
</projections>
<group-by-columns>
<group-by-column name="key" alias="key" order-direction="ASC" />
</group-by-columns>
<group-by>
<column-item name="key" start-delimiter="`" end-delimiter="`" />
</group-by>
</parser-result>
<parser-result sql-case-id="select_group_by_with_count_without_column_name">
......@@ -249,9 +253,9 @@
<aggregation-projection inner-expression-start-index="12" type="COUNT" alias="orders_count" start-index="7" stop-index="21" />
<column-projection name="user_id" start-index="40" stop-index="46" />
</projections>
<group-by-columns>
<group-by-column index="2" order-direction="ASC" />
</group-by-columns>
<group-by>
<index-item index="2" start-index="70" stop-index="70" />
</group-by>
<order-by-columns>
<order-by-column index="2" order-direction="ASC" />
</order-by-columns>
......
......@@ -53,9 +53,11 @@
</predicate>
</and-predicate>
</where>
<group-by-columns>
<group-by-column name="item_id" owner="i" order-direction="ASC" />
</group-by-columns>
<group-by>
<column-item name="item_id">
<owner name="i" start-index="170" stop-index="170" literal-start-index="171" literal-stop-index="171" />
</column-item>
</group-by>
<order-by-columns>
<order-by-column name="item_id" owner="i" order-direction="DESC" />
</order-by-columns>
......@@ -99,9 +101,11 @@
</predicate>
</and-predicate>
</where>
<group-by-columns>
<group-by-column name="user_id" owner="i" order-direction="ASC" />
</group-by-columns>
<group-by>
<column-item name="user_id">
<owner name="i" start-index="170" stop-index="170" literal-start-index="171" literal-stop-index="171" />
</column-item>
</group-by>
<order-by-columns>
<order-by-column name="item_id" owner="i" order-direction="DESC" />
</order-by-columns>
......@@ -146,9 +150,11 @@
</predicate>
</and-predicate>
</where>
<group-by-columns>
<group-by-column name="item_id" owner="i" order-direction="ASC" />
</group-by-columns>
<group-by>
<column-item name="item_id">
<owner name="i" start-index="170" stop-index="170" literal-start-index="171" literal-stop-index="171" />
</column-item>
</group-by>
<order-by-columns>
<order-by-column name="item_id" owner="i" order-direction="DESC" />
</order-by-columns>
......@@ -193,9 +199,11 @@
</predicate>
</and-predicate>
</where>
<group-by-columns>
<group-by-column name="item_id" owner="i" order-direction="ASC" />
</group-by-columns>
<group-by>
<column-item name="item_id">
<owner name="i" start-index="170" stop-index="170" literal-start-index="171" literal-stop-index="171" />
</column-item>
</group-by>
<order-by-columns>
<order-by-column name="item_id" owner="i" order-direction="DESC" />
</order-by-columns>
......@@ -240,9 +248,11 @@
</predicate>
</and-predicate>
</where>
<group-by-columns>
<group-by-column name="user_id" owner="i" order-direction="ASC" />
</group-by-columns>
<group-by>
<column-item name="user_id">
<owner name="i" start-index="170" stop-index="170" literal-start-index="171" literal-stop-index="171" />
</column-item>
</group-by>
<order-by-columns>
<order-by-column name="item_id" owner="i" order-direction="DESC" />
</order-by-columns>
......@@ -287,9 +297,11 @@
</predicate>
</and-predicate>
</where>
<group-by-columns>
<group-by-column name="user_id" owner="i" order-direction="ASC" />
</group-by-columns>
<group-by>
<column-item name="user_id">
<owner name="i" start-index="170" stop-index="170" literal-start-index="171" literal-stop-index="171" />
</column-item>
</group-by>
<order-by-columns>
<order-by-column name="item_id" owner="i" order-direction="DESC" />
</order-by-columns>
......@@ -328,9 +340,11 @@
</predicate>
</and-predicate>
</where>
<group-by-columns>
<group-by-column name="item_id" owner="i" order-direction="ASC" />
</group-by-columns>
<group-by>
<column-item name="item_id">
<owner name="i" start-index="170" stop-index="170" literal-start-index="171" literal-stop-index="171" />
</column-item>
</group-by>
<order-by-columns>
<order-by-column name="item_id" owner="i" order-direction="DESC" />
</order-by-columns>
......@@ -369,9 +383,11 @@
</predicate>
</and-predicate>
</where>
<group-by-columns>
<group-by-column name="user_id" owner="i" order-direction="ASC" />
</group-by-columns>
<group-by>
<column-item name="user_id">
<owner name="i" start-index="170" stop-index="170" literal-start-index="171" literal-stop-index="171" />
</column-item>
</group-by>
<order-by-columns>
<order-by-column name="item_id" owner="i" order-direction="DESC" />
</order-by-columns>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册