Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/src/main/java/org/apache/calcite/plan/Convention.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ default boolean useAbstractConvertersForConversion(RelTraitSet fromTraits,
return false;
}

/** Return RelFactories struct for this convention. It can can be used to
/** Return RelFactories struct for this convention. It can be used to
* build RelNode. */
default RelFactories.Struct getRelFactories() {
return RelFactories.DEFAULT_STRUCT;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ protected void apply(RelOptRuleCall call, @Nullable Project postProject,
final Optional<CalciteConnectionConfig> config =
planner.getContext().maybeUnwrap(CalciteConnectionConfig.class);
if (!(config.isPresent() && config.get().createMaterializations())) {
// Disable this rule if we if materializations are disabled - in
// Disable this rule if materializations are disabled - in
// particular, if we are in a recursive statement that is being used to
// populate a materialization
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ private CoreRules() {}
* {@link org.apache.calcite.rel.rules.FilterProjectTransposeRule}.
*
* <p>It does not allow a Filter to be pushed past the Project if
* {@link RexUtil#containsCorrelation there is a correlation condition})
* {@link RexUtil#containsCorrelation there is a correlation condition}
* anywhere in the Filter, since in some cases it can prevent a
* {@link Correlate} from being de-correlated.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
*
* <p>The rule does <em>NOT</em> fire if the child is a
* {@link org.apache.calcite.rel.logical.LogicalFilter} or a
* {@link org.apache.calcite.rel.logical.LogicalProject} (we assume they they
* {@link org.apache.calcite.rel.logical.LogicalProject} (we assume that they
* will be converted using {@link FilterToCalcRule} or
* {@link ProjectToCalcRule}) or a
* {@link org.apache.calcite.rel.logical.LogicalCalc}. This
Expand Down
32 changes: 11 additions & 21 deletions core/src/main/java/org/apache/calcite/rex/RexProgramBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ private RexProgramBuilder(RelDataType inputRowType, RexBuilder rexBuilder,
if (inputRowType.isStruct()) {
final List<RelDataTypeField> fields = inputRowType.getFieldList();
for (int i = 0; i < fields.size(); i++) {
registerInternal(RexInputRef.of(i, fields), false);
registerInternal(RexInputRef.of(i, fields));
}
}
}
Expand Down Expand Up @@ -322,14 +322,9 @@ public RexLocalRef registerOutput(RexNode expr) {
* Registers an expression in the list of common sub-expressions, and
* returns a reference to that expression.
*
* <p>If an equivalent sub-expression already exists, creates another
* expression only if <code>force</code> is true.
*
* @param expr Expression to register
* @param force Whether to create a new sub-expression if an equivalent
* sub-expression exists.
* @param expr Expression to register
*/
private RexLocalRef registerInternal(RexNode expr, boolean force) {
private RexLocalRef registerInternal(RexNode expr) {
final RexSimplify simplify =
new RexSimplify(rexBuilder, RelOptPredicateList.EMPTY, RexUtil.EXECUTOR);
expr = simplify.simplifyPreservingType(expr);
Expand All @@ -353,11 +348,6 @@ private RexLocalRef registerInternal(RexNode expr, boolean force) {
// Add expression to list, and return a new reference to it.
ref = addExpr(expr);
exprMap.put(requireNonNull(key, "key"), ref);
} else {
if (force) {
// Add expression to list, but return the previous ref.
addExpr(expr);
}
}

for (;;) {
Expand Down Expand Up @@ -895,37 +885,37 @@ public List<RexLocalRef> getProjectList() {
private abstract class RegisterShuttle extends RexShuttle {
@Override public RexNode visitCall(RexCall call) {
final RexNode expr = super.visitCall(call);
return registerInternal(expr, false);
return registerInternal(expr);
}

@Override public RexNode visitOver(RexOver over) {
final RexNode expr = super.visitOver(over);
return registerInternal(expr, false);
return registerInternal(expr);
}

@Override public RexNode visitLiteral(RexLiteral literal) {
final RexNode expr = super.visitLiteral(literal);
return registerInternal(expr, false);
return registerInternal(expr);
}

@Override public RexNode visitFieldAccess(RexFieldAccess fieldAccess) {
final RexNode expr = super.visitFieldAccess(fieldAccess);
return registerInternal(expr, false);
return registerInternal(expr);
}

@Override public RexNode visitDynamicParam(RexDynamicParam dynamicParam) {
final RexNode expr = super.visitDynamicParam(dynamicParam);
return registerInternal(expr, false);
return registerInternal(expr);
}

@Override public RexNode visitCorrelVariable(RexCorrelVariable variable) {
final RexNode expr = super.visitCorrelVariable(variable);
return registerInternal(expr, false);
return registerInternal(expr);
}

@Override public RexNode visitLambda(RexLambda lambda) {
super.visitLambda(lambda);
return registerInternal(lambda, false);
return registerInternal(lambda);
}
}

Expand Down Expand Up @@ -996,7 +986,7 @@ protected RegisterInputShuttle(boolean valid) {
// Add expression to the list, just so that subsequent
// expressions don't get screwed up. This expression is
// unused, so will be eliminated soon.
return registerInternal(local, false);
return registerInternal(local);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -528,8 +528,8 @@ public static TargetMapping createShiftMapping(
final TargetMapping mapping =
create(
MappingType.INVERSE_SURJECTION,
sourceCount, // aCount + bCount + cCount,
targetCount); // cCount + bCount
sourceCount,
targetCount);

for (int i = 0; i < ints.length; i += 3) {
final int target = ints[i];
Expand Down