本文整理汇总了Java中org.apache.calcite.rex.RexFieldAccess类的典型用法代码示例。如果您正苦于以下问题:Java RexFieldAccess类的具体用法?Java RexFieldAccess怎么用?Java RexFieldAccess使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RexFieldAccess类属于org.apache.calcite.rex包,在下文中一共展示了RexFieldAccess类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: visitFieldAccess
import org.apache.calcite.rex.RexFieldAccess; //导入依赖的package包/类
@Override
public RexNode visitFieldAccess(RexFieldAccess fieldAccess) {
if (cm.mapFieldAccessToCorVar.containsKey(fieldAccess)) {
// if it is a corVar, change it to be input ref.
Correlation corVar = cm.mapFieldAccessToCorVar.get(fieldAccess);
// corVar offset should point to the leftInput of currentRel,
// which is the Correlator.
RexNode newRexNode = new RexInputRef(corVar.field, fieldAccess.getType());
if (projectPulledAboveLeftCorrelator && (nullIndicator != null)) {
// need to enforce nullability by applying an additional
// cast operator over the transformed expression.
newRexNode = createCaseExpression(nullIndicator, rexBuilder.constantNull(), newRexNode);
}
return newRexNode;
}
return fieldAccess;
}
开发者ID:axbaretto,项目名称:flink,代码行数:20,代码来源:FlinkRelDecorrelator.java
示例2: rexVisitor
import org.apache.calcite.rex.RexFieldAccess; //导入依赖的package包/类
private RexVisitorImpl<Void> rexVisitor(final RelNode rel) {
return new RexVisitorImpl<Void>(true) {
@Override
public Void visitFieldAccess(RexFieldAccess fieldAccess) {
final RexNode ref = fieldAccess.getReferenceExpr();
if (ref instanceof RexCorrelVariable) {
final RexCorrelVariable var = (RexCorrelVariable) ref;
final Correlation correlation = new Correlation(var.id, fieldAccess.getField().getIndex(), corrIdGenerator++);
mapFieldAccessToCorVar.put(fieldAccess, correlation);
mapRefRelToCorVar.put(rel, correlation);
}
return super.visitFieldAccess(fieldAccess);
}
@Override
public Void visitSubQuery(RexSubQuery subQuery) {
subQuery.rel.accept(FlinkRelDecorrelator.CorelMapBuilder.this);
return super.visitSubQuery(subQuery);
}
};
}
开发者ID:axbaretto,项目名称:flink,代码行数:22,代码来源:FlinkRelDecorrelator.java
示例3: references
import org.apache.calcite.rex.RexFieldAccess; //导入依赖的package包/类
private boolean references(RexNode e, CorRef correlation) {
switch (e.getKind()) {
case CAST:
final RexNode operand = ((RexCall) e).getOperands().get(0);
if (isWidening(e.getType(), operand.getType())) {
return references(operand, correlation);
}
return false;
case FIELD_ACCESS:
final RexFieldAccess f = (RexFieldAccess) e;
if (f.getField().getIndex() == correlation.field
&& f.getReferenceExpr() instanceof RexCorrelVariable) {
if (((RexCorrelVariable) f.getReferenceExpr()).id == correlation.corr) {
return true;
}
}
// fall through
default:
return false;
}
}
开发者ID:apache,项目名称:calcite,代码行数:22,代码来源:RelDecorrelator.java
示例4: visitFieldAccess
import org.apache.calcite.rex.RexFieldAccess; //导入依赖的package包/类
@Override public RexNode visitFieldAccess(RexFieldAccess fieldAccess) {
if (cm.mapFieldAccessToCorRef.containsKey(fieldAccess)) {
// if it is a corVar, change it to be input ref.
CorRef corVar = cm.mapFieldAccessToCorRef.get(fieldAccess);
// corVar offset should point to the leftInput of currentRel,
// which is the Correlate.
RexNode newRexNode =
new RexInputRef(corVar.field, fieldAccess.getType());
if (projectPulledAboveLeftCorrelator
&& (nullIndicator != null)) {
// need to enforce nullability by applying an additional
// cast operator over the transformed expression.
newRexNode =
createCaseExpression(
nullIndicator,
rexBuilder.constantNull(),
newRexNode);
}
return newRexNode;
}
return fieldAccess;
}
开发者ID:apache,项目名称:calcite,代码行数:25,代码来源:RelDecorrelator.java
示例5: CorelMap
import org.apache.calcite.rex.RexFieldAccess; //导入依赖的package包/类
private CorelMap(Multimap<RelNode, CorRef> mapRefRelToCorRef,
SortedMap<CorrelationId, RelNode> mapCorToCorRel,
Map<RexFieldAccess, CorRef> mapFieldAccessToCorRef) {
this.mapRefRelToCorRef = mapRefRelToCorRef;
this.mapCorToCorRel = mapCorToCorRel;
this.mapFieldAccessToCorRef = ImmutableMap.copyOf(mapFieldAccessToCorRef);
}
开发者ID:apache,项目名称:calcite,代码行数:8,代码来源:RelDecorrelator.java
示例6: of
import org.apache.calcite.rex.RexFieldAccess; //导入依赖的package包/类
/** Creates a CorelMap with given contents. */
public static CorelMap of(
SortedSetMultimap<RelNode, CorRef> mapRefRelToCorVar,
SortedMap<CorrelationId, RelNode> mapCorToCorRel,
Map<RexFieldAccess, CorRef> mapFieldAccessToCorVar) {
return new CorelMap(mapRefRelToCorVar, mapCorToCorRel,
mapFieldAccessToCorVar);
}
开发者ID:apache,项目名称:calcite,代码行数:9,代码来源:RelDecorrelator.java
示例7: rexVisitor
import org.apache.calcite.rex.RexFieldAccess; //导入依赖的package包/类
private RexVisitorImpl<Void> rexVisitor(final RelNode rel) {
return new RexVisitorImpl<Void>(true) {
@Override public Void visitFieldAccess(RexFieldAccess fieldAccess) {
final RexNode ref = fieldAccess.getReferenceExpr();
if (ref instanceof RexCorrelVariable) {
final RexCorrelVariable var = (RexCorrelVariable) ref;
if (mapFieldAccessToCorVar.containsKey(fieldAccess)) {
// for cases where different Rel nodes are referring to
// same correlation var (e.g. in case of NOT IN)
// avoid generating another correlation var
// and record the 'rel' is using the same correlation
mapRefRelToCorRef.put(rel,
mapFieldAccessToCorVar.get(fieldAccess));
} else {
final CorRef correlation =
new CorRef(var.id, fieldAccess.getField().getIndex(),
corrIdGenerator++);
mapFieldAccessToCorVar.put(fieldAccess, correlation);
mapRefRelToCorRef.put(rel, correlation);
}
}
return super.visitFieldAccess(fieldAccess);
}
@Override public Void visitSubQuery(RexSubQuery subQuery) {
subQuery.rel.accept(CorelMapBuilder.this);
return super.visitSubQuery(subQuery);
}
};
}
开发者ID:apache,项目名称:calcite,代码行数:31,代码来源:RelDecorrelator.java
示例8: trimChild
import org.apache.calcite.rex.RexFieldAccess; //导入依赖的package包/类
/**
* Trims the fields of an input relational expression.
*
* @param rel Relational expression
* @param input Input relational expression, whose fields to trim
* @param fieldsUsed Bitmap of fields needed by the consumer
* @return New relational expression and its field mapping
*/
protected TrimResult trimChild(
RelNode rel,
RelNode input,
final ImmutableBitSet fieldsUsed,
Set<RelDataTypeField> extraFields) {
final ImmutableBitSet.Builder fieldsUsedBuilder = fieldsUsed.rebuild();
// Fields that define the collation cannot be discarded.
final RelMetadataQuery mq = rel.getCluster().getMetadataQuery();
final ImmutableList<RelCollation> collations = mq.collations(input);
for (RelCollation collation : collations) {
for (RelFieldCollation fieldCollation : collation.getFieldCollations()) {
fieldsUsedBuilder.set(fieldCollation.getFieldIndex());
}
}
// Correlating variables are a means for other relational expressions to use
// fields.
for (final CorrelationId correlation : rel.getVariablesSet()) {
rel.accept(
new CorrelationReferenceFinder() {
protected RexNode handle(RexFieldAccess fieldAccess) {
final RexCorrelVariable v =
(RexCorrelVariable) fieldAccess.getReferenceExpr();
if (v.id.equals(correlation)) {
fieldsUsedBuilder.set(fieldAccess.getField().getIndex());
}
return fieldAccess;
}
});
}
return dispatchTrimFields(input, fieldsUsedBuilder.build(), extraFields);
}
开发者ID:apache,项目名称:calcite,代码行数:43,代码来源:RelFieldTrimmer.java
示例9: result
import org.apache.calcite.rex.RexFieldAccess; //导入依赖的package包/类
protected TrimResult result(RelNode r, final Mapping mapping) {
final RexBuilder rexBuilder = relBuilder.getRexBuilder();
for (final CorrelationId correlation : r.getVariablesSet()) {
r = r.accept(
new CorrelationReferenceFinder() {
protected RexNode handle(RexFieldAccess fieldAccess) {
final RexCorrelVariable v =
(RexCorrelVariable) fieldAccess.getReferenceExpr();
if (v.id.equals(correlation)
&& v.getType().getFieldCount() == mapping.getSourceCount()) {
final int old = fieldAccess.getField().getIndex();
final int new_ = mapping.getTarget(old);
final RelDataTypeFactory.Builder typeBuilder =
relBuilder.getTypeFactory().builder();
for (int target : Util.range(mapping.getTargetCount())) {
typeBuilder.add(
v.getType().getFieldList().get(mapping.getSource(target)));
}
final RexNode newV =
rexBuilder.makeCorrel(typeBuilder.build(), v.id);
if (old != new_) {
return rexBuilder.makeFieldAccess(newV, new_);
}
}
return fieldAccess;
}
});
}
return new TrimResult(r, mapping);
}
开发者ID:apache,项目名称:calcite,代码行数:31,代码来源:RelFieldTrimmer.java
示例10: visitFieldAccess
import org.apache.calcite.rex.RexFieldAccess; //导入依赖的package包/类
@Override public RexNode visitFieldAccess(RexFieldAccess fieldAccess) {
if (fieldAccess.getReferenceExpr() instanceof RexCorrelVariable) {
final RexCorrelVariable v =
(RexCorrelVariable) fieldAccess.getReferenceExpr();
variableFields.put(v.id, fieldAccess.getField().getIndex());
}
return super.visitFieldAccess(fieldAccess);
}
开发者ID:apache,项目名称:calcite,代码行数:9,代码来源:RelOptUtil.java
示例11: visitFieldAccess
import org.apache.calcite.rex.RexFieldAccess; //导入依赖的package包/类
public Void visitFieldAccess(RexFieldAccess fieldAccess) {
return pushVariable();
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:4,代码来源:FindPartitionConditions.java
示例12: visitFieldAccess
import org.apache.calcite.rex.RexFieldAccess; //导入依赖的package包/类
@Override
public RexNode visitFieldAccess(RexFieldAccess fieldAccess) {
return fieldAccess;
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:5,代码来源:RewriteAsBinaryOperators.java
示例13: visitFieldAccess
import org.apache.calcite.rex.RexFieldAccess; //导入依赖的package包/类
@Override
public LogicalExpression visitFieldAccess(RexFieldAccess fieldAccess) {
return super.visitFieldAccess(fieldAccess);
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:5,代码来源:DrillOptiq.java
示例14: visitFieldAccess
import org.apache.calcite.rex.RexFieldAccess; //导入依赖的package包/类
@Override
public Boolean visitFieldAccess(RexFieldAccess fieldAccess) {
return doUnknown(fieldAccess);
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:5,代码来源:DrillProjectRelBase.java
示例15: visitFieldAccess
import org.apache.calcite.rex.RexFieldAccess; //导入依赖的package包/类
@Override
public Boolean visitFieldAccess(RexFieldAccess paramRexFieldAccess) {
return paramRexFieldAccess.getReferenceExpr().accept(this);
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:5,代码来源:JdbcExpressionCheck.java
示例16: visitFieldAccess
import org.apache.calcite.rex.RexFieldAccess; //导入依赖的package包/类
@Override
public Boolean visitFieldAccess(RexFieldAccess fieldAccess) {
return true;
}
开发者ID:dremio,项目名称:dremio-oss,代码行数:5,代码来源:RewriteProjectToFlattenRule.java
示例17: visitFieldAccess
import org.apache.calcite.rex.RexFieldAccess; //导入依赖的package包/类
@Override
public StateHolder visitFieldAccess(RexFieldAccess fieldAccess) {
return new StateHolder(Type.OTHER, fieldAccess);
}
开发者ID:dremio,项目名称:dremio-oss,代码行数:5,代码来源:FindSimpleFilters.java
示例18: visitFieldAccess
import org.apache.calcite.rex.RexFieldAccess; //导入依赖的package包/类
@Override
public RexNode visitFieldAccess(RexFieldAccess fieldAccess) {
foundFieldAccess = true;
return super.visitFieldAccess(fieldAccess);
}
开发者ID:dremio,项目名称:dremio-oss,代码行数:6,代码来源:RexSubQueryUtils.java
示例19: visitFieldAccess
import org.apache.calcite.rex.RexFieldAccess; //导入依赖的package包/类
@Override
public Boolean visitFieldAccess(RexFieldAccess fieldAccess) {
return false;
}
开发者ID:dremio,项目名称:dremio-oss,代码行数:5,代码来源:MoreRelOptUtil.java
示例20: visitFieldAccess
import org.apache.calcite.rex.RexFieldAccess; //导入依赖的package包/类
@Override
public Expression visitFieldAccess(RexFieldAccess fieldAccess) {
return super.visitFieldAccess(fieldAccess);
}
开发者ID:dremio,项目名称:dremio-oss,代码行数:5,代码来源:PredicateAnalyzer.java
注:本文中的org.apache.calcite.rex.RexFieldAccess类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论