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


Java OrderBy类代码示例

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


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

示例1: testGetOrderBysBeforeNext

import com.taobao.tddl.optimizer.core.expression.bean.OrderBy; //导入依赖的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));
    IMerge merge = ASTNodeFactory.getInstance().createMerge();
    merge.setSharded(true);
    MergeCursor c = new MergeCursor(cursors, merge, null);

    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,代码行数:22,代码来源:MergeCursorTest.java

示例2: testGetOrderBysAfterNext

import com.taobao.tddl.optimizer.core.expression.bean.OrderBy; //导入依赖的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));
    IMerge merge = ASTNodeFactory.getInstance().createMerge();
    merge.setSharded(true);
    MergeCursor c = new MergeCursor(cursors, merge, null);

    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,代码来源:MergeCursorTest.java

示例3: testGetOrderBysBeforeNext

import com.taobao.tddl.optimizer.core.expression.bean.OrderBy; //导入依赖的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));
    MergeSortedCursors c = new MergeSortedCursors(cursors, true);

    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,代码来源:MergeSortedCursorTest.java

示例4: testGetOrderBysAfterNext

import com.taobao.tddl.optimizer.core.expression.bean.OrderBy; //导入依赖的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));
    MergeSortedCursors c = new MergeSortedCursors(cursors, true);

    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,代码来源:MergeSortedCursorTest.java

示例5: testGetReturnColumnsBeforeNext

import com.taobao.tddl.optimizer.core.expression.bean.OrderBy; //导入依赖的package包/类
@Test
public void testGetReturnColumnsBeforeNext() throws TddlException {
    RepositoryHolder repoHolder = new RepositoryHolder();
    StaticSchemaManager sm = new StaticSchemaManager("test_schema.xml", null, null);
    sm.init();
    IRepository bdbRepo = repoHolder.getOrCreateRepository("BDB_JE", Collections.EMPTY_MAP, Collections.EMPTY_MAP);
    ICursorFactory cf = new CursorFactoryDefaultImpl();
    MockArrayCursor mockCursor = this.getCursor("T1", new Integer[] { 5, 5, 4, 3, 2, 1 });
    SchematicCursor subCursor = new SchematicCursor(mockCursor);

    IOrderBy order = new OrderBy();
    order.setColumn(new Column().setColumnName("ID").setTableName("T1").setDataType(DataType.IntegerType));
    List<IOrderBy> orderBys = new ArrayList();

    orderBys.add(order);
    TempTableSortCursor c = new TempTableSortCursor(cf,
        bdbRepo,
        subCursor,
        orderBys,
        true,
        0,
        new ExecutionContext());
    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,代码行数:27,代码来源:TempTableSortCursorTest.java

示例6: testGetOrderBysBeforeNext

import com.taobao.tddl.optimizer.core.expression.bean.OrderBy; //导入依赖的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

示例7: testGetOrderBysAfterNext

import com.taobao.tddl.optimizer.core.expression.bean.OrderBy; //导入依赖的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

示例8: testLimit

import com.taobao.tddl.optimizer.core.expression.bean.OrderBy; //导入依赖的package包/类
@Test
public void testLimit() throws TddlException {

    MockArrayCursor mockCursor1 = 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);

    LimitFromToCursor c = new LimitFromToCursor(new SchematicCursor(mockCursor1, orderBys), 2l, 3L);
    Object[] expected = new Object[] { 4, 5, 6 };
    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,代码行数:25,代码来源:LimitCursorTest.java

示例9: testGetOrderBysBeforeNext

import com.taobao.tddl.optimizer.core.expression.bean.OrderBy; //导入依赖的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));
    MergeCursor c = new MergeCursor(cursors, null, null);

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

}
 
开发者ID:beebeandwer,项目名称:TDDL,代码行数:22,代码来源:MergeCursorTest.java

示例10: testGetOrderBysAfterNext

import com.taobao.tddl.optimizer.core.expression.bean.OrderBy; //导入依赖的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));
    MergeCursor c = new MergeCursor(cursors, null, null);

    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:beebeandwer,项目名称:TDDL,代码行数:24,代码来源:MergeCursorTest.java

示例11: testGetReturnColumnsBeforeNext

import com.taobao.tddl.optimizer.core.expression.bean.OrderBy; //导入依赖的package包/类
@Test
public void testGetReturnColumnsBeforeNext() throws TddlException {
    RepositoryHolder repoHolder = new RepositoryHolder();
    StaticSchemaManager sm = new StaticSchemaManager("test_schema.xml", null, null);
    sm.init();
    IRepository bdbRepo = repoHolder.getOrCreateRepository("BDB_JE", Collections.EMPTY_MAP);
    ICursorFactory cf = new CursorFactoryDefaultImpl();
    MockArrayCursor mockCursor = this.getCursor("T1", new Integer[] { 5, 5, 4, 3, 2, 1 });
    SchematicCursor subCursor = new SchematicCursor(mockCursor);

    IOrderBy order = new OrderBy();
    order.setColumn(new Column().setColumnName("ID").setTableName("T1").setDataType(DataType.IntegerType));
    List<IOrderBy> orderBys = new ArrayList();

    orderBys.add(order);
    TempTableSortCursor c = new TempTableSortCursor(cf,
        bdbRepo,
        subCursor,
        orderBys,
        true,
        0,
        new ExecutionContext());
    Assert.assertEquals("[T1.ID, T1.NAME, T1.SCHOOL]", c.getReturnColumns().toString());
    Assert.assertEquals("[OrderBy [columnName=T1.ID, direction=true]]", c.getOrderBy().toString());

}
 
开发者ID:beebeandwer,项目名称:TDDL,代码行数:27,代码来源:TempTableCursorTest.java

示例12: getOrderBy

import com.taobao.tddl.optimizer.core.expression.bean.OrderBy; //导入依赖的package包/类
public static List<IOrderBy> getOrderBy(IndexMeta meta) {
    if (meta == null) return new ArrayList<IOrderBy>(0);
    List<IOrderBy> _orderBys = new ArrayList<IOrderBy>();
    for (ColumnMeta c : meta.getKeyColumns()) {
        IColumn column = ASTNodeFactory.getInstance().createColumn();
        column.setTableName(c.getTableName())
            .setColumnName(c.getName())
            .setDataType(c.getDataType())
            .setAlias(c.getAlias());
        IOrderBy orderBy = new OrderBy().setColumn(column).setDirection(true);
        _orderBys.add(orderBy);
    }
    return _orderBys;
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:15,代码来源:ExecUtils.java

示例13: getOrderByFromColumnMetas

import com.taobao.tddl.optimizer.core.expression.bean.OrderBy; //导入依赖的package包/类
public static List<IOrderBy> getOrderByFromColumnMetas(List<ColumnMeta> columns) {
    if (GeneralUtil.isEmpty(columns)) return new ArrayList<IOrderBy>(0);
    List<IOrderBy> _orderBys = new ArrayList<IOrderBy>();
    for (ColumnMeta c : columns) {
        IColumn column = ASTNodeFactory.getInstance().createColumn();
        column.setTableName(c.getTableName())
            .setColumnName(c.getName())
            .setDataType(c.getDataType())
            .setAlias(c.getAlias());
        IOrderBy orderBy = new OrderBy().setColumn(column).setDirection(true);
        _orderBys.add(orderBy);
    }
    return _orderBys;
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:15,代码来源:ExecUtils.java

示例14: testMergeNormal

import com.taobao.tddl.optimizer.core.expression.bean.OrderBy; //导入依赖的package包/类
@Test
public void testMergeNormal() 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));

    IMerge merge = ASTNodeFactory.getInstance().createMerge();
    merge.setSharded(true);
    MergeCursor c = new MergeCursor(cursors, merge, null);
    Object[] expected = new Object[] { 1, 3, 5, 8, 8, 9, 10, 2, 2, 4, 5, 6, 7, 7, 9, 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,代码来源:MergeCursorTest.java

示例15: testSortDuplicated

import com.taobao.tddl.optimizer.core.expression.bean.OrderBy; //导入依赖的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));
    MergeSortedCursors c = new MergeSortedCursors(cursors, true);
    Object[] expected = new Object[] { 1, 2, 2, 3, 4, 5, 5, 6, 7, 7, 8, 8, 9, 9, 9, 10, 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,代码来源:MergeSortedCursorTest.java


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