Package io.crate.planner.symbol

Examples of io.crate.planner.symbol.Function.arguments()


        Function whereClause = (Function)analysis.whereClause().query();
        assertEquals(EqOperator.NAME, whereClause.info().ident().name());
        assertFalse(whereClause.info().type() == FunctionInfo.Type.AGGREGATE);

        assertThat(whereClause.arguments().get(0), IsInstanceOf.instanceOf(Reference.class));

        assertLiteralSymbol(whereClause.arguments().get(1), "Trillian");
    }

    @Test( expected = UnsupportedOperationException.class)
View Full Code Here


        assertEquals(EqOperator.NAME, whereClause.info().ident().name());
        assertFalse(whereClause.info().type() == FunctionInfo.Type.AGGREGATE);

        assertThat(whereClause.arguments().get(0), IsInstanceOf.instanceOf(Reference.class));

        assertLiteralSymbol(whereClause.arguments().get(1), "Trillian");
    }

    @Test( expected = UnsupportedOperationException.class)
    public void testDeleteSystemTable() throws Exception {
        analyze("delete from sys.nodes where name='Trillian'");
View Full Code Here

    public void testNormalizeWithValidRefAndStringLiteral() throws Exception {
        Function symbol = (Function) normalize(Arrays.<Symbol>asList(
                createReference("foo", DataTypes.GEO_POINT),
                Literal.newLiteral("POINT(10 20)")
        ));
        assertLiteralSymbol(symbol.arguments().get(1),
                new Double[]{10.0d, 20.0d}, DataTypes.GEO_POINT);

        // args reversed
        symbol = (Function) normalize(Arrays.<Symbol>asList(
                Literal.newLiteral("POINT(10 20)"),
View Full Code Here

        // args reversed
        symbol = (Function) normalize(Arrays.<Symbol>asList(
                Literal.newLiteral("POINT(10 20)"),
                createReference("foo", DataTypes.GEO_POINT)
        ));
        assertLiteralSymbol(symbol.arguments().get(1),
                new Double[] { 10.0d, 20.0d }, DataTypes.GEO_POINT);
    }

    @Test
    public void testNormalizeWithValidRefAndGeoPointLiteral() throws Exception {
View Full Code Here

    public void testNormalizeWithValidRefAndGeoPointLiteral() throws Exception {
        Function symbol = (Function) normalize(Arrays.<Symbol>asList(
                createReference("foo", DataTypes.GEO_POINT),
                Literal.newLiteral(DataTypes.GEO_POINT, DataTypes.GEO_POINT.value("POINT (10 20)"))
        ));
        assertLiteralSymbol(symbol.arguments().get(1),
                new Double[]{10.0d, 20.0d}, DataTypes.GEO_POINT);

        // args reversed
        symbol = (Function) normalize(Arrays.<Symbol>asList(
                Literal.newLiteral(DataTypes.GEO_POINT, DataTypes.GEO_POINT.value("POINT (10 20)")),
View Full Code Here

        // args reversed
        symbol = (Function) normalize(Arrays.<Symbol>asList(
                Literal.newLiteral(DataTypes.GEO_POINT, DataTypes.GEO_POINT.value("POINT (10 20)")),
                createReference("foo", DataTypes.GEO_POINT)
        ));
        assertLiteralSymbol(symbol.arguments().get(1),
                new Double[] { 10.0d, 20.0d }, DataTypes.GEO_POINT);
    }

    @Test
    public void testNormalizeWithValidGeoPointLiterals() throws Exception {
View Full Code Here

        Symbol normalized = normalize(
                createReference("point", DataTypes.GEO_POINT),
                Literal.newLiteral("POLYGON ((5 5, 20 5, 30 30, 5 30, 5 5))"));
        assertThat(normalized, Matchers.instanceOf(Function.class));
        Function function = (Function) normalized;
        Symbol symbol = function.arguments().get(1);
        assertThat(DataTypeVisitor.fromSymbol(symbol), equalTo((DataType) DataTypes.GEO_SHAPE));
    }

    @Test
    public void testNormalizeWithFirstArgAsStringReference() throws Exception {
View Full Code Here

            return false;
        }

        Function function = (Function)symbol;
        return (function.info().type() == FunctionInfo.Type.AGGREGATE
                && function.arguments().size() == 0
                && function.info().ident().name().equalsIgnoreCase(CountAggregation.NAME));
    }

    private void groupBy(SelectAnalysis analysis, Plan plan, Context context) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.