本文整理汇总了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);
}
}
}
示例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;
}