Package org.eigenbase.util

Examples of org.eigenbase.util.Permutation


    ProjectRelBase bottomProject = call.rel(1);
    RexBuilder rexBuilder = topProject.getCluster().getRexBuilder();

    // If one or both projects are permutations, short-circuit the complex logic
    // of building a RexProgram.
    final Permutation topPermutation = topProject.getPermutation();
    if (topPermutation != null) {
      if (topPermutation.isIdentity()) {
        // Let RemoveTrivialProjectRule handle this.
        return;
      }
      final Permutation bottomPermutation = bottomProject.getPermutation();
      if (bottomPermutation != null) {
        if (bottomPermutation.isIdentity()) {
          // Let RemoveTrivialProjectRule handle this.
          return;
        }
        final Permutation product = topPermutation.product(bottomPermutation);
        call.transformTo(
            RelOptUtil.projectMapping(bottomProject.getChild(),
                product.inverse(), topProject.getRowType().getFieldNames(),
                projectFactory));
        return;
      }
    }
View Full Code Here


  public Permutation getPermutation() {
    final int fieldCount = rowType.getFieldList().size();
    if (fieldCount != getChild().getRowType().getFieldList().size()) {
      return null;
    }
    Permutation permutation = new Permutation(fieldCount);
    for (int i = 0; i < fieldCount; ++i) {
      final RexNode exp = exps.get(i);
      if (exp instanceof RexInputRef) {
        permutation.set(i, ((RexInputRef) exp).getIndex());
      } else {
        return null;
      }
    }
    return permutation;
View Full Code Here

      throw new AssertionError();

    if( !unique( program.getOutputRowType().getFieldNames() ) )
      throw new AssertionError();

    final Permutation permutation = program.getPermutation();

    if( permutation == null )
      throw new AssertionError();

    Fields incomingFields = createTypedFields( cluster, Mappings.apply( permutation.inverse(), program.getInputRowType().getFieldList() ), false );
    Fields renameFields = createTypedFieldsSelector( cluster, program.getOutputRowType(), false );

    return new Rename( pipe, incomingFields, renameFields );
    }
View Full Code Here

TOP

Related Classes of org.eigenbase.util.Permutation

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.