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


Java ExecUtils类代码示例

本文整理汇总了Java中com.taobao.tddl.executor.utils.ExecUtils的典型用法代码示例。如果您正苦于以下问题:Java ExecUtils类的具体用法?Java ExecUtils怎么用?Java ExecUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ExecUtils类属于com.taobao.tddl.executor.utils包,在下文中一共展示了ExecUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: serverReduce

import com.taobao.tddl.executor.utils.ExecUtils; //导入依赖的package包/类
/**
 * 外部执行器传递ResultSet中的row记录,进行function的reduce计算
 * 
 * @param kvPair
 * @throws Exception
 */
public void serverReduce(IRowSet kvPair, ExecutionContext ec) throws TddlRuntimeException {

    // 函数的input参数
    List<Object> reduceArgs = this.getReduceArgs(function);

    Object[] inputArg = new Object[reduceArgs.size()];
    // 目前认为所有scalar函数可下推
    for (int i = 0; i < reduceArgs.size(); i++) {
        String name = reduceArgs.get(i).toString();
        Object val = ExecUtils.getValueByTableAndName(kvPair,
            this.function.getTableName(),
            name,
            this.function.getAlias());
        inputArg[i] = val;
    }

    serverReduce(inputArg, ec);
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:25,代码来源:AggregateFunction.java

示例2: compute

import com.taobao.tddl.executor.utils.ExecUtils; //导入依赖的package包/类
@Override
public Object compute(Object[] args, ExecutionContext ec) {
    DataType type = getReturnType();
    if (ExecUtils.isNull(args[0])) {
        return null;
    }

    String d = DataType.StringType.convertFrom(args[0]);
    // get bytes from string
    byte bytes[] = d.getBytes();
    Checksum checksum = new CRC32();
    // update the current checksum with the specified array of bytes
    checksum.update(bytes, 0, bytes.length);
    // get the current checksum value
    return type.convertFrom(checksum.getValue());
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:17,代码来源:Crc32.java

示例3: findOrderByInKey

import com.taobao.tddl.executor.utils.ExecUtils; //导入依赖的package包/类
private boolean findOrderByInKey(List<IOrderBy> orderBys, List<ColumnMeta> columns, ColumnMeta cm,
                                 Set<IOrderBy> hashOrderBys) {
    for (IOrderBy ob : orderBys) {
        ISelectable iSelectable = ob.getColumn();
        String orderByTable = iSelectable.getTableName();

        orderByTable = ExecUtils.getLogicTableName(orderByTable);

        if (cm != null && TStringUtil.equals(ExecUtils.getLogicTableName(cm.getTableName()), orderByTable)) {
            if (TStringUtil.equals(cm.getName(), iSelectable.getColumnName())) {
                ColumnMeta cm2 = new ColumnMeta(cm.getTableName(),
                    cm.getTableName() + "_ANDOR_TABLENAME_" + cm.getName(),
                    cm.getDataType(),
                    cm.getAlias(),
                    cm.isNullable());
                // 列名与order by Match.放到key里
                columns.add(cm2);
                hashOrderBys.add(ob);
                return true;
            }
        }
    }
    return false;
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:25,代码来源:TempTableSortCursor.java

示例4: compute

import com.taobao.tddl.executor.utils.ExecUtils; //导入依赖的package包/类
@Override
public Object compute(Object[] args, ExecutionContext ec) {
    for (Object arg : args) {
        if (ExecUtils.isNull(arg)) {
            return null;
        }
    }

    java.sql.Timestamp timestamp = DataType.TimestampType.convertFrom(args[2]);
    Calendar cal = Calendar.getInstance();
    cal.setTime(timestamp);

    IntervalType date = Interval.paseIntervalDate(args[1], args[0]);
    date.process(cal, 1);

    DataType type = getReturnType();
    return type.convertFrom(cal.getTime());
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:19,代码来源:Timestampadd.java

示例5: compute

import com.taobao.tddl.executor.utils.ExecUtils; //导入依赖的package包/类
@Override
public Object compute(Object[] args, ExecutionContext ec) {
    for (Object arg : args) {
        if (ExecUtils.isNull(arg)) {
            return null;
        }
    }

    String n = DataType.StringType.convertFrom(args[0]);
    Integer f = DataType.IntegerType.convertFrom(args[1]);
    Integer t = DataType.IntegerType.convertFrom(args[2]);
    Object result;
    Long d = Long.valueOf(n, f);
    if (t < 0) {
        result = Long.toString(d, Math.abs(t)).toUpperCase();
        if (d >= 0) {
            result = "-" + result;
        }
    } else {
        result = Long.toString(d, t).toUpperCase();
    }

    return result;
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:25,代码来源:Conv.java

示例6: findOrderByInKey

import com.taobao.tddl.executor.utils.ExecUtils; //导入依赖的package包/类
private boolean findOrderByInKey(List<IOrderBy> orderBys, List<ColumnMeta> columns, ColumnMeta cm,
                                 Set<IOrderBy> hashOrderBys) {
    for (IOrderBy ob : orderBys) {
        ISelectable iSelectable = ob.getColumn();
        String orderByTable = iSelectable.getTableName();

        orderByTable = ExecUtils.getLogicTableName(orderByTable);

        if (cm != null && TStringUtil.equals(ExecUtils.getLogicTableName(cm.getTableName()), orderByTable)) {
            if (TStringUtil.equals(cm.getName(), iSelectable.getColumnName())) {
                ColumnMeta cm2 = new ColumnMeta(cm.getTableName(),
                    cm.getTableName() + "." + cm.getName(),
                    cm.getDataType(),
                    cm.getAlias(),
                    cm.isNullable());
                // 列名与order by Match.放到key里
                columns.add(cm2);
                hashOrderBys.add(ob);
                return true;
            }
        }
    }
    return false;
}
 
开发者ID:beebeandwer,项目名称:TDDL,代码行数:25,代码来源:TempTableSortCursor.java

示例7: compute

import com.taobao.tddl.executor.utils.ExecUtils; //导入依赖的package包/类
@Override
public Object compute(Object[] args, ExecutionContext ec) {
    if (ExecUtils.isNull(args[0])) {
        return null;
    } else if (ExecUtils.isNull(args[1])) {
        return args[0];
    } else {
        DataType type = getReturnType();
        Object t1 = type.convertFrom(args[0]);
        Object t2 = type.convertFrom(args[1]);

        if (t1.equals(t2)) {
            return null;
        } else {
            return t1;
        }
    }
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:19,代码来源:NullIf.java

示例8: blockNestedLoopJoin

import com.taobao.tddl.executor.utils.ExecUtils; //导入依赖的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

示例9: compute

import com.taobao.tddl.executor.utils.ExecUtils; //导入依赖的package包/类
@Override
public Object compute(Object[] args, ExecutionContext ec) {
    Object arg = args[0];

    if (ExecUtils.isNull(arg)) {
        return null;
    }

    BigInteger longlong = DataType.BigIntegerType.convertFrom(arg);

    if (longlong == null) {
        return "0";
    }

    return longlong.toString(2);
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:17,代码来源:Bin.java

示例10: compute

import com.taobao.tddl.executor.utils.ExecUtils; //导入依赖的package包/类
@Override
public Object compute(Object[] args, ExecutionContext ec) {
    if (ExecUtils.isNull(args[0])) {
        return null;
    }

    String str = DataType.StringType.convertFrom(args[0]);
    String delim = DataType.StringType.convertFrom(args[1]);
    Integer count = DataType.IntegerType.convertFrom(args[2]);
    if (count == 0) {
        return "";
    } else if (count > 0) {
        Integer len = TStringUtil.ordinalIndexOf(str, delim, count);
        if (len == -1) {
            return str;
        }
        return TStringUtil.substring(str, 0, len);
    } else {
        count = -count;
        Integer pos = TStringUtil.lastOrdinalIndexOf(str, delim, count);
        return TStringUtil.substring(str, pos + 1);
    }
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:24,代码来源:SubStringIndex.java

示例11: initSchema

import com.taobao.tddl.executor.utils.ExecUtils; //导入依赖的package包/类
private void initSchema(IRowSet firstRowSet, IFilter lf) {
    if (schemaInited) {
        return;
    }
    schemaInited = true;

    List<ColumnMeta> columnMetas = to.getParentCursorMeta().getColumns();
    List<ISelectable> iColumns = ExecUtils.getIColumnsWithISelectable(columnMetas.toArray(new ColumnMeta[0]));
    toComparator = ExecUtils.getComp(iColumns,
        iColumns,
        to.getParentCursorMeta(),
        firstRowSet.getParentCursorMeta());
    fromComparator = ExecUtils.getComp(iColumns,
        iColumns,
        from.getParentCursorMeta(),
        firstRowSet.getParentCursorMeta());
    // init(rangeFilters);
}
 
开发者ID:beebeandwer,项目名称:TDDL,代码行数:19,代码来源:RangeCursor.java

示例12: BlockNestedtLoopCursor

import com.taobao.tddl.executor.utils.ExecUtils; //导入依赖的package包/类
public BlockNestedtLoopCursor(ISchematicCursor leftCursor, ISchematicCursor rightCursor, List leftColumns,
                              List rightColumns, List columns, ICursorFactory cursorFactory, IJoin join,
                              ExecutionContext executionContext, List leftRetColumns, List rightRetColumns)
                                                                                                           throws Exception{
    super(leftCursor, rightCursor, leftColumns, rightColumns, columns, leftRetColumns, rightRetColumns, join);
    this.cursorFactory = cursorFactory;
    this.leftCodec = CodecFactory.getInstance(CodecFactory.FIXED_LENGTH)
        .getCodec(ExecUtils.getColumnMetas(rightColumns));
    this.left_key = leftCodec.newEmptyRecord();
    this.executionContext = executionContext;
    // rightCursorMeta =
    // CursorMetaImp.buildNew(ExecUtils.convertISelectablesToColumnMeta(rightRetColumns,
    // join.getRightNode().getAlias(),
    // join.isSubQuery()));
    this.join = join;
}
 
开发者ID:beebeandwer,项目名称:TDDL,代码行数:17,代码来源:BlockNestedtLoopCursor.java

示例13: compute

import com.taobao.tddl.executor.utils.ExecUtils; //导入依赖的package包/类
@Override
public Object compute(Object[] args, ExecutionContext ec) {
    if (ExecUtils.isNull(args[0])) {
        return null;
    }

    Integer index = DataType.IntegerType.convertFrom(args[0]);

    if (index < 1 || index > args.length - 1) {
        return null;
    }

    Object resEle = args[index];

    if (ExecUtils.isNull(resEle)) {
        return null;
    }

    return DataType.StringType.convertFrom(resEle);

}
 
开发者ID:loye168,项目名称:tddl5,代码行数:22,代码来源:Elt.java

示例14: compute

import com.taobao.tddl.executor.utils.ExecUtils; //导入依赖的package包/类
@Override
public Object compute(Object[] args, ExecutionContext ec) {
    for (Object arg : args) {
        if (ExecUtils.isNull(arg)) {
            return null;
        }
    }

    String substr = DataType.StringType.convertFrom(args[0]);
    String str = DataType.StringType.convertFrom(args[1]);

    Integer pos = null;
    if (args.length == 3) {
        pos = DataType.IntegerType.convertFrom(args[2]);
    }
    if (pos == null) {
        return TStringUtil.indexOf(str, substr) + 1;
    } else {
        return TStringUtil.indexOf(str, substr, pos + 1) + 1;
    }

}
 
开发者ID:loye168,项目名称:tddl5,代码行数:23,代码来源:Locate.java

示例15: compute

import com.taobao.tddl.executor.utils.ExecUtils; //导入依赖的package包/类
@Override
public Object compute(Object[] args, ExecutionContext ec) {
    Object arg = args[0];

    if (ExecUtils.isNull(arg)) {
        return null;
    }

    String str = DataType.StringType.convertFrom(arg);

    if (TStringUtil.isEmpty(str)) {
        return 0;
    }

    return str.length();
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:17,代码来源:CharLength.java


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