TEST(PhysRewriter, IndexPartitioning1_Assertion) {
|
using namespace properties;
|
PrefixId prefixId;
|
|
ABT scanNode = make<ScanNode>("root", "c1");
|
|
ABT projectionANode = make<EvaluationNode>(
|
"pa",
|
make<EvalPath>(make<PathGet>("a", make<PathIdentity>()), make<Variable>("root")),
|
std::move(scanNode));
|
|
ABT filterANode =
|
make<FilterNode>(make<EvalFilter>(make<PathCompare>(Operations::Gt, Constant::int64(0)),
|
make<Variable>("pa")),
|
std::move(projectionANode));
|
|
ABT projectionBNode = make<EvaluationNode>(
|
"pb",
|
make<EvalPath>(make<PathGet>("b", make<PathIdentity>()), make<Variable>("root")),
|
std::move(filterANode));
|
|
ABT filterBNode =
|
make<FilterNode>(make<EvalFilter>(make<PathCompare>(Operations::Gt, Constant::int64(1)),
|
make<Variable>("pb")),
|
std::move(projectionBNode));
|
|
ABT groupByNode = make<GroupByNode>(ProjectionNameVector{"pa"},
|
ProjectionNameVector{"pc"},
|
makeSeq(make<Variable>("pb")),
|
std::move(filterBNode));
|
|
ABT rootNode =
|
make<RootNode>(ProjectionRequirement{ProjectionNameVector{"pc"}}, std::move(groupByNode));
|
|
CostModelCoefficients cost{};
|
cost.setStartupCost(0.01);
|
cost.setScanIncrementalCost(2.03018530e-03);
|
cost.setIndexScanIncrementalCost(3.01913370e-03);
|
cost.setSeekCost(0.45295769);
|
cost.setFilterIncrementalCost(0.43270579);
|
cost.setEvalIncrementalCost(0.00144283);
|
cost.setGroupByIncrementalCost(0.7);
|
cost.setUnwindIncrementalCost(0.00261471);
|
cost.setBinaryJoinIncrementalCost(0.88617148);
|
cost.setHashJoinIncrementalCost(1.18293158);
|
cost.setMergeJoinIncrementalCost(0.45712803);
|
cost.setUniqueIncrementalCost(0.7);
|
cost.setCollationIncrementalCost(2.5);
|
cost.setCollationWithLimitIncrementalCost(1.0);
|
cost.setUnionIncrementalCost(0.00585172);
|
cost.setExchangeIncrementalCost(0.1);
|
|
OptPhaseManager phaseManager(
|
{OptPhase::MemoSubstitutionPhase,
|
OptPhase::MemoExplorationPhase,
|
OptPhase::MemoImplementationPhase},
|
prefixId,
|
false,
|
{{{"c1",
|
ScanDefinition{
|
{},
|
{{"index1",
|
IndexDefinition{
|
{{makeNonMultikeyIndexPath("a"), CollationOp::Ascending}},
|
false /*isMultiKey*/,
|
{DistributionType::HashPartitioning, makeSeq(makeNonMultikeyIndexPath("a"))},
|
{}}},
|
{"index2",
|
IndexDefinition{
|
{{makeNonMultikeyIndexPath("b"), CollationOp::Ascending}},
|
false /*isMultiKey*/,
|
{DistributionType::HashPartitioning, makeSeq(makeNonMultikeyIndexPath("b"))},
|
{}}}},
|
{DistributionType::HashPartitioning, makeSeq(makeNonMultikeyIndexPath("c"))}}}},
|
5 /*numberOfPartitions*/},
|
std::make_unique<HeuristicCE>(),
|
std::make_unique<DefaultCosting>(cost),
|
{},
|
{true /*debugMode*/, 2 /*debugLevel*/, DebugInfo::kIterationLimitForTests});
|
|
ABT optimized = rootNode;
|
phaseManager.optimize(optimized);
|
}
|