Package lupos.engine.operators.multiinput.mergeunion

Examples of lupos.engine.operators.multiinput.mergeunion.MergeUnion


      final LinkedList<BasicOperator> llbo = new LinkedList<BasicOperator>();
      llbo.addAll(basicOperator.getPrecedingOperators());
      for (final BasicOperator before : llbo) {
        operatorMustReceiveSortedData(root, before, sortCriterium);
      }
      final BasicOperator newOperator = new MergeUnion(sortCriterium);
      newOperator.cloneFrom(basicOperator);
      basicOperator.replaceWith(newOperator);
      return true;
    } else if (basicOperator.getClass() == MergeJoinWithoutSorting.class
        || basicOperator.getClass() == MergeWithoutSortingOptional.class
        || basicOperator.getClass() == FastSort.class) {
      // is the input data sorted in the right way?
      boolean flag = true;
      final Iterator<Variable> it_sortCriteriumVars = sortCriterium
      .iterator();
      final Iterator<Variable> it_sortCriteriumJoin =
          (basicOperator.getClass() == FastSort.class) ?
              ((FastSort) basicOperator).getSortCriterium().iterator()
              : basicOperator.getIntersectionVariables().iterator();
      while (it_sortCriteriumJoin.hasNext()) {
        if (!it_sortCriteriumVars.hasNext()) {
          flag = false;
          break;
        }
        final Variable v1 = it_sortCriteriumJoin.next();
        final Variable v2 = it_sortCriteriumVars.next();
        if (!v1.equals(v2)) {
          flag = false;
          break;
        }
      }
      if (it_sortCriteriumVars.hasNext()) {
        flag = false;
      }
      if (flag) {
        return true;
      }
    } else if (basicOperator instanceof Sort) {
      // it has already been checked that it is sorted in the right way!
      return true;
    } else if (basicOperator.getClass() == Optional.class) {
      if(basicOperator.getIntersectionVariables().containsAll(sortCriterium)) {
        if(basicOperator.getPrecedingOperators().size() == 2) {
          final BasicOperator newOperator = new MergeWithoutSortingOptional();
          newOperator.cloneFrom(basicOperator);
          basicOperator.replaceWith(newOperator);
          return   operatorMustReceiveSortedData(root, basicOperator.getPrecedingOperators().get(0), sortCriterium) &&
              operatorMustReceiveSortedData(root, basicOperator.getPrecedingOperators().get(1), sortCriterium);
        }
      }
View Full Code Here

TOP

Related Classes of lupos.engine.operators.multiinput.mergeunion.MergeUnion

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.