Package io.crate.planner.symbol

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


            @Override
            public DataType valueType() {
                return arrayType;
            }
        };
        Symbol normalized = impl.normalizeSymbol(new Function(impl.info(), Arrays.<Symbol>asList(input)));
        Object[] values = impl.evaluate(new Input[]{input});

        assertThat(values, is(((Input) normalized).value()));
        return values;
    }
View Full Code Here


            @Override
            public DataType valueType() {
                return arrayType;
            }
        };
        Symbol normalized = impl.normalizeSymbol(new Function(impl.info(), Arrays.<Symbol>asList(input)));
        Object[] integers = impl.evaluate(new Input[]{input});

        assertThat(integers, is(((Input) normalized).value()));
        return integers;
    }
View Full Code Here

            @Override
            public DataType valueType() {
                return arrayType;
            }
        };
        Symbol normalized = impl.normalizeSymbol(new Function(impl.info(), Arrays.<Symbol>asList(input)));
        Object[] integers = impl.evaluate(new Input[]{input});

        assertThat(integers, is(((Input) normalized).value()));
        return integers;
    }
View Full Code Here

            @Override
            public DataType valueType() {
                return arrayType;
            }
        };
        Symbol normalized = impl.normalizeSymbol(new Function(impl.info(), Arrays.<Symbol>asList(input)));
        Object[] integers = impl.evaluate(new Input[]{input});

        assertThat(integers, is(((Input) normalized).value()));
        return integers;
    }
View Full Code Here

        TableInfo tablesTableInfo = schemaInfo.getTableInfo("tables");
        List<Symbol> toCollect = new ArrayList<>();
        for (ReferenceInfo info : tablesTableInfo.columns()) {
            toCollect.add(new Reference(info));
        }
        Symbol tableNameRef = toCollect.get(1);

        FunctionImplementation eqImpl = functions.get(new FunctionIdent(EqOperator.NAME,
                ImmutableList.<DataType>of(DataTypes.STRING, DataTypes.STRING)));
        Function whereClause = new Function(eqImpl.info(),
                Arrays.asList(tableNameRef, Literal.newLiteral("shards")));
View Full Code Here

    }

    @Test
    @SuppressWarnings("unchecked")
    public void testNormalizeWithStringTypes() throws Exception {
        Symbol symbol = normalize(Arrays.<Symbol>asList(
                Literal.newLiteral("POINT (10 20)"),
                Literal.newLiteral("POINT (11 21)")
        ));
        assertLiteralSymbol(symbol, 152462.70754934277);
    }
View Full Code Here

    }

    @Test
    public void testNormalizeWithDoubleArray() throws Exception {
        DataType type = new ArrayType(DataTypes.DOUBLE);
        Symbol symbol = normalize(Arrays.<Symbol>asList(
                Literal.newLiteral(type, new Double[]{10.0, 20.0}),
                Literal.newLiteral(type, new Double[]{11.0, 21.0})
        ));
        assertLiteralSymbol(symbol, 152462.70754934277);
    }
View Full Code Here

                Literal.newLiteral(DataTypes.GEO_POINT, null),
                Literal.newLiteral(DataTypes.GEO_POINT, DataTypes.GEO_POINT.value("POINT (10 20)"))
        );
        Double distance = evaluate(args);
        assertNull(distance);
        Symbol distanceSymbol = normalize(args);
        assertNull(((Literal) distanceSymbol).value());

        distanceSymbol = normalize(Lists.reverse(args));
        assertNull(((Literal) distanceSymbol).value());
    }
View Full Code Here

    public void testNormalizeWithReferenceAndLiteral() throws Exception {
        List<Symbol> arguments = Arrays.<Symbol>asList(
                createReference("foo", DataTypes.GEO_POINT),
                Literal.newGeoShape("POLYGON ((5 5, 20 5, 30 30, 5 30, 5 5))"));
        WithinFunction withinFunction = functionFromArgs(arguments);
        Symbol function = new Function(withinFunction.info(), arguments);
        Symbol normalizedSymbol = withinFunction.normalizeSymbol((Function) function);
        assertThat(normalizedSymbol, Matchers.sameInstance(function));
    }
View Full Code Here

        assertThat(normalizedSymbol, Matchers.sameInstance(function));
    }

    @Test
    public void testNormalizeWithTwoLiterals() throws Exception {
        Symbol normalized = normalize(Arrays.<Symbol>asList(
                Literal.newGeoShape("POLYGON ((10 10, 11 10, 11 11, 10 11, 10 10))"),
                Literal.newGeoShape("POLYGON ((5 5, 20 5, 30 30, 5 30, 5 5))")));
        assertLiteralSymbol(normalized, true);
    }
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.