本文整理匯總了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;
}