当前位置: 首页>>代码示例>>C++>>正文


C++ PropertySet::IsSubset方法代码示例

本文整理汇总了C++中PropertySet::IsSubset方法的典型用法代码示例。如果您正苦于以下问题:C++ PropertySet::IsSubset方法的具体用法?C++ PropertySet::IsSubset怎么用?C++ PropertySet::IsSubset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PropertySet的用法示例。


在下文中一共展示了PropertySet::IsSubset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OptimizeExpression

void Optimizer::OptimizeExpression(std::shared_ptr<GroupExpression> gexpr,
                                   PropertySet requirements)
{
  LOG_TRACE("Optimizing expression of group %d with op %s",
            gexpr->GetGroupID(), gexpr->Op().name().c_str());

  // Helper function for costing follow up expressions
  auto CostCandidate =
    [this](std::shared_ptr<GroupExpression> candidate,
           PropertySet requirements)
    {
      // Cost the expression
      this->CostExpression(candidate);

      // Only include cost if it meets the property requirements
      if (requirements.IsSubset(candidate->Op().ProvidedOutputProperties())) {
        // Add to group as potential best cost
        Group *group = this->memo.GetGroupByID(candidate->GetGroupID());
        LOG_TRACE("Adding expression cost on group %d with op %s",
                  candidate->GetGroupID(), candidate->Op().name().c_str());
        group->SetExpressionCost(candidate,
                                 candidate->GetCost(),
                                 requirements);
      }
    };

  // Cost the root expression
  if (gexpr->Op().IsPhysical()) {
    CostCandidate(gexpr, requirements);
    // Transformation rules shouldn't match on physical operators so don't apply
    // rules
  } else {
    // Apply transformations and cost those which match the requirements
    for (const std::unique_ptr<Rule> &rule : rules) {
      // Apply all rules to operator which match. We apply all rules to one
      // operator before moving on to the next operator in the group because
      // then we avoid missing the application of a rule e.g. an application
      // of some rule creates a match for a previously applied rule, but it is
      // missed because the prev rule was already checked
      std::vector<std::shared_ptr<GroupExpression>> candidates =
        TransformExpression(gexpr, *(rule.get()));

      for (std::shared_ptr<GroupExpression> candidate : candidates) {
        // If logical...
        if (candidate->Op().IsLogical()) {
          // Optimize the expression
          OptimizeExpression(candidate, requirements);
        }
        if (candidate->Op().IsPhysical()) {
          CostCandidate(candidate, requirements);
        }
      }
    }
  }
}
开发者ID:abpoms,项目名称:peloton-opt,代码行数:55,代码来源:optimizer.cpp


注:本文中的PropertySet::IsSubset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。