Beispiel #1
0
  public void visit(Component component) {
    final List<ValueExpression> hashExpressions = component.getHashExpressions();
    if (hashExpressions != null) {
      _afterProjection.addAll(hashExpressions);
      _veList.addAll(hashExpressions);
    }

    final List<Operator> operators = component.getChainOperator().getOperators();
    for (final Operator op : operators) op.accept(this);
  }
 public static Component getLCM(Component first, Component second) {
   // TODO problem nested: we have multiple children
   Component resultComp = first;
   List<String> resultAnc = ParserUtil.getSourceNameList(resultComp);
   while (!resultAnc.contains(second.getName())) {
     resultComp = resultComp.getChild();
     resultAnc = ParserUtil.getSourceNameList(resultComp);
   }
   return resultComp;
 }
  /*
   * Is component a child (not necessarily first generation) of all orCompNames?
   * Used in Cost-based optimizer
   */
  public static boolean isLCM(Component component, Set<String> orCompNames) {
    // dealing with parents
    Component[] parents = component.getParents();
    if (parents == null) {
      // if I don't have parents I can't be LCM (I am DataSourceComponent)
      return false;
    }

    for (int i = 0; i < parents.length; i++) {
      Component parent = parents[i];
      Set<String> parentAncestors = ParserUtil.getSourceNameSet(parent);
      if (contains(parentAncestors, orCompNames)) {
        // my parent is LCM (or its parent)
        return false;
      }
    }

    // if I contain all the mentioned sources, and none of my parent does so, than I am LCM
    Set<String> compAncestors = ParserUtil.getSourceNameSet(component);
    return contains(compAncestors, orCompNames);
  }