org.apache.calcite.plan.RelOptCostImpl Java Examples
The following examples show how to use
org.apache.calcite.plan.RelOptCostImpl.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Programs.java From Bats with Apache License 2.0 | 6 votes |
/** Creates a program that executes a {@link HepProgram}. */ public static Program of(final HepProgram hepProgram, final boolean noDag, final RelMetadataProvider metadataProvider) { return (planner, rel, requiredOutputTraits, materializations, lattices) -> { final HepPlanner hepPlanner = new HepPlanner(hepProgram, null, noDag, null, RelOptCostImpl.FACTORY); List<RelMetadataProvider> list = new ArrayList<>(); if (metadataProvider != null) { list.add(metadataProvider); } hepPlanner.registerMetadataProviders(list); RelMetadataProvider plannerChain = ChainedRelMetadataProvider.of(list); rel.getCluster().setMetadataProvider(plannerChain); hepPlanner.setRoot(rel); return hepPlanner.findBestExp(); }; }
Example #2
Source File: Programs.java From calcite with Apache License 2.0 | 6 votes |
/** Creates a program that executes a {@link HepProgram}. */ public static Program of(final HepProgram hepProgram, final boolean noDag, final RelMetadataProvider metadataProvider) { return (planner, rel, requiredOutputTraits, materializations, lattices) -> { final HepPlanner hepPlanner = new HepPlanner(hepProgram, null, noDag, null, RelOptCostImpl.FACTORY); List<RelMetadataProvider> list = new ArrayList<>(); if (metadataProvider != null) { list.add(metadataProvider); } hepPlanner.registerMetadataProviders(list); for (RelOptMaterialization materialization : materializations) { hepPlanner.addMaterialization(materialization); } for (RelOptLattice lattice : lattices) { hepPlanner.addLattice(lattice); } RelMetadataProvider plannerChain = ChainedRelMetadataProvider.of(list); rel.getCluster().setMetadataProvider(plannerChain); hepPlanner.setRoot(rel); return hepPlanner.findBestExp(); }; }
Example #3
Source File: BatsOptimizerTest.java From Bats with Apache License 2.0 | 5 votes |
static VolcanoPlanner createVolcanoPlanner() { RelOptCostFactory costFactory = RelOptCostImpl.FACTORY; Context externalContext = null; VolcanoPlanner volcanoPlanner = new VolcanoPlanner(costFactory, externalContext); // RexExecutor rexExecutor = null; return volcanoPlanner; }
Example #4
Source File: RelDecorrelator.java From flink with Apache License 2.0 | 5 votes |
private HepPlanner createPlanner(HepProgram program) { // Create a planner with a hook to update the mapping tables when a // node is copied when it is registered. return new HepPlanner( program, context, true, createCopyHook(), RelOptCostImpl.FACTORY); }
Example #5
Source File: RelDecorrelator.java From flink with Apache License 2.0 | 5 votes |
private HepPlanner createPlanner(HepProgram program) { // Create a planner with a hook to update the mapping tables when a // node is copied when it is registered. return new HepPlanner( program, context, true, createCopyHook(), RelOptCostImpl.FACTORY); }
Example #6
Source File: LatticeSuggester.java From calcite with Apache License 2.0 | 5 votes |
/** Adds a query. * * <p>It may fit within an existing lattice (or lattices). Or it may need a * new lattice, or an extension to an existing lattice. * * @param r Relational expression for a query * * @return A list of join graphs: usually 1; more if the query contains a * cartesian product; zero if the query graph is cyclic */ public List<Lattice> addQuery(RelNode r) { // Push filters into joins and towards leaves final HepPlanner planner = new HepPlanner(PROGRAM, null, true, null, RelOptCostImpl.FACTORY); planner.setRoot(r); final RelNode r2 = planner.findBestExp(); final Query q = new Query(space); final List<Frame> frameList = new ArrayList<>(); frames(frameList, q, r2); final List<Lattice> lattices = new ArrayList<>(); frameList.forEach(frame -> addFrame(q, frame, lattices)); return ImmutableList.copyOf(lattices); }
Example #7
Source File: RelDecorrelator.java From calcite with Apache License 2.0 | 5 votes |
private HepPlanner createPlanner(HepProgram program) { // Create a planner with a hook to update the mapping tables when a // node is copied when it is registered. return new HepPlanner( program, context, true, createCopyHook(), RelOptCostImpl.FACTORY); }
Example #8
Source File: RelDecorrelator.java From Bats with Apache License 2.0 | 4 votes |
private HepPlanner createPlanner(HepProgram program) { // Create a planner with a hook to update the mapping tables when a // node is copied when it is registered. return new HepPlanner(program, context, true, createCopyHook(), RelOptCostImpl.FACTORY); }
Example #9
Source File: MockRelOptPlanner.java From calcite with Apache License 2.0 | 4 votes |
/** Creates MockRelOptPlanner. */ public MockRelOptPlanner(Context context) { super(RelOptCostImpl.FACTORY, context); setExecutor(new RexExecutorImpl(Schemas.createDataContext(null, null))); }
Example #10
Source File: HepPlanner.java From Bats with Apache License 2.0 | 2 votes |
/** * Creates a new HepPlanner that allows DAG. * * @param program program controlling rule application */ public HepPlanner(HepProgram program) { this(program, null, false, null, RelOptCostImpl.FACTORY); }
Example #11
Source File: HepPlanner.java From Bats with Apache License 2.0 | 2 votes |
/** * Creates a new HepPlanner that allows DAG. * * @param program program controlling rule application * @param context to carry while planning */ public HepPlanner(HepProgram program, Context context) { this(program, context, false, null, RelOptCostImpl.FACTORY); }
Example #12
Source File: HepPlanner.java From calcite with Apache License 2.0 | 2 votes |
/** * Creates a new HepPlanner that allows DAG. * * @param program program controlling rule application */ public HepPlanner(HepProgram program) { this(program, null, false, null, RelOptCostImpl.FACTORY); }
Example #13
Source File: HepPlanner.java From calcite with Apache License 2.0 | 2 votes |
/** * Creates a new HepPlanner that allows DAG. * * @param program program controlling rule application * @param context to carry while planning */ public HepPlanner(HepProgram program, Context context) { this(program, context, false, null, RelOptCostImpl.FACTORY); }