Tabnine Logo
Calc
Code IndexAdd Tabnine to your IDE (free)

How to use
Calc
in
org.apache.calcite.rel.core

Best Java code snippets using org.apache.calcite.rel.core.Calc (Showing top 20 results out of 315)

origin: apache/storm

  @Override
  public RelNode convert(RelNode rel) {
    final Calc calc = (Calc) rel;
    final RelNode input = calc.getInput();

    return new StreamsCalcRel(calc.getCluster(), calc.getTraitSet().replace(StreamsLogicalConvention.INSTANCE),
                 convert(input, input.getTraitSet().replace(StreamsLogicalConvention.INSTANCE)),
                 calc.getProgram());
  }
}
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

public Double getRowCount(Calc rel, RelMetadataQuery mq) {
 return RelMdUtil.estimateFilteredRows(rel.getInput(), rel.getProgram(), mq);
}
origin: org.apache.calcite/calcite-core

 public RelNode convert(RelNode rel) {
  final Calc calc = (Calc) rel;
  // If there's a multiset, let FarragoMultisetSplitter work on it
  // first.
  if (RexMultisetUtil.containsMultiset(calc.getProgram())) {
   return null;
  }
  return new JdbcCalc(rel.getCluster(), rel.getTraitSet().replace(out),
    convert(calc.getInput(), calc.getTraitSet().replace(out)),
    calc.getProgram());
 }
}
origin: org.apache.calcite/calcite-core

/** Predicate for whether a {@link Calc} contains multisets or windowed
 * aggregates. */
public static boolean containsMultisetOrWindowedAgg(Calc calc) {
 return !(B
   && RexMultisetUtil.containsMultiset(calc.getProgram())
   || calc.getProgram().containsAggs());
}
origin: Qihoo360/Quicksql

public boolean isValid(Litmus litmus, Context context) {
 if (!RelOptUtil.equal(
   "program's input type",
   program.getInputRowType(),
   "child's output type",
   getInput().getRowType(), litmus)) {
  return litmus.fail(null);
 }
 if (!program.isValid(litmus, context)) {
  return litmus.fail(null);
 }
 if (!program.isNormalized(litmus, getCluster().getRexBuilder())) {
  return litmus.fail(null);
 }
 return litmus.succeed();
}
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

@Override public double estimateRowCount(RelMetadataQuery mq) {
 return RelMdUtil.estimateFilteredRows(getInput(), program, mq);
}
origin: org.apache.calcite/calcite-core

@Override public final Calc copy(RelTraitSet traitSet, List<RelNode> inputs) {
 return copy(traitSet, sole(inputs), program);
}
origin: Qihoo360/Quicksql

@Deprecated // to be removed before 2.0
public Calc copy(
  RelTraitSet traitSet,
  RelNode child,
  RexProgram program,
  List<RelCollation> collationList) {
 Util.discard(collationList);
 return copy(traitSet, child, program);
}
origin: Qihoo360/Quicksql

/**
 * Creates a Calc.
 *
 * @param cluster Cluster
 * @param traits Traits
 * @param child Input relation
 * @param program Calc program
 */
protected Calc(
  RelOptCluster cluster,
  RelTraitSet traits,
  RelNode child,
  RexProgram program) {
 super(cluster, traits, child);
 this.rowType = program.getOutputRowType();
 this.program = program;
 assert isValid(Litmus.THROW, null);
}
origin: Qihoo360/Quicksql

 @Override public void onMatch(RelOptRuleCall call) {
  final Calc calc = call.rel(0);
  final Pair<ImmutableList<RexNode>, ImmutableList<RexNode>> projectFilter =
    calc.getProgram().split();
  final RelBuilder relBuilder = call.builder();
  relBuilder.push(calc.getInput());
  relBuilder.filter(projectFilter.right);
  relBuilder.project(projectFilter.left, calc.getRowType().getFieldNames());
  call.transformTo(relBuilder.build());
 }
}
origin: Qihoo360/Quicksql

public ImmutableList<RelCollation> collations(Calc calc,
  RelMetadataQuery mq) {
 return ImmutableList.copyOf(calc(mq, calc.getInput(), calc.getProgram()));
}
origin: Qihoo360/Quicksql

 public RelNode convert(RelNode rel) {
  final Calc calc = (Calc) rel;
  // If there's a multiset, let FarragoMultisetSplitter work on it
  // first.
  if (RexMultisetUtil.containsMultiset(calc.getProgram())) {
   return null;
  }
  return new JdbcCalc(rel.getCluster(), rel.getTraitSet().replace(out),
    convert(calc.getInput(), calc.getTraitSet().replace(out)),
    calc.getProgram());
 }
}
origin: Qihoo360/Quicksql

/** Predicate for whether a {@link Calc} contains multisets or windowed
 * aggregates. */
public static boolean containsMultisetOrWindowedAgg(Calc calc) {
 return !(B
   && RexMultisetUtil.containsMultiset(calc.getProgram())
   || calc.getProgram().containsAggs());
}
origin: org.apache.calcite/calcite-core

public boolean isValid(Litmus litmus, Context context) {
 if (!RelOptUtil.equal(
   "program's input type",
   program.getInputRowType(),
   "child's output type",
   getInput().getRowType(), litmus)) {
  return litmus.fail(null);
 }
 if (!program.isValid(litmus, context)) {
  return litmus.fail(null);
 }
 if (!program.isNormalized(litmus, getCluster().getRexBuilder())) {
  return litmus.fail(null);
 }
 return litmus.succeed();
}
origin: org.apache.calcite/calcite-core

 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: Qihoo360/Quicksql

@Override public double estimateRowCount(RelMetadataQuery mq) {
 return RelMdUtil.estimateFilteredRows(getInput(), program, mq);
}
origin: Qihoo360/Quicksql

@Override public final Calc copy(RelTraitSet traitSet, List<RelNode> inputs) {
 return copy(traitSet, sole(inputs), program);
}
origin: org.apache.calcite/calcite-core

@Deprecated // to be removed before 2.0
public Calc copy(
  RelTraitSet traitSet,
  RelNode child,
  RexProgram program,
  List<RelCollation> collationList) {
 Util.discard(collationList);
 return copy(traitSet, child, program);
}
org.apache.calcite.rel.coreCalc

Javadoc

Calc is an abstract base class for implementations of org.apache.calcite.rel.logical.LogicalCalc.

Most used methods

  • getInput
  • getProgram
  • getCluster
  • getRowType
  • getTraitSet
  • copy
  • getDigest
  • isValid
  • sole

Popular in Java

  • Parsing JSON documents to java classes using gson
  • setContentView (Activity)
  • getSharedPreferences (Context)
  • runOnUiThread (Activity)
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • 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