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


Java IValueFilterCursor类代码示例

本文整理汇总了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;
            }
        }
    }
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:18,代码来源:BlockNestedtLoopCursor.java

示例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;
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:52,代码来源:BlockNestedtLoopCursor.java

示例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;
}
 
开发者ID:beebeandwer,项目名称:TDDL,代码行数:47,代码来源:BlockNestedtLoopCursor.java

示例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;
 
开发者ID:loye168,项目名称:tddl5,代码行数:12,代码来源:ICursorFactory.java


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