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


Java RelDataTypeField.getType方法代码示例

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


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

示例1: implementRewrite

import org.eigenbase.reltype.RelDataTypeField; //导入方法依赖的package包/类
/**
 * Because OLAPTableScan is reused for the same table, we can't use
 * this.context and have to use parent context
 */
@Override
public void implementRewrite(RewriteImplementor implementor) {
    Map<String, RelDataType> rewriteFields = this.context.rewriteFields;
    if (implementor.getParentContext() != null) {
        rewriteFields = implementor.getParentContext().rewriteFields;
    }

    for (Map.Entry<String, RelDataType> rewriteField : rewriteFields.entrySet()) {
        String fieldName = rewriteField.getKey();
        RelDataTypeField field = rowType.getField(fieldName, true);
        if (field != null) {
            RelDataType fieldType = field.getType();
            rewriteField.setValue(fieldType);
        }
    }
}
 
开发者ID:KylinOLAP,项目名称:Kylin,代码行数:21,代码来源:OLAPTableScan.java

示例2: implementRewrite

import org.eigenbase.reltype.RelDataTypeField; //导入方法依赖的package包/类
@Override
public void implementRewrite(RewriteImplementor implementor) {
    implementor.visitChild(this, getChild());

    this.rewriting = true;

    // project before join or is just after OLAPToEnumerableConverter
    if (!RewriteImplementor.needRewrite(this.context) || (this.hasJoin && !this.afterJoin) || this.afterAggregate) {
        this.columnRowType = this.buildColumnRowType();
        return;
    }

    // find missed rewrite fields
    int paramIndex = this.rowType.getFieldList().size();
    List<RelDataTypeField> newFieldList = new LinkedList<RelDataTypeField>();
    List<RexNode> newExpList = new LinkedList<RexNode>();
    ColumnRowType inputColumnRowType = ((OLAPRel) getChild()).getColumnRowType();

    for (Map.Entry<String, RelDataType> rewriteField : this.context.rewriteFields.entrySet()) {
        String rewriteFieldName = rewriteField.getKey();
        int rowIndex = this.columnRowType.getIndexByName(rewriteFieldName);
        if (rowIndex < 0) {
            int inputIndex = inputColumnRowType.getIndexByName(rewriteFieldName);
            if (inputIndex >= 0) {
                // new field
                RelDataType fieldType = rewriteField.getValue();
                RelDataTypeField newField = new RelDataTypeFieldImpl(rewriteFieldName, paramIndex++, fieldType);
                newFieldList.add(newField);
                // new project
                RelDataTypeField inputField = getChild().getRowType().getFieldList().get(inputIndex);
                RexInputRef newFieldRef = new RexInputRef(inputField.getIndex(), inputField.getType());
                newExpList.add(newFieldRef);
            }
        }
    }

    if (!newFieldList.isEmpty()) {
        // rebuild projects
        List<RexNode> newProjects = new ArrayList<RexNode>(this.rewriteProjects);
        newProjects.addAll(newExpList);
        this.rewriteProjects = newProjects;

        // rebuild row type
        FieldInfoBuilder fieldInfo = getCluster().getTypeFactory().builder();
        fieldInfo.addAll(this.rowType.getFieldList());
        fieldInfo.addAll(newFieldList);
        this.rowType = getCluster().getTypeFactory().createStructType(fieldInfo);
    }

    // rebuild columns
    this.columnRowType = this.buildColumnRowType();

    this.rewriting = false;
}
 
开发者ID:KylinOLAP,项目名称:Kylin,代码行数:55,代码来源:OLAPProjectRel.java


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