本文整理汇总了Java中com.taobao.tddl.executor.cursor.impl.TempTableSortCursor.next方法的典型用法代码示例。如果您正苦于以下问题:Java TempTableSortCursor.next方法的具体用法?Java TempTableSortCursor.next怎么用?Java TempTableSortCursor.next使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.taobao.tddl.executor.cursor.impl.TempTableSortCursor
的用法示例。
在下文中一共展示了TempTableSortCursor.next方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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());
}
示例2: 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());
}
示例3: 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());
}
示例4: 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());
}
示例5: 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());
}
示例6: 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());
}
示例7: 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());
}
示例8: 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());
}