Package io.crate.planner.symbol

Examples of io.crate.planner.symbol.Literal


        Function function = new Function(implementation.info(), Arrays.<Symbol>asList(
                Literal.newLiteral("day"),
                Literal.newLiteral("2014-06-03")
        ));
        Literal day = (Literal)implementation.normalizeSymbol(function);
        assertThat((Long)day.value(), is(1401753600000L));
    }
View Full Code Here


    @Test
    public void testNormalizeSymbolWithNullLiteral() {
        EqOperator op = getOp(DataTypes.INTEGER);
        Function function = new Function(
                op.info(), Arrays.<Symbol>asList(Literal.NULL, Literal.NULL));
        Literal result = (Literal)op.normalizeSymbol(function);
        assertNull(result.value());
        assertEquals(DataTypes.UNDEFINED, result.valueType());
    }
View Full Code Here

    @Test
    public void testNormalizeSymbolWithOneNullLiteral() {
        EqOperator op = getOp(DataTypes.INTEGER);
        Function function = new Function(
                op.info(), Arrays.<Symbol>asList(Literal.newLiteral(2), Literal.NULL));
        Literal result = (Literal)op.normalizeSymbol(function);
        assertNull(result.value());
        assertEquals(DataTypes.UNDEFINED, result.valueType());
    }
View Full Code Here

        assertTrue(op_lt_string.evaluate((Input) Literal.newLiteral("a"), (Input) Literal.newLiteral("c")));
    }

    @Test
    public void testNormalizeSymbolWithNull() throws Exception {
        Literal literal = (Literal)normalize(op_gt_string, Literal.NULL, Literal.newLiteral("aa"));
        assertNull(literal.value());
        assertEquals(DataTypes.UNDEFINED, literal.valueType());
    }
View Full Code Here

        Function function = new Function(implementation.info(), Arrays.<Symbol>asList(
                Literal.newLiteral("day"),
                Literal.newLiteral("Europe/Vienna"),
                Literal.newLiteral("2014-06-03")
        ));
        Literal day = (Literal)implementation.normalizeSymbol(function);
        assertThat((Long)day.value(), is(1401746400000L));
    }
View Full Code Here

    private static final DataType STRING_SET_TYPE = new SetType(DataTypes.STRING);

    @Test
    public void testNormalizeSymbolSetLiteralIntegerIncluded() {
        Literal<Integer> inValue = Literal.newLiteral(1);
        Literal inListValues = Literal.newLiteral(INTEGER_SET_TYPE, Sets.newHashSet(1, 2, 4, 8));

        List<Symbol> arguments = new ArrayList<>();
        arguments.add(inValue);
        arguments.add(inListValues);
View Full Code Here

    @Test
    public void testNormalizeSymbolSetLiteralIntegerNotIncluded() {
        Literal<Integer> inValue = Literal.newLiteral(128);

        Literal inListValues = Literal.newLiteral(INTEGER_SET_TYPE, Sets.newHashSet(1, 2, 4, 8));

        List<Symbol> arguments = new ArrayList<>();
        arguments.add(inValue);
        arguments.add(inListValues);
View Full Code Here

    }

    @Test
    public void testNormalizeSymbolSetLiteralDifferentDataTypeValue() {
        Literal<Double> value = Literal.newLiteral(2.0);
        Literal inListValues = Literal.newLiteral(INTEGER_SET_TYPE, Sets.newHashSet(1, 2, 4, 8));

        List<Symbol> arguments = new ArrayList<>();
        arguments.add(value);
        arguments.add(inListValues);
View Full Code Here

import static org.junit.Assert.*;

public class AnyLikeOperatorTest {

    private static Symbol normalizeSymbol(String pattern, String ... expressions) {
        Literal patternLiteral = Literal.newLiteral(pattern);
        Object[] value = new Object[expressions.length];
        for (int i=0; i < expressions.length; i++) {
            value[i] = expressions[i] == null ? null : new BytesRef(expressions[i]);
        }
        Literal valuesLiteral = Literal.newLiteral(new ArrayType(DataTypes.STRING), value);
        AnyLikeOperator impl = (AnyLikeOperator)new AnyLikeOperator.AnyLikeResolver().getForTypes(
                Arrays.asList(valuesLiteral.valueType(), patternLiteral.valueType())
        );

        Function function = new Function(
                impl.info(),
                Arrays.<Symbol>asList(valuesLiteral, patternLiteral)
View Full Code Here

    }

    @Test
    public void testNormalizeSymbolSetLiteralReference() {
        Reference reference = new Reference();
        Literal inListValues = Literal.newLiteral(INTEGER_SET_TYPE, Sets.newHashSet(1, 2, 4, 8));

        List<Symbol> arguments = new ArrayList<>();
        arguments.add(reference);
        arguments.add(inListValues);
View Full Code Here

TOP

Related Classes of io.crate.planner.symbol.Literal

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.