本文整理汇总了Java中com.taobao.tddl.executor.cursor.ICursorMeta.getColumns方法的典型用法代码示例。如果您正苦于以下问题:Java ICursorMeta.getColumns方法的具体用法?Java ICursorMeta.getColumns怎么用?Java ICursorMeta.getColumns使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.taobao.tddl.executor.cursor.ICursorMeta
的用法示例。
在下文中一共展示了ICursorMeta.getColumns方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: buildSchemaInJoin
import com.taobao.tddl.executor.cursor.ICursorMeta; //导入方法依赖的package包/类
protected void buildSchemaInJoin(ICursorMeta leftCursorMeta, ICursorMeta rightCursorMeta) {
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;
}
示例3: buildColumnMeta
import com.taobao.tddl.executor.cursor.ICursorMeta; //导入方法依赖的package包/类
private void buildColumnMeta(List<IOrderBy> orderBys, List<ColumnMeta> keyColumns, List<ColumnMeta> valueColumns,
IRowSet kv, List<ColumnMeta> metaValueColumns, List<ColumnMeta> metaKeyColumns) {
ICursorMeta cursorMeta = kv.getParentCursorMeta();
List<ColumnMeta> columnMeta = cursorMeta.getColumns();
Set<IOrderBy> hashOrderBys = new HashSet<IOrderBy>();
for (ColumnMeta cm : columnMeta) {
/**
* 为了防止有列名相同的列,新建一个列,列名由原表名和列名组成
*/
ColumnMeta columnInTempTable = new ColumnMeta(cm.getTableName(),
cm.getTableName() + _TDDL_TABLENAME + cm.getName(),
cm.getDataType(),
cm.getAlias(),
cm.isNullable());
IOrderBy orderBy = findOrderByInKey(orderBys, cm);
if (orderBy != null) {
keyColumns.add(columnInTempTable);
hashOrderBys.add(orderBy);
if (!metaKeyColumns.contains(cm)) {
metaKeyColumns.add(cm);
}
} else {
// 列名与order by not match ,放到value里
if (!valueColumns.contains(columnInTempTable)) {
valueColumns.add(columnInTempTable);
}
if (!metaValueColumns.contains(cm)) {
metaValueColumns.add(cm);
}
}
}
if (keyColumns.size() < orderBys.size()) {
// order by 的列不存在与cursor中,不可能吧
throw new RuntimeException("should not be here");
}
// 是否针对重复的value进行排序
if (sortedDuplicates) {// identity
valueColumns.add(new ColumnMeta(keyColumns.get(0).getTableName(),
identity,
DataType.IntegerType,
null,
true));
}
}