Tabnine Logo
RexProgram.expandLocalRef
Code IndexAdd Tabnine to your IDE (free)

How to use
expandLocalRef
method
in
org.apache.calcite.rex.RexProgram

Best Java code snippets using org.apache.calcite.rex.RexProgram.expandLocalRef (Showing top 18 results out of 315)

origin: apache/storm

RexLocalRef condition = program.getCondition();
if (condition != null) {
  RexNode conditionNode = program.expandLocalRef(condition);
  filterInstance = planCreator.createScalarInstance(Lists.newArrayList(conditionNode), inputRowType,
                           StormRelUtils.getClassName(this));
  List<RexNode> expandedNodes = new ArrayList<>();
  for (RexLocalRef project : projectList) {
    expandedNodes.add(program.expandLocalRef(project));
origin: Qihoo360/Quicksql

/** Splits this program into a list of project expressions and a list of
 * filter expressions.
 *
 * <p>Neither list is null.
 * The filters are evaluated first. */
public Pair<ImmutableList<RexNode>, ImmutableList<RexNode>> split() {
 final List<RexNode> filters = new ArrayList<>();
 if (condition != null) {
  RelOptUtil.decomposeConjunction(expandLocalRef(condition), filters);
 }
 final ImmutableList.Builder<RexNode> projects = ImmutableList.builder();
 for (RexLocalRef project : this.projects) {
  projects.add(expandLocalRef(project));
 }
 return Pair.of(projects.build(), ImmutableList.copyOf(filters));
}
origin: org.apache.calcite/calcite-core

/** Splits this program into a list of project expressions and a list of
 * filter expressions.
 *
 * <p>Neither list is null.
 * The filters are evaluated first. */
public Pair<ImmutableList<RexNode>, ImmutableList<RexNode>> split() {
 final List<RexNode> filters = new ArrayList<>();
 if (condition != null) {
  RelOptUtil.decomposeConjunction(expandLocalRef(condition), filters);
 }
 final ImmutableList.Builder<RexNode> projects = ImmutableList.builder();
 for (RexLocalRef project : this.projects) {
  projects.add(expandLocalRef(project));
 }
 return Pair.of(projects.build(), ImmutableList.copyOf(filters));
}
origin: org.apache.calcite/calcite-core

public static double estimateFilteredRows(RelNode child, RexProgram program,
  RelMetadataQuery mq) {
 // convert the program's RexLocalRef condition to an expanded RexNode
 RexLocalRef programCondition = program.getCondition();
 RexNode condition;
 if (programCondition == null) {
  condition = null;
 } else {
  condition = program.expandLocalRef(programCondition);
 }
 return estimateFilteredRows(child, condition, mq);
}
origin: Qihoo360/Quicksql

public static double estimateFilteredRows(RelNode child, RexProgram program,
  RelMetadataQuery mq) {
 // convert the program's RexLocalRef condition to an expanded RexNode
 RexLocalRef programCondition = program.getCondition();
 RexNode condition;
 if (programCondition == null) {
  condition = null;
 } else {
  condition = program.expandLocalRef(programCondition);
 }
 return estimateFilteredRows(child, condition, mq);
}
origin: com.alibaba.blink/flink-table

  public void onMatch(RelOptRuleCall call) {
    final Aggregate aggregate = call.rel(0);
    final Calc calc = call.rel(1);
    final RexProgram program = calc.getProgram();
    final List<RexNode> projects = new ArrayList<>();
    for (RexLocalRef localRef : program.getProjectList()) {
      projects.add(program.expandLocalRef(localRef));
    }
    final Project project = LogicalProject.create(calc.getInput(), projects, calc.getRowType());
    RelNode x = AggregateProjectMergeRule.apply(call, aggregate, project);
    if (x != null) {
      call.transformTo(x);
    }
  }
}
origin: Qihoo360/Quicksql

 @Override protected RelNode handle(RelNode rel) {
  if (!(rel instanceof LogicalCalc)) {
   return rel;
  }
  final LogicalCalc calc = (LogicalCalc) rel;
  final RexProgram program = calc.getProgram();
  relBuilder.push(calc.getInput());
  if (program.getCondition() != null) {
   relBuilder.filter(
     program.expandLocalRef(program.getCondition()));
  }
  if (!program.projectsOnlyIdentity()) {
   relBuilder.project(
     Lists.transform(program.getProjectList(),
       program::expandLocalRef),
     calc.getRowType().getFieldNames());
  }
  return relBuilder.build();
 }
};
origin: org.apache.calcite/calcite-core

 @Override protected RelNode handle(RelNode rel) {
  if (!(rel instanceof LogicalCalc)) {
   return rel;
  }
  final LogicalCalc calc = (LogicalCalc) rel;
  final RexProgram program = calc.getProgram();
  relBuilder.push(calc.getInput());
  if (program.getCondition() != null) {
   relBuilder.filter(
     program.expandLocalRef(program.getCondition()));
  }
  if (!program.projectsOnlyIdentity()) {
   relBuilder.project(
     Lists.transform(program.getProjectList(),
       program::expandLocalRef),
     calc.getRowType().getFieldNames());
  }
  return relBuilder.build();
 }
};
origin: dremio/dremio-oss

public void onMatch(RelOptRuleCall call) {
 final Filter topFilter = call.rel(0);
 final Filter bottomFilter = call.rel(1);
 // use RexPrograms to merge the two FilterRels into a single program
 // so we can convert the two LogicalFilter conditions to directly
 // reference the bottom LogicalFilter's child
 RexBuilder rexBuilder = topFilter.getCluster().getRexBuilder();
 RexProgram bottomProgram = createProgram(bottomFilter);
 RexProgram topProgram = createProgram(topFilter);
 RexProgram mergedProgram = RexProgramBuilder.mergePrograms(topProgram, bottomProgram, rexBuilder);
 RexNode newCondition = mergedProgram.expandLocalRef(mergedProgram.getCondition());
 final RelBuilder relBuilder = call.builder();
 relBuilder.push(bottomFilter.getInput()).filter(newCondition);
 call.transformTo(relBuilder.build());
}
origin: org.apache.calcite/calcite-core

public void onMatch(RelOptRuleCall call) {
 final Filter topFilter = call.rel(0);
 final Filter bottomFilter = call.rel(1);
 // use RexPrograms to merge the two FilterRels into a single program
 // so we can convert the two LogicalFilter conditions to directly
 // reference the bottom LogicalFilter's child
 RexBuilder rexBuilder = topFilter.getCluster().getRexBuilder();
 RexProgram bottomProgram = createProgram(bottomFilter);
 RexProgram topProgram = createProgram(topFilter);
 RexProgram mergedProgram =
   RexProgramBuilder.mergePrograms(
     topProgram,
     bottomProgram,
     rexBuilder);
 RexNode newCondition =
   mergedProgram.expandLocalRef(
     mergedProgram.getCondition());
 final RelBuilder relBuilder = call.builder();
 relBuilder.push(bottomFilter.getInput())
   .filter(newCondition);
 call.transformTo(relBuilder.build());
}
origin: org.apache.drill.exec/drill-java-exec

mergedProgram.expandLocalRef(
  mergedProgram.getCondition());
origin: Qihoo360/Quicksql

public void onMatch(RelOptRuleCall call) {
 final Filter topFilter = call.rel(0);
 final Filter bottomFilter = call.rel(1);
 // use RexPrograms to merge the two FilterRels into a single program
 // so we can convert the two LogicalFilter conditions to directly
 // reference the bottom LogicalFilter's child
 RexBuilder rexBuilder = topFilter.getCluster().getRexBuilder();
 RexProgram bottomProgram = createProgram(bottomFilter);
 RexProgram topProgram = createProgram(topFilter);
 RexProgram mergedProgram =
   RexProgramBuilder.mergePrograms(
     topProgram,
     bottomProgram,
     rexBuilder);
 RexNode newCondition =
   mergedProgram.expandLocalRef(
     mergedProgram.getCondition());
 final RelBuilder relBuilder = call.builder();
 relBuilder.push(bottomFilter.getInput())
   .filter(newCondition);
 call.transformTo(relBuilder.build());
}
origin: org.apache.calcite/calcite-core

  mergedProgram.expandLocalRef(
    mergedProgram.getCondition());
Join newJoinRel =
int[] adjustments = new int[nJoinFields];
for (int i = 0; i < nProjExprs; i++) {
 RexNode newExpr = mergedProgram.expandLocalRef(projList.get(i));
 if (joinType != JoinRelType.INNER) {
  newExpr =
origin: Qihoo360/Quicksql

  mergedProgram.expandLocalRef(
    mergedProgram.getCondition());
Join newJoinRel =
int[] adjustments = new int[nJoinFields];
for (int i = 0; i < nProjExprs; i++) {
 RexNode newExpr = mergedProgram.expandLocalRef(projList.get(i));
 if (joinType != JoinRelType.INNER) {
  newExpr =
origin: com.alibaba.blink/flink-table

        rexBuilder);
return mergedProgram.expandLocalRef(
    mergedProgram.getCondition());
origin: Qihoo360/Quicksql

    rexBuilder);
return mergedProgram.expandLocalRef(
  mergedProgram.getCondition());
origin: org.apache.calcite/calcite-core

    rexBuilder);
return mergedProgram.expandLocalRef(
  mergedProgram.getCondition());
origin: qubole/quark

if (calc.getProgram().getCondition() != null) {
 RexNode cond =
   calc.getProgram().expandLocalRef(calc.getProgram().getCondition());
 final RexLocalRef rexLocalRef =
   topProgramBuilder.addExpr(cond.accept(rexInputConverter));
org.apache.calcite.rexRexProgramexpandLocalRef

Javadoc

Fully expands a RexLocalRef back into a pure RexNode tree containing no RexLocalRefs (reversing the effect of common subexpression elimination). For example, program.expandLocalRef(program.getCondition()) will return the expansion of a program's condition.

Popular methods of RexProgram

  • getCondition
    Returns the field reference of this program's filter condition, or null if there is no condition.
  • getInputRowType
    Returns the type of the input row to the program.
  • getProjectList
    Returns an array of references to the expressions which this program is to project. Never null, may
  • create
    Creates a program which calculates projections and filters rows based upon a condition. Does not att
  • getExprList
    Returns the common sub-expressions of this program.The list is never null but may be empty; each the
  • normalize
  • toString
  • <init>
    Creates a program.The expressions must be valid: they must not contain common expressions, forward r
  • containsAggs
    Returns whether this program contains windowed aggregate functions
  • getExprCount
    Returns the number of expressions in this program.
  • getOutputRowType
    Returns the type of the output row from this program.
  • collectExplainTerms
    Collects the expressions in this program into a list of terms and values.
  • getOutputRowType,
  • collectExplainTerms,
  • countTrivial,
  • createIdentity,
  • deduceCollations,
  • explainCalc,
  • getCollations,
  • getPermutation,
  • getSourceField

Popular in Java

  • Making http post requests using okhttp
  • getSharedPreferences (Context)
  • notifyDataSetChanged (ArrayAdapter)
  • onCreateOptionsMenu (Activity)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now