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


Java ExecUtils.getLogicTableName方法代码示例

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


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

示例1: 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

示例2: putRetColumnInMeta

import com.taobao.tddl.executor.utils.ExecUtils; //导入方法依赖的package包/类
void putRetColumnInMeta(ISelectable column, List<ColumnMeta> metaColumns) {
    String columnName;

    columnName = column.getColumnName();
    DataType type = null;

    // 函数在Map和Reduce过程中的返回类型可以不同
    // 如Avg,map过程返回String
    // reduce过程中返回数字类型
    if (this.isMerge()) {
        type = column.getDataType();
    } else {
        if (column instanceof IFunction) {
            type = ((IFunction) column).getExtraFunction().getMapReturnType();
        } else {
            type = column.getDataType();
        }
    }

    ColumnMeta cm = new ColumnMeta(ExecUtils.getLogicTableName(column.getTableName()),
        columnName,
        type,
        column.getAlias(),
        true);
    metaColumns.add(cm);
}
 
开发者ID:beebeandwer,项目名称:TDDL,代码行数:27,代码来源:AggregateCursor.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() + "." + 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

示例4: nestBuildTableAndSchema

import com.taobao.tddl.executor.utils.ExecUtils; //导入方法依赖的package包/类
/**
 * 准备indexMeta和ITable信息
 * 
 * @param tableAndIndex
 */
protected void nestBuildTableAndSchema(String groupDataNode, TableAndIndex tableAndIndex,
                                       ExecutionContext executionContext, String indexName, String actualTable,
                                       boolean logicalIndex) throws TddlException {
    if (indexName != null && !"".equals(indexName)) {
        String tableName = ExecUtils.getLogicTableName(indexName);
        TableMeta ts = getTableMeta(tableName);
        tableAndIndex.index = ts.getIndexMeta(indexName);
        tableAndIndex.table = executionContext.getCurrentRepository().getTable(ts, groupDataNode, actualTable);
    }
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:16,代码来源:HandlerCommon.java

示例5: getIndex

import com.taobao.tddl.executor.utils.ExecUtils; //导入方法依赖的package包/类
private Integer getIndex(String tableName, String columnName) {
    tableName = ExecUtils.getLogicTableName(tableName);
    ColumnHolder ch = indexMap.get(columnName);
    if (ch == null) {
        return null;
    }
    // 第一个P
    Integer index = null;
    if (tableName == null /* || ch.next == null */) {// hook tableName ==
        // null.取第一个,如果没有下一个,那么无论表名是什么都返回当前的。。因为没的选择。
        return ch.index;
    }
    index = findTableName(tableName, ch);
    if (index != null) {
        return index;
    }
    ColumnHolder nextCh = ch;
    // 其它的ColumnHolder
    while ((nextCh = nextCh.next) != null) {
        index = findTableName(tableName, nextCh);
        if (index != null) {
            return index;
        }
    }

    return ch.index;
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:28,代码来源:CursorMetaImp.java

示例6: addAColumn

import com.taobao.tddl.executor.utils.ExecUtils; //导入方法依赖的package包/类
protected void addAColumn(String tableName, String colName, String colAlias, Integer index) {

        tableName = ExecUtils.getLogicTableName(tableName);
        ColumnHolder ch = indexMap.get(colName);
        if (ch == null) {
            ch = new ColumnHolder(null, tableName, index);
            indexMap.put(colName, ch);

            return;
        }

        boolean success = findTableAndReplaceIndexNumber(tableName, index, ch);
        if (success) {
            return;
        }
        ColumnHolder nextCh;
        // 其它的ColumnHolder
        while ((nextCh = ch.next) != null) {
            success = findTableAndReplaceIndexNumber(tableName, index, nextCh);
            if (success) {
                return;
            }

            ch = ch.next;
        }

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

示例7: putRetColumnInMeta

import com.taobao.tddl.executor.utils.ExecUtils; //导入方法依赖的package包/类
void putRetColumnInMeta(ISelectable column, List<ColumnMeta> metaColumns) {
    String columnName;

    columnName = column.getColumnName();
    DataType type = null;

    // 函数在Map和Reduce过程中的返回类型可以不同
    // 如Avg,map过程返回String
    // reduce过程中返回数字类型
    if (this.isMerge()) {
        type = column.getDataType();
    } else {
        if (column instanceof IFunction) {

            if (((IFunction) column).getFunctionType().equals(FunctionType.Aggregate)) {
                type = ((AggregateFunction) ((IFunction) column).getExtraFunction()).getMapReturnType();
            } else {
                type = column.getDataType();
            }
        } else {
            type = column.getDataType();
        }
    }

    ColumnMeta cm = new ColumnMeta(ExecUtils.getLogicTableName(column.getTableName()),
        columnName,
        type,
        column.getAlias(),
        true);
    metaColumns.add(cm);
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:32,代码来源:AggregateCursor.java

示例8: findOrderByInKey

import com.taobao.tddl.executor.utils.ExecUtils; //导入方法依赖的package包/类
private IOrderBy findOrderByInKey(List<IOrderBy> orderBys, ColumnMeta cm) {
    for (IOrderBy ob : orderBys) {
        ISelectable orderByColumn = ob.getColumn();
        String orderByTable = orderByColumn.getTableName();
        orderByTable = ExecUtils.getLogicTableName(orderByTable);
        if (cm != null && TStringUtil.equals(ExecUtils.getLogicTableName(cm.getTableName()), orderByTable)) {
            if (TStringUtil.equals(cm.getName(), orderByColumn.getColumnName())) {
                return ob;
            }
        }
    }
    return null;
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:14,代码来源:TempTableCursor.java

示例9: nestBuildTableAndSchema

import com.taobao.tddl.executor.utils.ExecUtils; //导入方法依赖的package包/类
/**
 * 准备indexMeta和ITable信息
 */
protected void nestBuildTableAndSchema(String groupDataNode, ExecutionContext executionContext, String indexName,
                                       String actualTable, boolean logicalIndex) throws TddlException {
    if (indexName != null && !"".equals(indexName)) {
        String tableName = ExecUtils.getLogicTableName(indexName);
        TableMeta ts = getTableMeta(tableName);
        executionContext.setMeta(ts.getIndexMeta(indexName));
        executionContext.setTable(executionContext.getCurrentRepository().getTable(ts, groupDataNode));
    }
}
 
开发者ID:beebeandwer,项目名称:TDDL,代码行数:13,代码来源:HandlerCommon.java

示例10: getIndex

import com.taobao.tddl.executor.utils.ExecUtils; //导入方法依赖的package包/类
@Override
public Integer getIndex(String tableName, String columnName) {
    tableName = ExecUtils.getLogicTableName(tableName);
    ColumnHolder ch = indexMap.get(columnName);
    if (ch == null) {
        return null;
    }
    // 第一个P
    Integer index = null;
    if (tableName == null /* || ch.next == null */) {// hook tableName ==
        // null.取第一个,如果没有下一个,那么无论表名是什么都返回当前的。。因为没的选择。
        return ch.index;
    }
    index = findTableName(tableName, ch);
    if (index != null) {
        return index;
    }
    ColumnHolder nextCh = ch;
    // 其它的ColumnHolder
    while ((nextCh = nextCh.next) != null) {
        index = findTableName(tableName, nextCh);
        if (index != null) {
            return index;
        }
    }
    // throw new IllegalArgumentException("can't find Index by tableName : "
    // + tableName + " colname : " + columnName + " .index Map : "
    // + indexMap);
    return null;
}
 
开发者ID:beebeandwer,项目名称:TDDL,代码行数:31,代码来源:CursorMetaImp.java

示例11: addAColumn

import com.taobao.tddl.executor.utils.ExecUtils; //导入方法依赖的package包/类
protected void addAColumn(String tableName, String colName, String colAlias, Integer index) {
    if (indexMap == null) {
        indexMap = new HashMap<String, CursorMetaImp.ColumnHolder>();
    }

    // if (aliasIndexMap == null) {
    // aliasIndexMap = new HashMap<String, CursorMetaImp.ColumnHolder>();
    // }

    tableName = ExecUtils.getLogicTableName(tableName);
    ColumnHolder ch = indexMap.get(colName);
    if (ch == null) {
        ch = new ColumnHolder(null, tableName, index);
        indexMap.put(colName, ch);

        // if (colAlias != null) aliasIndexMap.put(colAlias, ch);
        return;
    }

    boolean success = findTableAndReplaceIndexNumber(tableName, index, ch);
    if (success) {
        return;
    }
    ColumnHolder nextCh = null;
    // 其它的ColumnHolder
    while ((nextCh = ch.next) != null) {
        success = findTableAndReplaceIndexNumber(tableName, index, nextCh);
        if (success) {
            return;
        }
    }

}
 
开发者ID:beebeandwer,项目名称:TDDL,代码行数:34,代码来源:CursorMetaImp.java

示例12: initAliasSchema

import com.taobao.tddl.executor.utils.ExecUtils; //导入方法依赖的package包/类
private void initAliasSchema(List<ISelectable> retColumns, String tableAlias, ICursorMeta cursormeta)
                                                                                                     throws TddlException {
    if (schemaInited) {
        return;
    }
    colMessages = new ArrayList<ColumnMeta>(retColumns.size());
    List<Integer> indexes = new ArrayList<Integer>(colMessages.size());
    for (ISelectable col : retColumns) {
        ColumnMeta cm = null;
        String tableName = col.getTableName();
        if (tableAlias != null) {
            if (tableName == null || tableAlias.startsWith(tableName)) {
                // 如果以tableName作为开始,那么认为认为是相同名字,因此也做截断处理,取alias的.之前的数据。
                // 最好也让优化器协助,不允许在alias里面出现"."
                tableAlias = ExecUtils.getLogicTableName(tableAlias);
            }
        }
        if (!TStringUtil.isBlank(col.getAlias())) {
            if (TStringUtil.isBlank(tableAlias)) {
                cm = ExecUtils.getColumnMeta(col, col.getAlias());
            } else {
                cm = ExecUtils.getColumnMeta(col, tableAlias, col.getAlias());
            }
        } else {
            if (TStringUtil.isBlank(tableAlias)) {
                cm = ExecUtils.getColumnMeta(col);
            } else {
                cm = ExecUtils.getColumnMetaTable(col, tableAlias);
            }
        }
        Integer index = cursormeta.getIndex(col.getTableName(), col.getColumnName(), col.getAlias());

        if (index != null) {
            indexes.add(index);
            colMessages.add(cm);
        }
    }
    if (!TStringUtil.isBlank(tableAlias)) {
        // 如果没有就用下层的tableName
        newMeta = CursorMetaImp.buildNew(colMessages, indexes, cursormeta.getIndexRange());
        List<IOrderBy> obOld = getOrderBy();
        if (obOld != null) {
            List<IOrderBy> obNew = new ArrayList<IOrderBy>(obOld.size());
            for (IOrderBy orderBy : obOld) {
                IColumn icol = ExecUtils.getIColumn(orderBy.getColumn());
                IColumn icolNew = icol.copy();
                obNew.add(ASTNodeFactory.getInstance()
                    .createOrderBy()
                    .setColumn(icolNew.setTableName(tableAlias).setAlias(null))
                    .setDirection(orderBy.getDirection()));
            }
            setOrderBy(obNew);
        }
    } else {
        newMeta = CursorMetaImp.buildNew(colMessages, indexes, cursormeta.getIndexRange());
    }
    schemaInited = true;
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:59,代码来源:ColumnAliasCursor.java

示例13: initAliasSchema

import com.taobao.tddl.executor.utils.ExecUtils; //导入方法依赖的package包/类
private void initAliasSchema(List<ISelectable> retColumns, String tableAlias, ICursorMeta cursormeta) {
    if (schemaInited) {
        return;
    }
    colMessages = new ArrayList<ColumnMeta>(retColumns.size());
    List<Integer> indexes = new ArrayList<Integer>(colMessages.size());
    for (ISelectable col : retColumns) {
        ColumnMeta cm = null;
        String tableName = col.getTableName();
        if (tableAlias != null) {
            if (tableName == null || tableAlias.startsWith(tableName)) {
                // 如果以tableName作为开始,那么认为认为是相同名字,因此也做截断处理,取alias的.之前的数据。
                // 最好也让优化器协助,不允许在alias里面出现"."
                tableAlias = ExecUtils.getLogicTableName(tableAlias);
            }
        }
        if (!TStringUtil.isBlank(col.getAlias())) {
            if (TStringUtil.isBlank(tableAlias)) {
                cm = ExecUtils.getColumnMeta(col, col.getAlias());
            } else {
                cm = ExecUtils.getColumnMeta(col, tableAlias, col.getAlias());
            }
        } else {
            if (TStringUtil.isBlank(tableAlias)) {
                cm = ExecUtils.getColumnMeta(col);
            } else {
                cm = ExecUtils.getColumnMetaTable(col, tableAlias);
            }
        }
        Integer index = cursormeta.getIndex(col.getTableName(), col.getColumnName());
        if (index == null) {
            index = cursormeta.getIndex(col.getTableName(), col.getAlias());
        }

        if (index != null) {
            indexes.add(index);
            colMessages.add(cm);
        }
    }
    if (!TStringUtil.isBlank(tableAlias)) {
        // 如果没有就用下层的tableName
        newMeta = CursorMetaImp.buildNew(colMessages, indexes, cursormeta.getIndexRange());
        List<IOrderBy> obOld = getOrderBy();
        if (obOld != null) {
            List<IOrderBy> obNew = new ArrayList<IOrderBy>(obOld.size());
            for (IOrderBy orderBy : obOld) {
                IColumn icol = ExecUtils.getIColumn(orderBy.getColumn());
                IColumn icolNew = icol.copy();
                obNew.add(ASTNodeFactory.getInstance()
                    .createOrderBy()
                    .setColumn(icolNew.setTableName(tableAlias).setAlias(null))
                    .setDirection(orderBy.getDirection()));
            }
            setOrderBy(obNew);
        }
    } else {
        newMeta = CursorMetaImp.buildNew(colMessages, indexes, cursormeta.getIndexRange());
    }
    schemaInited = true;
}
 
开发者ID:beebeandwer,项目名称:TDDL,代码行数:61,代码来源:ColumnAliasCursor.java


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