Package com.foundationdb.sql.optimizer.plan

Examples of com.foundationdb.sql.optimizer.plan.ConditionExpression


    }

    @Test
    public void colNeValue() {
        ConstantExpression value = constant("joe");
        ConditionExpression compare = compare(firstName, Comparison.NE, value);
        ColumnRanges expected = columnRanges(
                firstName,
                compare,
                    segment(nullExclusive("joe"), exclusive("joe")),
                    segment(exclusive("joe"), RangeEndpoint.UPPER_WILD)
View Full Code Here


    }

    @Test
    public void valueNeCol() {
        ConstantExpression value = constant("joe");
        ConditionExpression compare = compare(value, Comparison.NE, firstName);
        ColumnRanges expected = columnRanges(
                firstName,
                compare,
                segment(nullExclusive("joe"), exclusive("joe")),
                segment(exclusive("joe"), RangeEndpoint.UPPER_WILD)
View Full Code Here

    }
   
    @Test
    public void notColLtValue() {
        ConstantExpression value = constant("joe");
        ConditionExpression compare = not(compare(value, Comparison.LT, firstName));
        ColumnRanges expected = null;
        assertEquals(expected, ColumnRanges.rangeAtNode(compare));
    }
View Full Code Here

        assertEquals(expected, ColumnRanges.rangeAtNode(compare));
    }

    @Test
    public void columnIsNull() {
        ConditionExpression isNull = isNull(firstName);
        ColumnRanges expected = columnRanges(
                firstName,
                isNull,
                segment(RangeEndpoint.nullInclusive(firstName), RangeEndpoint.nullInclusive(firstName))
        );
View Full Code Here

        assertEquals(expected, ColumnRanges.rangeAtNode(isNull));
    }

    @Test
    public void differentColumns() {
        ConditionExpression firstNameLtJoe = compare(firstName, Comparison.LT, constant("joe"));
        ConditionExpression lastNameLtSmith = compare(lastName, Comparison.LT, constant("smith"));
        ConditionExpression either = or(firstNameLtJoe, lastNameLtSmith);
        ColumnRanges expected = null;
        assertEquals(expected, ColumnRanges.rangeAtNode(either));
    }
View Full Code Here

    // the and/or tests are pretty sparse, since RangeSegmentTest is more exhaustive about
    // the overlaps and permutations.

    @Test
    public void orNoOverlap() {
        ConditionExpression nameLtAbe = compare(firstName, Comparison.LT, constant("abe"));
        ConditionExpression nameGeJoe = compare(firstName, Comparison.GE, constant("joe"));
        ConditionExpression either = or(nameLtAbe, nameGeJoe);
        ColumnRanges expected = columnRanges(
                firstName,
                either,
                segment(nullExclusive("joe"), exclusive("abe")),
                segment(inclusive("joe"), RangeEndpoint.UPPER_WILD)
View Full Code Here

        assertEquals(expected, ColumnRanges.rangeAtNode(either));
    }

    @Test
    public void orWithOverlap() {
        ConditionExpression nameLtAbe = compare(firstName, Comparison.LT, constant("joe"));
        ConditionExpression nameGeJoe = compare(firstName, Comparison.GE, constant("abe"));
        ConditionExpression either = or(nameLtAbe, nameGeJoe);
        ColumnRanges expected = columnRanges(
                firstName,
                either,
                segment(nullExclusive("joe"), RangeEndpoint.UPPER_WILD)
        );
View Full Code Here

        assertEquals(expected, ColumnRanges.rangeAtNode(either));
    }

    @Test
    public void andNoOverlap() {
        ConditionExpression nameLtAbe = compare(firstName, Comparison.LT, constant("abe"));
        ConditionExpression nameGeJoe = compare(firstName, Comparison.GE, constant("joe"));
        ConditionExpression both = and(nameLtAbe, nameGeJoe);
        ColumnRanges expected = columnRanges(
                firstName,
                both
        );
        assertEquals(expected, ColumnRanges.rangeAtNode(both));
View Full Code Here

        assertEquals(expected, ColumnRanges.rangeAtNode(both));
    }

    @Test
    public void andWithOverlap() {
        ConditionExpression nameLtAbe = compare(firstName, Comparison.LT, constant("joe"));
        ConditionExpression nameGeJoe = compare(firstName, Comparison.GE, constant("abe"));
        ConditionExpression both = and(nameLtAbe, nameGeJoe);
        ColumnRanges expected = columnRanges(
                firstName,
                both,
                segment(inclusive("abe"), exclusive("joe"))
        );
View Full Code Here

        assertEquals(expected, ColumnRanges.rangeAtNode(both));
    }

    @Test
    public void explicitAnd() {
        ConditionExpression nameLtAbe = compare(firstName, Comparison.LT, constant("joe"));
        ConditionExpression nameGeJoe = compare(firstName, Comparison.GE, constant("abe"));
        ColumnRanges nameLtAbeRanges = ColumnRanges.rangeAtNode(nameLtAbe);
        ColumnRanges nameGeJoeRanges = ColumnRanges.rangeAtNode(nameGeJoe);
        ColumnRanges expected = columnRanges(
                firstName,
                set(nameLtAbe, nameGeJoe),
View Full Code Here

TOP

Related Classes of com.foundationdb.sql.optimizer.plan.ConditionExpression

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.