本文整理汇总了Java中com.taobao.tddl.executor.cursor.IValueFilterCursor类的典型用法代码示例。如果您正苦于以下问题:Java IValueFilterCursor类的具体用法?Java IValueFilterCursor怎么用?Java IValueFilterCursor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IValueFilterCursor类属于com.taobao.tddl.executor.cursor包,在下文中一共展示了IValueFilterCursor类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: blockNestedLoopJoin
import com.taobao.tddl.executor.cursor.IValueFilterCursor; //导入依赖的package包/类
private void blockNestedLoopJoin(List<CloneableRecord> leftJoinOnColumnCache, IColumn rightColumn,
IValueFilterCursor vfc, Map<CloneableRecord, DuplicateKVPair> records)
throws TddlException {
IRowSet kv = null;
while ((kv = vfc.next()) != null) {
kv = ExecUtils.fromIRowSetToArrayRowSet(kv);
Object rightValue = ExecUtils.getValueByIColumn(kv, rightColumn);
for (CloneableRecord record : leftJoinOnColumnCache) {
Comparable comp = (Comparable) record.getMap().values().iterator().next();
if (rightValue.equals(comp)) {
buildDuplicate(records, kv, record);
break;
}
}
}
}
示例2: getRecordFromRightByValueFilter
import com.taobao.tddl.executor.cursor.IValueFilterCursor; //导入依赖的package包/类
protected Map<CloneableRecord, DuplicateKVPair> getRecordFromRightByValueFilter(List<CloneableRecord> leftJoinOnColumnCache)
throws TddlException {
right_cursor.beforeFirst();
if (isLeftOutJoin() && this.rightCursorMeta == null) {
IRowSet kv = right_cursor.next();
if (kv != null) {
this.rightCursorMeta = kv.getParentCursorMeta();
} else {
rightCursorMeta = CursorMetaImp.buildNew(right_cursor.getReturnColumns());
}
right_cursor.beforeFirst();
}
IBooleanFilter ibf = ASTNodeFactory.getInstance().createBooleanFilter();
ibf.setOperation(OPERATION.IN);
ibf.setValues(new ArrayList<Object>());
for (CloneableRecord record : leftJoinOnColumnCache) {
Map<String, Object> recordMap = record.getMap();
if (recordMap.size() == 1) {
// 单字段in
Entry<String, Object> entry = recordMap.entrySet().iterator().next();
Object comp = entry.getValue();
ibf.setColumn(this.rightJoinOnColumns.get(0).copy());
ibf.getValues().add(comp);
} else {
// 多字段in
if (ibf.getColumn() == null) {
ibf.setColumn(buildRowFunction(recordMap.keySet(), true, record));
}
ibf.getValues().add(buildRowFunction(recordMap.values(), false, record));
}
}
IColumn rightColumn = (IColumn) this.rightJoinOnColumns.get(0);
IValueFilterCursor vfc = this.cursorFactory.valueFilterCursor(executionContext, right_cursor, ibf);
Map<CloneableRecord, DuplicateKVPair> records = new HashMap();
if (isLeftOutJoin() && !isRightOutJoin()) {
blockNestedLoopJoin(leftJoinOnColumnCache, rightColumn, vfc, records);
} else if (!isLeftOutJoin() && !isRightOutJoin()) {
// inner join
blockNestedLoopJoin(leftJoinOnColumnCache, rightColumn, vfc, records);
} else {
throw new UnsupportedOperationException("leftOutJoin:" + isLeftOutJoin() + " ; rightOutJoin:"
+ isRightOutJoin());
}
return records;
}
示例3: getRecordFromRightByValueFilter
import com.taobao.tddl.executor.cursor.IValueFilterCursor; //导入依赖的package包/类
protected Map<CloneableRecord, DuplicateKVPair> getRecordFromRightByValueFilter(List<CloneableRecord> leftJoinOnColumnCache)
throws TddlException {
right_cursor.beforeFirst();
if (isLeftOutJoin() && this.rightCursorMeta == null) {
IRowSet kv = right_cursor.next();
if (kv != null) {
this.rightCursorMeta = kv.getParentCursorMeta();
} else {
rightCursorMeta = CursorMetaImp.buildNew(right_cursor.getReturnColumns());
}
right_cursor.beforeFirst();
}
IBooleanFilter filter = ASTNodeFactory.getInstance().createBooleanFilter();
List<Object> values = new ArrayList<Object>();
for (CloneableRecord record : leftJoinOnColumnCache) {
Map<String, Object> recordMap = record.getMap();
if (recordMap.size() != 1) {
throw new IllegalArgumentException("目前只支持单值查询吧。。简化一点");
}
Comparable comp = (Comparable) record.getMap().values().iterator().next();
values.add(comp);
}
filter.setOperation(OPERATION.IN);
filter.setValues(values);
filter.setColumn(this.rightJoinOnColumns.get(0));
IColumn rightColumn = (IColumn) this.rightJoinOnColumns.get(0);
IValueFilterCursor vfc = this.cursorFactory.valueFilterCursor(executionContext, right_cursor, filter);
Map<CloneableRecord, DuplicateKVPair> records = new HashMap();
if (isLeftOutJoin() && !isRightOutJoin()) {
blockNestedLoopJoin(leftJoinOnColumnCache, rightColumn, vfc, records);
} else if (!isLeftOutJoin() && !isRightOutJoin()) {
// inner join
blockNestedLoopJoin(leftJoinOnColumnCache, rightColumn, vfc, records);
} else {
throw new UnsupportedOperationException("不支持该操作 leftOutJoin:" + isLeftOutJoin() + " ; rightOutJoin:"
+ isRightOutJoin());
}
return records;
}
示例4: valueFilterCursor
import com.taobao.tddl.executor.cursor.IValueFilterCursor; //导入依赖的package包/类
/**
* 用来针对每一个值进行过滤的cursor. 将join merge query得到的结果中的每一行,放入这个value
* cursor里面进行匹配,为true则认为成功。
*
* @param cursor
* @param filter
* @param executionContext TODO
* @return
*/
IValueFilterCursor valueFilterCursor(ExecutionContext context, ISchematicCursor cursor, IFilter filter)
throws TddlException;