use of com.dangdang.ddframe.rdb.sharding.parser.result.merger.MergeContext in project sharding-jdbc by dangdangdotcom.
the class ResultSetMergeContextTest method assertIsNotNeedMemorySortForGroupByWithoutGroupBy.
@Test
public void assertIsNotNeedMemorySortForGroupByWithoutGroupBy() throws SQLException {
ResultSetMergeContext actual = new ResultSetMergeContext(new ShardingResultSets(Collections.singletonList(MergerTestUtil.mockResult(Collections.<String>emptyList()))), new MergeContext());
assertFalse(actual.isNeedMemorySortForGroupBy());
}
use of com.dangdang.ddframe.rdb.sharding.parser.result.merger.MergeContext 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());
}
Aggregations