Search in sources :

Example 16 with OrderByColumn

use of com.dangdang.ddframe.rdb.sharding.parser.result.merger.OrderByColumn in project sharding-jdbc by dangdangdotcom.

the class ResultSetMergeContextTest method assertIsNeedMemorySortForGroupByWithGroupByAndOrderByDifferent.

@Test
public void assertIsNeedMemorySortForGroupByWithGroupByAndOrderByDifferent() throws SQLException {
    MergeContext mergeContext = new MergeContext();
    mergeContext.getOrderByColumns().add(new OrderByColumn("order_col", OrderByColumn.OrderByType.ASC));
    mergeContext.getGroupByColumns().add(new GroupByColumn(Optional.<String>absent(), "group_col", Optional.<String>absent(), OrderByColumn.OrderByType.ASC));
    ResultSetMergeContext actual = new ResultSetMergeContext(new ShardingResultSets(Collections.singletonList(MergerTestUtil.mockResult(Arrays.asList("order_col", "group_col")))), mergeContext);
    assertTrue(actual.isNeedMemorySortForGroupBy());
}
Also used : MergeContext(com.dangdang.ddframe.rdb.sharding.parser.result.merger.MergeContext) GroupByColumn(com.dangdang.ddframe.rdb.sharding.parser.result.merger.GroupByColumn) OrderByColumn(com.dangdang.ddframe.rdb.sharding.parser.result.merger.OrderByColumn) Test(org.junit.Test)

Aggregations

OrderByColumn (com.dangdang.ddframe.rdb.sharding.parser.result.merger.OrderByColumn)16 GroupByColumn (com.dangdang.ddframe.rdb.sharding.parser.result.merger.GroupByColumn)10 MergeContext (com.dangdang.ddframe.rdb.sharding.parser.result.merger.MergeContext)9 Test (org.junit.Test)8 AggregationColumn (com.dangdang.ddframe.rdb.sharding.parser.result.merger.AggregationColumn)3 ArrayList (java.util.ArrayList)3 MockResultSet (com.dangdang.ddframe.rdb.sharding.merger.fixture.MockResultSet)2 Limit (com.dangdang.ddframe.rdb.sharding.parser.result.merger.Limit)2 Value (com.dangdang.ddframe.rdb.sharding.parser.jaxb.Value)1 Condition (com.dangdang.ddframe.rdb.sharding.parser.result.router.Condition)1 Column (com.dangdang.ddframe.rdb.sharding.parser.result.router.Condition.Column)1 ConditionContext (com.dangdang.ddframe.rdb.sharding.parser.result.router.ConditionContext)1 Table (com.dangdang.ddframe.rdb.sharding.parser.result.router.Table)1 Function (com.google.common.base.Function)1 ResultSet (java.sql.ResultSet)1 Calendar (java.util.Calendar)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 ReflectionEquals (org.mockito.internal.matchers.apachecommons.ReflectionEquals)1