Package io.crate.planner.symbol

Examples of io.crate.planner.symbol.Symbol$SymbolFactory


    @Test
    @SuppressWarnings("unchecked")
    public void testNormalizeSymbol() throws Exception {

        Function function = substr("cratedata", 0L);
        Symbol result = funcA.normalizeSymbol(function);
        assertLiteralSymbol(result, "cratedata");

        function = substr("cratedata", 6L);
        result = funcA.normalizeSymbol(function);
        assertLiteralSymbol(result, "data");
View Full Code Here


    }

    @Test
    public void testNullLiteralFrom() throws Exception {
        Function function = substr("cratedata", Literal.NULL);
        Symbol result = funcA.normalizeSymbol(function);
        assertLiteralSymbol(result, null, DataTypes.UNDEFINED);
    }
View Full Code Here

    }

    @Test
    public void testNullLiteralCount() throws Exception {
        Function function = substr("cratedata", Literal.newLiteral(1), Literal.NULL);
        Symbol result = funcB.normalizeSymbol(function);
        assertLiteralSymbol(result, null, DataTypes.UNDEFINED);
    }
View Full Code Here

    }

    @Test
    public void testNullLiteralFromCount() throws Exception {
        Function function = substr("cratedata", Literal.NULL, Literal.NULL);
        Symbol result = funcB.normalizeSymbol(function);
        assertLiteralSymbol(result, null, DataTypes.UNDEFINED);
    }
View Full Code Here

                Arrays.<Symbol>asList(
                        Literal.newLiteral(DataTypes.STRING, null),
                        Literal.newLiteral(1)
                ));
        Scalar<BytesRef, Object> func = (Scalar<BytesRef, Object>) functions.get(function.info().ident());
        Symbol symbol = func.normalizeSymbol(function);
        assertNull(((Literal) symbol).value());
    }
View Full Code Here

    public void testNormalizeSymbolReferenceAndLiteral() throws Exception {
        OrOperator operator = new OrOperator();

        Function function = new Function(
                operator.info(), Arrays.<Symbol>asList(new Reference(), Literal.newLiteral(true)));
        Symbol normalizedSymbol = operator.normalizeSymbol(function);
        assertLiteralSymbol(normalizedSymbol, true);
    }
View Full Code Here

    @Test
    public void testNormalizeSymbolReferenceAndLiteralFalse() throws Exception {
        OrOperator operator = new OrOperator();
        Function function = new Function(
                operator.info(), Arrays.<Symbol>asList(new Reference(), Literal.newLiteral(false)));
        Symbol normalizedSymbol = operator.normalizeSymbol(function);
        assertThat(normalizedSymbol, instanceOf(Reference.class));
    }
View Full Code Here

    public void testNormalizeSymbolReferenceAndReference() throws Exception {
        OrOperator operator = new OrOperator();

        Function function = new Function(
                operator.info(), Arrays.<Symbol>asList(new Reference(), new Reference()));
        Symbol normalizedSymbol = operator.normalizeSymbol(function);
        assertThat(normalizedSymbol, instanceOf(Function.class));
    }
View Full Code Here

                Literal.newLiteral("Crate")
        );
        Function function = createFunction(ReplaceFunction.NAME, DataTypes.STRING, arguments);
        ReplaceFunction regexpImpl = (ReplaceFunction) functions.get(function.info().ident());

        Symbol result = regexpImpl.normalizeSymbol(function);
        assertLiteralSymbol(result, expected.utf8ToString());

        arguments = Arrays.<Symbol>asList(
                createReference("text", DataTypes.STRING),
                Literal.newLiteral("(ba)"),
View Full Code Here

                Literal.newLiteral("us n")
        );
        Function function = createFunction(ReplaceFunction.NAME, DataTypes.STRING, arguments);
        ReplaceFunction regexpImpl = (ReplaceFunction) functions.get(function.info().ident());

        Symbol result = regexpImpl.normalizeSymbol(function);
        assertLiteralSymbol(result, expected.utf8ToString());
    }
View Full Code Here

TOP

Related Classes of io.crate.planner.symbol.Symbol$SymbolFactory

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.