Package io.crate.planner.symbol

Examples of io.crate.planner.symbol.Function


            return o;
        }
    }

    public Symbol normalizeTzAware(Symbol interval, Symbol tz, Symbol timestamp) {
        Function function = new Function(funcTZ.info(), Arrays.asList(interval, tz, timestamp));
        return funcTZ.normalizeSymbol(function);
    }
View Full Code Here


    }

    @Test
    public void testWhereReferenceLikeString() throws Exception {
        FunctionImplementation impl = functions.get(new FunctionIdent(LikeOperator.NAME, typeX2(name_ref.valueType())));
        Function whereClause = new Function(impl.info(),
                Arrays.<Symbol>asList(name_ref, Literal.newLiteral("%thu%")));
        xcontentAssert(whereClause, "{\"query\":{\"wildcard\":{\"name\":\"*thu*\"}}}");
    }
View Full Code Here

    public void testWhereNotReferenceLikeString() throws Exception {
        FunctionImplementation notOp = functions.get(
                new FunctionIdent(NotPredicate.NAME, Arrays.<DataType>asList(DataTypes.BOOLEAN)));
        FunctionImplementation likeOp = functions.get(new FunctionIdent(LikeOperator.NAME, typeX2(name_ref.valueType())));

        Function likeClause = new Function(likeOp.info(),
                Arrays.<Symbol>asList(name_ref, Literal.newLiteral("%thu%")));
        Function whereClause = new Function(notOp.info(), Arrays.<Symbol>asList(likeClause));
        xcontentAssert(whereClause, "{\"query\":{\"bool\":{\"must_not\":{\"wildcard\":{\"name\":\"*thu*\"}}}}}");
    }
View Full Code Here

        List<Symbol> arguments = new ArrayList<>();
        arguments.add(inValue);
        arguments.add(inListValues);

        InOperator op = new InOperator(Operator.generateInfo(InOperator.NAME, DataTypes.INTEGER));
        Function function = new Function(op.info(), arguments);
        Symbol result = op.normalizeSymbol(function);

        assertLiteralSymbol(result, true);
    }
View Full Code Here

    public void testDateTruncWithStringLiteral() {
        Scalar implementation = (Scalar)functions.get(new FunctionIdent(DateTruncTimeZoneAwareFunction.NAME,
                Arrays.<DataType>asList(DataTypes.STRING, DataTypes.STRING, DataTypes.STRING)));
        assertNotNull(implementation);

        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);
View Full Code Here

    @Test
    public void testWhereReferenceIsNull() throws Exception {
        FunctionImplementation isNullImpl = functions.get(
                new FunctionIdent(IsNullPredicate.NAME, Arrays.asList(extrafield.valueType())));

        Function isNull = new Function(isNullImpl.info(), Arrays.<Symbol>asList(extrafield));
        xcontentAssert(isNull, "{\"query\":{\"filtered\":{\"filter\":{\"missing\":{\"field\":\"extrafield\",\"existence\":true,\"null_value\":true}}}}}");
    }
View Full Code Here

        List<Symbol> arguments = new ArrayList<>();
        arguments.add(inValue);
        arguments.add(inListValues);

        InOperator op = new InOperator(Operator.generateInfo(InOperator.NAME, DataTypes.INTEGER));
        Function function = new Function(op.info(), arguments);
        Symbol result = op.normalizeSymbol(function);

        assertLiteralSymbol(result, false);
    }
View Full Code Here

        ));

        ImmutableSet<BytesRef> list = ImmutableSet.of(
                new BytesRef("alpha"), new BytesRef("bravo"), new BytesRef("charlie"));
        Literal set = Literal.newLiteral(new SetType(DataTypes.STRING), list);
        Function inList = new Function(inListImpl.info(), Arrays.<Symbol>asList(ref, set));

        BytesReference reference = generator.convert(new WhereClause(inList));
        Tuple<XContentType, Map<String, Object>> actualMap =
                XContentHelper.convertToMap(reference, true);
        ArrayList<String> actualList = ((ArrayList)
View Full Code Here

        List<Symbol> arguments = new ArrayList<>();
        arguments.add(value);
        arguments.add(inListValues);

        InOperator op = new InOperator(Operator.generateInfo(InOperator.NAME, DataTypes.INTEGER));
        Function function = new Function(op.info(), arguments);
        Symbol result = op.normalizeSymbol(function);

        assertLiteralSymbol(result, false);
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    public void testDateTruncWithStringReference() {
        Scalar implementation = (Scalar)functions.get(new FunctionIdent(DateTruncFunction.NAME,
                Arrays.<DataType>asList(DataTypes.STRING, DataTypes.STRING, DataTypes.STRING)));
        assertNotNull(implementation);
        Function function = new Function(implementation.info(), Arrays.<Symbol>asList(
                Literal.newLiteral("day"),
                createReference("dummy", DataTypes.STRING)
        ));
        implementation.normalizeSymbol(function);
    }
View Full Code Here

TOP

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

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.