当前位置: 首页>>代码示例>>Java>>正文


Java DistinctCursor类代码示例

本文整理汇总了Java中com.taobao.tddl.executor.cursor.impl.DistinctCursor的典型用法代码示例。如果您正苦于以下问题:Java DistinctCursor类的具体用法?Java DistinctCursor怎么用?Java DistinctCursor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DistinctCursor类属于com.taobao.tddl.executor.cursor.impl包,在下文中一共展示了DistinctCursor类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testGetOrderBysBeforeNext

import com.taobao.tddl.executor.cursor.impl.DistinctCursor; //导入依赖的package包/类
@Test
public void testGetOrderBysBeforeNext() 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);

    Assert.assertEquals("[T1.ID, T1.NAME, T1.SCHOOL]", c.getReturnColumns().toString());
    Assert.assertEquals("[OrderBy [columnName=T1.ID, direction=true]]", c.getOrderBy().toString());

}
 
开发者ID:loye168,项目名称:tddl5,代码行数:21,代码来源:DistinctCursorTest.java

示例2: 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());

}
 
开发者ID:loye168,项目名称:tddl5,代码行数:23,代码来源:DistinctCursorTest.java

示例3: 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());
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:30,代码来源:DistinctCursorTest.java


注:本文中的com.taobao.tddl.executor.cursor.impl.DistinctCursor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。