Package io.crate.planner.symbol

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


                Literal.newLiteral("%tY"),
                Literal.newLiteral(DataTypes.TIMESTAMP, DataTypes.TIMESTAMP.value("2014-03-02")));
        Function function = createFunction(FormatFunction.NAME, DataTypes.STRING, args);

        FunctionImplementation format = functions.get(function.info().ident());
        Symbol result = format.normalizeSymbol(function);

        assertLiteralSymbol(result, "2014");
    }
View Full Code Here


        return operator.normalizeSymbol(getFunction(operator, symbols));
    }

    @Test
    public void testLteNormalizeSymbolTwoLiteral() throws Exception {
        Symbol symbol = normalize(op_lte_long, Literal.newLiteral(8L), Literal.newLiteral(200L));
        assertLiteralSymbol(symbol, true);

        symbol = normalize(op_lte_long, Literal.newLiteral(8L), Literal.newLiteral(8L));
        assertLiteralSymbol(symbol, true);
View Full Code Here

        assertLiteralSymbol(symbol, false);
    }

    @Test
    public void testGteNormalizeSymbolTwoLiteral() throws Exception {
        Symbol symbol = normalize(op_gte_double, Literal.newLiteral(0.03), Literal.newLiteral(0.4));
        assertLiteralSymbol(symbol, false);

        symbol = normalize(op_gte_double, Literal.newLiteral(0.4), Literal.newLiteral(0.4));
        assertLiteralSymbol(symbol, true);
View Full Code Here

        assertLiteralSymbol(symbol, true);
    }

    @Test
    public void testLtNormalizeSymbolTwoLiteralTrue() throws Exception {
        Symbol symbol = normalize(op_lt_int, Literal.newLiteral(2), Literal.newLiteral(4));
        assertLiteralSymbol(symbol, true);
    }
View Full Code Here

        assertLiteralSymbol(symbol, true);
    }

    @Test
    public void testLtNormalizeSymbolTwoLiteralFalse() throws Exception {
        Symbol symbol = normalize(op_lt_int, Literal.newLiteral(4), Literal.newLiteral(2));
        assertLiteralSymbol(symbol, false);
    }
View Full Code Here

        assertLiteralSymbol(symbol, false);
    }

    @Test
    public void testLtNormalizeSymbolTwoLiteralFalseEq() throws Exception {
        Symbol symbol = normalize(op_lt_int, Literal.newLiteral(4), Literal.newLiteral(4));
        assertLiteralSymbol(symbol, false);
    }
View Full Code Here

        assertLiteralSymbol(symbol, false);
    }

    @Test
    public void testGtNormalizeSymbolTwoLiteralFalse() throws Exception {
        Symbol symbol = normalize(op_gt_string, Literal.newLiteral("aa"), Literal.newLiteral("bbb"));
        assertLiteralSymbol(symbol, false);
    }
View Full Code Here

        assertEquals(DataTypes.UNDEFINED, literal.valueType());
    }

    @Test
    public void testNormalizeSymbolNonLiteral() throws Exception {
        Symbol symbol = normalize(op_gt_string, Literal.newLiteral("a"), new Value(DataTypes.STRING));
        assertThat(symbol, instanceOf(Function.class));
    }
View Full Code Here

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

        Symbol result = regexpImpl.normalizeSymbol(function);
        BytesRef[] expected = new BytesRef[]{ new BytesRef("ba") };
        assertLiteralSymbol(result, expected, new ArrayType(DataTypes.STRING));

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

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

        Symbol result = regexpImpl.normalizeSymbol(function);
        BytesRef[] expected = new BytesRef[]{ new BytesRef("ba") };
        assertLiteralSymbol(result, expected, new ArrayType(DataTypes.STRING));
    }
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.