本文整理汇总了Java中com.taobao.tddl.executor.cursor.impl.DistinctCursor.next方法的典型用法代码示例。如果您正苦于以下问题:Java DistinctCursor.next方法的具体用法?Java DistinctCursor.next怎么用?Java DistinctCursor.next使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.taobao.tddl.executor.cursor.impl.DistinctCursor
的用法示例。
在下文中一共展示了DistinctCursor.next方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGetOrderBysAfterNext
import com.taobao.tddl.executor.cursor.impl.DistinctCursor; //导入方法依赖的package包/类
@Test
public void testGetOrderBysAfterNext() throws TddlException {
MockArrayCursor mockCursor1 = this.getCursor("T1", new Integer[] { 1, 3, 5, 8, 8, 9, 10 });
MockArrayCursor mockCursor2 = this.getCursor("T1", new Integer[] { 2, 2, 4, 5, 6, 7, 7, 9, 9, 10, 13 });
IOrderBy order = new OrderBy();
order.setColumn(new Column().setColumnName("ID").setTableName("T1").setDataType(DataType.IntegerType));
List<IOrderBy> orderBys = new ArrayList();
orderBys.add(order);
List<ISchematicCursor> cursors = new ArrayList();
cursors.add(new SchematicCursor(mockCursor1, orderBys));
cursors.add(new SchematicCursor(mockCursor2, orderBys));
DistinctCursor c = new DistinctCursor(new MergeSortedCursors(cursors, true), orderBys);
c.next();
Assert.assertEquals("[T1.ID, T1.NAME, T1.SCHOOL]", c.getReturnColumns().toString());
Assert.assertEquals("[OrderBy [columnName=T1.ID, direction=true]]", c.getOrderBy().toString());
}
示例2: testSortDuplicated
import com.taobao.tddl.executor.cursor.impl.DistinctCursor; //导入方法依赖的package包/类
@Test
public void testSortDuplicated() throws TddlException {
MockArrayCursor mockCursor1 = this.getCursor("T1", new Integer[] { 1, 3, 5, 8, 8, 9, 10 });
MockArrayCursor mockCursor2 = this.getCursor("T1", new Integer[] { 2, 2, 4, 5, 6, 7, 7, 9, 9, 10, 13 });
IOrderBy order = new OrderBy();
order.setColumn(new Column().setColumnName("ID").setTableName("T1").setDataType(DataType.IntegerType));
List<IOrderBy> orderBys = new ArrayList();
orderBys.add(order);
List<ISchematicCursor> cursors = new ArrayList();
cursors.add(new SchematicCursor(mockCursor1, orderBys));
cursors.add(new SchematicCursor(mockCursor2, orderBys));
DistinctCursor c = new DistinctCursor(new MergeSortedCursors(cursors, true), orderBys);
Object[] expected = new Object[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 13 };
List actual = new ArrayList();
IRowSet row = null;
while ((row = c.next()) != null) {
System.out.println(row);
actual.add(row.getObject(0));
}
c.close(new ArrayList());
Assert.assertArrayEquals(expected, actual.toArray());
Assert.assertTrue(mockCursor1.isClosed());
}