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


Java TempTableSortCursor类代码示例

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


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

示例1: testGetReturnColumnsBeforeNext

import com.taobao.tddl.executor.cursor.impl.TempTableSortCursor; //导入依赖的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

示例2: testGetReturnColumnsBeforeNext

import com.taobao.tddl.executor.cursor.impl.TempTableSortCursor; //导入依赖的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

示例3: tempTableSortCursor

import com.taobao.tddl.executor.cursor.impl.TempTableSortCursor; //导入依赖的package包/类
@Override
public ITempTableSortCursor tempTableSortCursor(ExecutionContext executionContext, ISchematicCursor cursor,
                                                List<IOrderBy> orderBys, boolean sortedDuplicates, long requestID)
                                                                                                                  throws TddlException {
    try {
        if (GeneralUtil.getExtraCmdBoolean(executionContext.getExtraCmds(),
            ConnectionProperties.ALLOW_TEMPORARY_TABLE,
            false)) {

            IRepository bdbRepo = ExecutorContext.getContext()
                .getRepositoryHolder()
                .getOrCreateRepository(Group.GroupType.BDB_JE.name(),
                    Collections.EMPTY_MAP,
                    executionContext.getExtraCmds());
            return new TempTableSortCursor(this,
                bdbRepo,
                cursor,
                orderBys,
                sortedDuplicates,
                requestID,
                executionContext);
        }

        throw new IllegalStateException("not allow to use temporary table . allow first");

    } catch (Exception e) {
        closeParentCursor(cursor);
        throw new TddlException(e);
    }
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:31,代码来源:CursorFactoryDefaultImpl.java

示例4: testSort

import com.taobao.tddl.executor.cursor.impl.TempTableSortCursor; //导入依赖的package包/类
@Test
public void testSort() 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());
    Object[] expected = new Object[] { 1, 2, 3, 4, 5, 5 };
    List actual = new ArrayList();

    IRowSet row = null;
    while ((row = c.next()) != null) {

        System.out.println(row);
        actual.add(row.getObject(0));
    }

    Assert.assertArrayEquals(expected, actual.toArray());
    Assert.assertTrue(mockCursor.isClosed());
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:36,代码来源:TempTableSortCursorTest.java

示例5: testNull

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

    SchematicCursor subCursor = new SchematicCursor(this.getCursor("T1",
        new Integer[] { 5, null, 4, 3, 2, null, 1 }));

    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());
    Object[] expected = new Object[] { 1, 2, 3, 4, 5, null, null };
    List actual = new ArrayList();

    IRowSet row = null;
    while ((row = c.next()) != null) {

        System.out.println(row);
        actual.add(row.getObject(0));
    }

    Assert.assertArrayEquals(expected, actual.toArray());

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

示例6: testEmpty

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

    SchematicCursor subCursor = new SchematicCursor(this.getCursor("T1", new Integer[] {}));

    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());
    Object[] expected = new Object[] {};
    List actual = new ArrayList();

    IRowSet row = null;
    while ((row = c.next()) != null) {

        System.out.println(row);
        actual.add(row.getObject(0));
    }

    Assert.assertArrayEquals(expected, actual.toArray());
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:35,代码来源:TempTableSortCursorTest.java

示例7: testGetReturnColumnsAfterNext

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

    while (c.next() != 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,代码行数:30,代码来源:TempTableSortCursorTest.java

示例8: tempTableSortCursor

import com.taobao.tddl.executor.cursor.impl.TempTableSortCursor; //导入依赖的package包/类
@Override
public ITempTableSortCursor tempTableSortCursor(ExecutionContext executionContext, ISchematicCursor cursor,
                                                List<IOrderBy> orderBys, boolean sortedDuplicates, long requestID)
                                                                                                                  throws TddlException {
    try {
        if ("True".equalsIgnoreCase(GeneralUtil.getExtraCmdString(executionContext.getExtraCmds(),
            ExtraCmd.ALLOW_TEMPORARY_TABLE))) {

            IRepository bdbRepo = ExecutorContext.getContext()
                .getRepositoryHolder()
                .getOrCreateRepository(Group.GroupType.BDB_JE.name(), Collections.EMPTY_MAP);
            return new TempTableSortCursor(this,
                bdbRepo,
                cursor,
                orderBys,
                sortedDuplicates,
                requestID,
                executionContext);
        }

        throw new IllegalStateException("not allow to use temporary table . allow first ");

    } catch (Exception e) {
        closeParentCursor(cursor);
        throw new TddlException(e);
    }
}
 
开发者ID:beebeandwer,项目名称:TDDL,代码行数:28,代码来源:CursorFactoryDefaultImpl.java

示例9: testSort

import com.taobao.tddl.executor.cursor.impl.TempTableSortCursor; //导入依赖的package包/类
@Test
public void testSort() 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());
    Object[] expected = new Object[] { 1, 2, 3, 4, 5, 5 };
    List actual = new ArrayList();

    IRowSet row = null;
    while ((row = c.next()) != null) {

        System.out.println(row);
        actual.add(row.getObject(0));
    }

    Assert.assertArrayEquals(expected, actual.toArray());
    Assert.assertTrue(mockCursor.isClosed());
}
 
开发者ID:beebeandwer,项目名称:TDDL,代码行数:36,代码来源:TempTableCursorTest.java

示例10: testNull

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

    SchematicCursor subCursor = new SchematicCursor(this.getCursor("T1",
        new Integer[] { 5, null, 4, 3, 2, null, 1 }));

    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());
    Object[] expected = new Object[] { 1, 2, 3, 4, 5, null, null };
    List actual = new ArrayList();

    IRowSet row = null;
    while ((row = c.next()) != null) {

        System.out.println(row);
        actual.add(row.getObject(0));
    }

    Assert.assertArrayEquals(expected, actual.toArray());

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

示例11: testEmpty

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

    SchematicCursor subCursor = new SchematicCursor(this.getCursor("T1", new Integer[] {}));

    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());
    Object[] expected = new Object[] {};
    List actual = new ArrayList();

    IRowSet row = null;
    while ((row = c.next()) != null) {

        System.out.println(row);
        actual.add(row.getObject(0));
    }

    Assert.assertArrayEquals(expected, actual.toArray());
}
 
开发者ID:beebeandwer,项目名称:TDDL,代码行数:35,代码来源:TempTableCursorTest.java

示例12: testGetReturnColumnsAfterNext

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

    while (c.next() != 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,代码行数:30,代码来源:TempTableCursorTest.java


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