use of org.apache.calcite.rel.core.CorrelationId in project flink-mirror by flink-ci.
the class HiveParserRexNodeConverter method convertColumn.
private RexNode convertColumn(ExprNodeColumnDesc col) throws SemanticException {
// if this is co-rrelated we need to make RexCorrelVariable(with id and type)
// id and type should be retrieved from outerRR
InputCtx ic = getInputCtx(col);
if (ic == null) {
// we have correlated column, build data type from outer rr
RelDataType rowType = HiveParserTypeConverter.getType(cluster, this.outerRR, null);
if (this.outerNameToPos.get(col.getColumn()) == null) {
throw new SemanticException("Invalid column name " + col.getColumn());
}
int pos = this.outerNameToPos.get(col.getColumn());
CorrelationId colCorr = new CorrelationId(this.correlatedId);
RexNode corExpr = cluster.getRexBuilder().makeCorrel(rowType, colCorr);
return cluster.getRexBuilder().makeFieldAccess(corExpr, pos);
}
int pos = ic.hiveNameToPosMap.get(col.getColumn());
return cluster.getRexBuilder().makeInputRef(ic.calciteInpDataType.getFieldList().get(pos).getType(), pos + ic.offsetInCalciteSchema);
}
Aggregations