本文整理汇总了Java中com.taobao.tddl.executor.cursor.ICursorMeta类的典型用法代码示例。如果您正苦于以下问题:Java ICursorMeta类的具体用法?Java ICursorMeta怎么用?Java ICursorMeta使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ICursorMeta类属于com.taobao.tddl.executor.cursor包,在下文中一共展示了ICursorMeta类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildSchemaFromReturnColumns
import com.taobao.tddl.executor.cursor.ICursorMeta; //导入依赖的package包/类
protected void buildSchemaFromReturnColumns(List<ColumnMeta> leftColumns, List<ColumnMeta> rightColumns)
throws TddlException {
if (schemaInited) {
return;
}
schemaInited = true;
// 以左面数据顺序,作为排序
setOrderBy(left_cursor);
List<ColumnMeta> newJoinColumnMsg = new ArrayList<ColumnMeta>(leftColumns.size() + rightColumns.size());
newJoinColumnMsg.addAll(leftColumns);
newJoinColumnMsg.addAll(rightColumns);
ICursorMeta cursorMetaImpJoin = CursorMetaImp.buildNew(newJoinColumnMsg);
rightCursorOffset = leftColumns.size();
this.joinCursorMeta = cursorMetaImpJoin;
}
示例2: buildSchemaFromReturnColumns
import com.taobao.tddl.executor.cursor.ICursorMeta; //导入依赖的package包/类
protected void buildSchemaFromReturnColumns(List<ColumnMeta> leftColumns, List<ColumnMeta> rightColumns) {
if (schemaInited) {
return;
}
schemaInited = true;
// 以左面数据顺序,作为排序
setOrderBy(left_cursor);
List<ColumnMeta> newJoinColumnMsg = new ArrayList<ColumnMeta>(leftColumns.size() + rightColumns.size());
newJoinColumnMsg.addAll(leftColumns);
newJoinColumnMsg.addAll(rightColumns);
ICursorMeta cursorMetaImpJoin = CursorMetaImp.buildNew(newJoinColumnMsg);
rightCursorOffset = leftColumns.size();
this.joinCursorMeta = cursorMetaImpJoin;
}
示例3: getComp
import com.taobao.tddl.executor.cursor.ICursorMeta; //导入依赖的package包/类
public static Comparator<IRowSet> getComp(final List<ISelectable> left_columns,
final List<ISelectable> right_columns, final ICursorMeta leftMeta,
final ICursorMeta rightMeta) {
return new Comparator<IRowSet>() {
public IRowsValueScaner leftScaner = new RowsValueScanerImp(leftMeta, left_columns);
public IRowsValueScaner rightScaner = new RowsValueScanerImp(rightMeta, right_columns);
/*
* 沈洵
* 这个代码与com.taobao.ustore.spi.cursor.common.SortCursor.getComp(List
* <IOrderBy> orderBys)
* 唯一的不同,也只有compare的时候需要两个列的list,并且没有asc和desc条件。其他逻辑类似。
*/
@Override
public int compare(IRowSet o1, IRowSet o2) {
Iterator<Object> leftIter = leftScaner.rowValueIterator(o1);
Iterator<Object> rightIter = rightScaner.rowValueIterator(o2);
for (int i = 0; i < left_columns.size(); i++) {
Object c1 = leftIter.next();
Object c2 = rightIter.next();
int n = comp(c1, c2, left_columns.get(i).getDataType(), right_columns.get(i).getDataType());
if (n != 0) {
return n;
}
}
return 0;
}
};
}
示例4: convertToICursorMeta
import com.taobao.tddl.executor.cursor.ICursorMeta; //导入依赖的package包/类
public static ICursorMeta convertToICursorMeta(IQueryTree query) {
if (query.getSql() != null) {
return null;
}
ICursorMeta iCursorMeta = null;
List<ColumnMeta> columns = convertISelectablesToColumnMeta(query.getColumns(),
query.getAlias(),
query.isSubQuery());
iCursorMeta = CursorMetaImp.buildNew(columns, columns.size());
return iCursorMeta;
}
示例5: getObject
import com.taobao.tddl.executor.cursor.ICursorMeta; //导入依赖的package包/类
public static Object getObject(final ICursorMeta meta, IRowSet rowSet, String tableName, String columnName,
String columnAlias) {
Integer index = meta.getIndex(tableName, columnName, columnAlias);
if (index == null) {
throw new RuntimeException("not found :" + tableName + "." + columnName + " in ICursorMeta:" + meta);
}
return rowSet.getObject(index);
}
示例6: schematicCursor
import com.taobao.tddl.executor.cursor.ICursorMeta; //导入依赖的package包/类
@Override
public ISchematicCursor schematicCursor(ExecutionContext executionContext, Cursor cursor, ICursorMeta meta,
List<IOrderBy> orderBys) throws TddlException {
try {
return new SchematicCursor(cursor, meta, orderBys);
} catch (Exception e) {
closeParentCursor(cursor);
throw new TddlException(e);
}
}
示例7: mergeCursor
import com.taobao.tddl.executor.cursor.ICursorMeta; //导入依赖的package包/类
@Override
public IMergeCursor mergeCursor(ExecutionContext executionContext, List<ISchematicCursor> cursors,
ICursorMeta indexMeta, IMerge currentExecotor, List<IOrderBy> orderBys)
throws TddlException {
try {
return new MergeCursor(cursors, indexMeta, currentExecotor, executionContext, orderBys);
} catch (Exception e) {
if (cursors != null) {
for (ISchematicCursor iSchematicCursor : cursors) {
closeParentCursor(iSchematicCursor);
}
}
throw new TddlException(e);
}
}
示例8: initComparator
import com.taobao.tddl.executor.cursor.ICursorMeta; //导入依赖的package包/类
protected void initComparator(List<IOrderBy> orderBys, ICursorMeta cursorMeta) {
if (schemaInited) {
return;
}
schemaInited = true;
if (orderBys != null) {
this.kvPairComparator = ExecUtils.getComp(orderBys, cursorMeta);
}
}
示例9: wrap
import com.taobao.tddl.executor.cursor.ICursorMeta; //导入依赖的package包/类
public static IRowSet wrap(ICursorMeta newCursorMeta, IRowSet target,
Map<Integer/* 返回列中的index位置 */, Integer/* 实际数据中的index位置 */> mapping) {
if (target == null) {
return null;
}
return new ValueMappingRowSet(newCursorMeta, target, mapping);
}
示例10: initSchema
import com.taobao.tddl.executor.cursor.ICursorMeta; //导入依赖的package包/类
protected ICursorMeta initSchema() {
if (schemaInited) {
return cursormeta;
}
schemaInited = true;
ColumnMessage colMeta = new ColumnMessage(ResultCursor.AFFECT_ROW, DataType.IntegerType);
CursorMetaImp cursurMetaImp = CursorMetaImp.buildNew("", Arrays.asList(colMeta), 1);
this.cursormeta = cursurMetaImp;
return cursurMetaImp;
}
示例11: buildSchemaInJoin
import com.taobao.tddl.executor.cursor.ICursorMeta; //导入依赖的package包/类
protected void buildSchemaInJoin(ICursorMeta leftCursorMeta, ICursorMeta rightCursorMeta) throws TddlException {
if (schemaInited) {
return;
}
schemaInited = true;
// 以左面数据顺序,作为排序
setOrderBy(left_cursor);
List<ColumnMeta> leftColumns = leftCursorMeta.getColumns();
List<ColumnMeta> rightColumns = rightCursorMeta.getColumns();
this.kvPairComparator = ExecUtils.getComp(this.leftJoinOnColumns,
this.rightJoinOnColumns,
leftCursorMeta,
rightCursorMeta);
List<ColumnMeta> newJoinColumnMsg = new ArrayList<ColumnMeta>(leftColumns.size() + rightColumns.size());
rightCursorOffset = leftCursorMeta.getIndexRange();
newJoinColumnMsg.addAll(leftColumns);
newJoinColumnMsg.addAll(rightColumns);
List<Integer> indexes = new ArrayList<Integer>(newJoinColumnMsg.size());
addIndexToNewIndexes(leftCursorMeta, leftColumns, indexes, 0);
addIndexToNewIndexes(rightCursorMeta, rightColumns, indexes, rightCursorOffset);
ICursorMeta cursorMetaImpJoin = CursorMetaImp.buildNew(newJoinColumnMsg,
indexes,
(leftCursorMeta.getIndexRange() + rightCursorMeta.getIndexRange()));
// setMeta(cursorMetaImpJoin);
this.joinCursorMeta = cursorMetaImpJoin;
}
示例12: addIndexToNewIndexes
import com.taobao.tddl.executor.cursor.ICursorMeta; //导入依赖的package包/类
private void addIndexToNewIndexes(ICursorMeta cursorMeta, List<ColumnMeta> columns, List<Integer> indexes,
int offset) {
for (ColumnMeta cm : columns) {
Integer index = cursorMeta.getIndex(cm.getTableName(), cm.getName(), cm.getAlias());
indexes.add(offset + index);
}
}
示例13: joinRecord
import com.taobao.tddl.executor.cursor.ICursorMeta; //导入依赖的package包/类
public IRowSet joinRecord(IRowSet kv1, IRowSet kv2) throws TddlException {
ICursorMeta leftCursorMeta = null;
ICursorMeta rightCursorMeta = null;
if (kv1 != null) {
leftCursorMeta = kv1.getParentCursorMeta();
}
if (kv2 != null) {
rightCursorMeta = kv2.getParentCursorMeta();
}
buildSchemaInJoin(leftCursorMeta, rightCursorMeta);
IRowSet joinedRowSet = new JoinRowSet(rightCursorOffset, kv1, kv2, joinCursorMeta);
return joinedRowSet;
}
示例14: MergeCursor
import com.taobao.tddl.executor.cursor.ICursorMeta; //导入依赖的package包/类
public MergeCursor(List<ISchematicCursor> cursors, ICursorMeta iCursorMeta, IMerge merge,
ExecutionContext executionContext, List<IOrderBy> orderBys){
super(null, iCursorMeta, orderBys);
this.cursors = cursors;
this.merge = merge;
this.executionContext = executionContext;
setOrderBy(orderBys);
}
示例15: RowsValueScanerImp
import com.taobao.tddl.executor.cursor.ICursorMeta; //导入依赖的package包/类
public RowsValueScanerImp(ICursorMeta cursorMeta, List<ISelectable> left_columns){
super();
this.cursorMeta = cursorMeta;
this.columnsYouWant = left_columns;
indexList = new ArrayList<Integer>(left_columns.size());
for (ISelectable icol : left_columns) {
Integer index = this.cursorMeta.getIndex(icol.getTableName(), icol.getColumnName(), icol.getAlias());
indexList.add(index);
}
}