當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。