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

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

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

origin: Qihoo360/Quicksql

/**
 * Returns whether a program contains a multiset.
 */
public static boolean containsMultiset(RexProgram program) {
 return containsMultiset(program.getExprList(), true);
}
origin: org.apache.calcite/calcite-core

/**
 * Returns whether a program contains a multiset.
 */
public static boolean containsMultiset(RexProgram program) {
 return containsMultiset(program.getExprList(), true);
}
origin: org.apache.calcite/calcite-core

/**
 * Returns whether a {@link RexProgram} contains expressions which require
 * decimal expansion.
 */
public static boolean requiresDecimalExpansion(
  RexProgram program,
  boolean recurse) {
 final List<RexNode> exprList = program.getExprList();
 for (RexNode expr : exprList) {
  if (requiresDecimalExpansion(expr, recurse)) {
   return true;
  }
 }
 return false;
}
origin: Qihoo360/Quicksql

/**
 * Returns whether a {@link RexProgram} contains expressions which require
 * decimal expansion.
 */
public static boolean requiresDecimalExpansion(
  RexProgram program,
  boolean recurse) {
 final List<RexNode> exprList = program.getExprList();
 for (RexNode expr : exprList) {
  if (requiresDecimalExpansion(expr, recurse)) {
   return true;
  }
 }
 return false;
}
origin: org.apache.calcite/calcite-core

 @Override public void collectVariablesUsed(Set<CorrelationId> variableSet) {
  final RelOptUtil.VariableUsedVisitor vuv =
    new RelOptUtil.VariableUsedVisitor(null);
  for (RexNode expr : program.getExprList()) {
   expr.accept(vuv);
  }
  variableSet.addAll(vuv.variables);
 }
}
origin: Qihoo360/Quicksql

 @Override public void collectVariablesUsed(Set<CorrelationId> variableSet) {
  final RelOptUtil.VariableUsedVisitor vuv =
    new RelOptUtil.VariableUsedVisitor(null);
  for (RexNode expr : program.getExprList()) {
   expr.accept(vuv);
  }
  variableSet.addAll(vuv.variables);
 }
}
origin: Qihoo360/Quicksql

/**
 * Returns whether a program contains an OVER clause.
 */
public static boolean containsOver(RexProgram program) {
 try {
  RexUtil.apply(FINDER, program.getExprList(), null);
  return false;
 } catch (OverFound e) {
  Util.swallow(e, null);
  return true;
 }
}
origin: Qihoo360/Quicksql

/** Dereferences an expression if it is a
 * {@link org.apache.calcite.rex.RexLocalRef}. */
public RexNode deref(RexNode expr) {
 if (expr instanceof RexLocalRef) {
  RexLocalRef ref = (RexLocalRef) expr;
  final RexNode e2 = program.getExprList().get(ref.getIndex());
  assert ref.getType().equals(e2.getType());
  return e2;
 } else {
  return expr;
 }
}
origin: org.apache.calcite/calcite-core

/** Dereferences an expression if it is a
 * {@link org.apache.calcite.rex.RexLocalRef}. */
public RexNode deref(RexNode expr) {
 if (expr instanceof RexLocalRef) {
  RexLocalRef ref = (RexLocalRef) expr;
  final RexNode e2 = program.getExprList().get(ref.getIndex());
  assert ref.getType().equals(e2.getType());
  return e2;
 } else {
  return expr;
 }
}
origin: org.apache.calcite/calcite-core

/**
 * Returns whether a program contains an OVER clause.
 */
public static boolean containsOver(RexProgram program) {
 try {
  RexUtil.apply(FINDER, program.getExprList(), null);
  return false;
 } catch (OverFound e) {
  Util.swallow(e, null);
  return true;
 }
}
origin: Qihoo360/Quicksql

/**
 * Returns true if any expression in a program contains a mixing between
 * multiset and non-multiset calls.
 */
public static boolean containsMixing(RexProgram program) {
 RexCallMultisetOperatorCounter counter =
   new RexCallMultisetOperatorCounter();
 for (RexNode expr : program.getExprList()) {
  counter.reset();
  expr.accept(counter);
  if ((counter.totalCount != counter.multisetCount)
    && (0 != counter.multisetCount)) {
   return true;
  }
 }
 return false;
}
origin: org.apache.calcite/calcite-core

/**
 * Returns true if any expression in a program contains a mixing between
 * multiset and non-multiset calls.
 */
public static boolean containsMixing(RexProgram program) {
 RexCallMultisetOperatorCounter counter =
   new RexCallMultisetOperatorCounter();
 for (RexNode expr : program.getExprList()) {
  counter.reset();
  expr.accept(counter);
  if ((counter.totalCount != counter.multisetCount)
    && (0 != counter.multisetCount)) {
   return true;
  }
 }
 return false;
}
origin: Qihoo360/Quicksql

private List<RexLocalRef> registerProjectsAndCondition(RexProgram program) {
 final List<RexNode> exprList = program.getExprList();
 final List<RexLocalRef> projectRefList = new ArrayList<>();
 final RexShuttle shuttle = new RegisterOutputShuttle(exprList);
 // For each project, lookup the expr and expand it so it is in terms of
 // bottomCalc's input fields
 for (RexLocalRef topProject : program.getProjectList()) {
  final RexNode topExpr = exprList.get(topProject.getIndex());
  final RexLocalRef expanded = (RexLocalRef) topExpr.accept(shuttle);
  // Remember the expr, but don't add to the project list yet.
  projectRefList.add(expanded);
 }
 // Similarly for the condition.
 final RexLocalRef topCondition = program.getCondition();
 if (topCondition != null) {
  final RexNode topExpr = exprList.get(topCondition.getIndex());
  final RexLocalRef expanded = (RexLocalRef) topExpr.accept(shuttle);
  addCondition(registerInput(expanded));
 }
 return projectRefList;
}
origin: org.apache.calcite/calcite-core

private List<RexLocalRef> registerProjectsAndCondition(RexProgram program) {
 final List<RexNode> exprList = program.getExprList();
 final List<RexLocalRef> projectRefList = new ArrayList<>();
 final RexShuttle shuttle = new RegisterOutputShuttle(exprList);
 // For each project, lookup the expr and expand it so it is in terms of
 // bottomCalc's input fields
 for (RexLocalRef topProject : program.getProjectList()) {
  final RexNode topExpr = exprList.get(topProject.getIndex());
  final RexLocalRef expanded = (RexLocalRef) topExpr.accept(shuttle);
  // Remember the expr, but don't add to the project list yet.
  projectRefList.add(expanded);
 }
 // Similarly for the condition.
 final RexLocalRef topCondition = program.getCondition();
 if (topCondition != null) {
  final RexNode topExpr = exprList.get(topCondition.getIndex());
  final RexLocalRef expanded = (RexLocalRef) topExpr.accept(shuttle);
  addCondition(registerInput(expanded));
 }
 return projectRefList;
}
origin: org.apache.calcite/calcite-core

 /**
  * Returns whether this tester's <code>RelType</code> can implement a
  * given program.
  *
  * @param program Program
  * @return Whether this tester's <code>RelType</code> can implement a
  * given program.
  */
 public boolean canImplement(RexProgram program) {
  if ((program.getCondition() != null)
    && !canImplement(program.getCondition(), true)) {
   return false;
  }
  for (RexNode expr : program.getExprList()) {
   if (!canImplement(expr, false)) {
    return false;
   }
  }
  return true;
 }
}
origin: Qihoo360/Quicksql

 /**
  * Returns whether this tester's <code>RelType</code> can implement a
  * given program.
  *
  * @param program Program
  * @return Whether this tester's <code>RelType</code> can implement a
  * given program.
  */
 public boolean canImplement(RexProgram program) {
  if ((program.getCondition() != null)
    && !canImplement(program.getCondition(), true)) {
   return false;
  }
  for (RexNode expr : program.getExprList()) {
   if (!canImplement(expr, false)) {
    return false;
   }
  }
  return true;
 }
}
origin: dremio/dremio-oss

public RexProgram copyOf(RexProgram program) {
 return new RexProgram(
  copyOf(program.getInputRowType()),
  copyRexNodes(program.getExprList()),
  Lists.transform(program.getProjectList(), COPY_REX_LOCAL_REF),
  (RexLocalRef) copyOf(program.getCondition()),
  copyOf(program.getOutputRowType())
 );
}
origin: Qihoo360/Quicksql

 public RelNode accept(RexShuttle shuttle) {
  List<RexNode> oldExprs = program.getExprList();
  List<RexNode> exprs = shuttle.apply(oldExprs);
  List<RexLocalRef> oldProjects = program.getProjectList();
  List<RexLocalRef> projects = shuttle.apply(oldProjects);
  RexLocalRef oldCondition = program.getCondition();
  RexNode condition;
  if (oldCondition != null) {
   condition = shuttle.apply(oldCondition);
   assert condition instanceof RexLocalRef
     : "Invalid condition after rewrite. Expected RexLocalRef, got "
     + condition;
  } else {
   condition = null;
  }
  if (exprs == oldExprs
    && projects == oldProjects
    && condition == oldCondition) {
   return this;
  }
  return copy(traitSet, getInput(),
    new RexProgram(program.getInputRowType(),
      exprs,
      projects,
      (RexLocalRef) condition,
      program.getOutputRowType()));
 }
}
origin: org.apache.calcite/calcite-core

public void onMatch(RelOptRuleCall call) {
 LogicalCalc calc = call.rel(0);
 // Expand decimals in every expression in this program. If no
 // expression changes, don't apply the rule.
 final RexProgram program = calc.getProgram();
 if (!RexUtil.requiresDecimalExpansion(program, true)) {
  return;
 }
 final RexBuilder rexBuilder = calc.getCluster().getRexBuilder();
 final RexShuttle shuttle = new DecimalShuttle(rexBuilder);
 RexProgramBuilder programBuilder =
   RexProgramBuilder.create(
     rexBuilder,
     calc.getInput().getRowType(),
     program.getExprList(),
     program.getProjectList(),
     program.getCondition(),
     program.getOutputRowType(),
     shuttle,
     true);
 final RexProgram newProgram = programBuilder.getProgram();
 LogicalCalc newCalc = LogicalCalc.create(calc.getInput(), newProgram);
 call.transformTo(newCalc);
}
origin: Qihoo360/Quicksql

public void onMatch(RelOptRuleCall call) {
 LogicalCalc calc = call.rel(0);
 // Expand decimals in every expression in this program. If no
 // expression changes, don't apply the rule.
 final RexProgram program = calc.getProgram();
 if (!RexUtil.requiresDecimalExpansion(program, true)) {
  return;
 }
 final RexBuilder rexBuilder = calc.getCluster().getRexBuilder();
 final RexShuttle shuttle = new DecimalShuttle(rexBuilder);
 RexProgramBuilder programBuilder =
   RexProgramBuilder.create(
     rexBuilder,
     calc.getInput().getRowType(),
     program.getExprList(),
     program.getProjectList(),
     program.getCondition(),
     program.getOutputRowType(),
     shuttle,
     true);
 final RexProgram newProgram = programBuilder.getProgram();
 LogicalCalc newCalc = LogicalCalc.create(calc.getInput(), newProgram);
 call.transformTo(newCalc);
}
org.apache.calcite.rexRexProgramgetExprList

Javadoc

Returns the common sub-expressions of this program.

The list is never null but may be empty; each the expression in the list is not null; and no further reduction into smaller common sub-expressions is possible.

Popular methods of RexProgram

  • expandLocalRef
    Fully expands a RexLocalRef back into a pure RexNode tree containing no RexLocalRefs (reversing the
  • 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
  • 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 requests using okhttp
  • getSupportFragmentManager (FragmentActivity)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • Top Vim plugins
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