final Permutation topPermutation = topProject.getPermutation(); if (topPermutation == null) { return; final Permutation bottomPermutation = bottomProject.getPermutation(); if (bottomPermutation == null) { return;
final Permutation topPermutation = topProject.getPermutation(); if (topPermutation == null) { return; final Permutation bottomPermutation = bottomProject.getPermutation(); if (bottomPermutation == null) { return;
/** * Returns a permutation, if this projection is merely a permutation of its * input fields; otherwise null. * * @return Permutation, if this projection is merely a permutation of its * input fields; otherwise null */ public Permutation getPermutation() { return getPermutation(getInput().getRowType().getFieldCount(), exps); }
/** * Returns a permutation, if this projection is merely a permutation of its * input fields; otherwise null. * * @return Permutation, if this projection is merely a permutation of its * input fields; otherwise null */ public Permutation getPermutation() { return getPermutation(getInput().getRowType().getFieldCount(), exps); }
final Permutation topPermutation = topProject.getPermutation(); if (topPermutation == null) { return; final Permutation bottomPermutation = bottomProject.getPermutation(); if (bottomPermutation == null) { return;
@Test public void testProjectPermutation() { final RelDataTypeFactory typeFactory = new JavaTypeFactoryImpl(); final RexBuilder builder = new RexBuilder(typeFactory); final RelDataType doubleType = typeFactory.createSqlType(SqlTypeName.DOUBLE); // A project with [1, 1] is not a permutation, so should return null final Permutation perm = Project.getPermutation(2, ImmutableList.of(builder.makeInputRef(doubleType, 1), builder.makeInputRef(doubleType, 1))); assertThat(perm, nullValue()); // A project with [0, 1, 0] is not a permutation, so should return null final Permutation perm1 = Project.getPermutation(2, ImmutableList.of(builder.makeInputRef(doubleType, 0), builder.makeInputRef(doubleType, 1), builder.makeInputRef(doubleType, 0))); assertThat(perm1, nullValue()); // A project of [1, 0] is a valid permutation! final Permutation perm2 = Project.getPermutation(2, ImmutableList.of(builder.makeInputRef(doubleType, 1), builder.makeInputRef(doubleType, 0))); assertThat(perm2, is(new Permutation(new int[]{1, 0}))); } }
@Test public void testProjectPermutation() { final RelDataTypeFactory typeFactory = new JavaTypeFactoryImpl(); final RexBuilder builder = new RexBuilder(typeFactory); final RelDataType doubleType = typeFactory.createSqlType(SqlTypeName.DOUBLE); // A project with [1, 1] is not a permutation, so should return null final Permutation perm = Project.getPermutation(2, ImmutableList.of(builder.makeInputRef(doubleType, 1), builder.makeInputRef(doubleType, 1))); assertThat(perm, nullValue()); // A project with [0, 1, 0] is not a permutation, so should return null final Permutation perm1 = Project.getPermutation(2, ImmutableList.of(builder.makeInputRef(doubleType, 0), builder.makeInputRef(doubleType, 1), builder.makeInputRef(doubleType, 0))); assertThat(perm1, nullValue()); // A project of [1, 0] is a valid permutation! final Permutation perm2 = Project.getPermutation(2, ImmutableList.of(builder.makeInputRef(doubleType, 1), builder.makeInputRef(doubleType, 0))); assertThat(perm2, is(new Permutation(new int[]{1, 0}))); } }
final RelNode relB = bottomJoin.getRight(); final RelOptCluster cluster = topJoin.getCluster(); final Permutation projectPermu = projectOnBottomJoin.getPermutation(); final Permutation inverseProjectPermu = projectPermu.inverse();
final Permutation topPermutation = topProject.getPermutation(); if (topPermutation != null) { if (topPermutation.isIdentity()) { final Permutation bottomPermutation = bottomProject.getPermutation(); if (bottomPermutation != null) { if (bottomPermutation.isIdentity()) {
final Permutation topPermutation = topProject.getPermutation(); if (topPermutation != null) { if (topPermutation.isIdentity()) { final Permutation bottomPermutation = bottomProject.getPermutation(); if (bottomPermutation != null) { if (bottomPermutation.isIdentity()) {
final Permutation topPermutation = topProject.getPermutation(); if (topPermutation != null) { if (topPermutation.isIdentity()) { final Permutation bottomPermutation = bottomProject.getPermutation(); if (bottomPermutation != null) { if (bottomPermutation.isIdentity()) {
final Permutation topPermutation = topProject.getPermutation(); if (topPermutation != null) { if (topPermutation.isIdentity()) { final Permutation bottomPermutation = bottomProject.getPermutation(); if (bottomPermutation != null) { if (bottomPermutation.isIdentity()) {