Package io.crate.planner.symbol

Examples of io.crate.planner.symbol.Symbol


    @Test
    public void testNormalizeSymbolTzAwareReferenceTimestamp() throws Exception {
        Function function = new Function(funcTZ.info(),
                Arrays.<Symbol>asList(Literal.newLiteral("day"), Literal.newLiteral("+01:00"),
                        new Reference(new ReferenceInfo(null,null,DataTypes.TIMESTAMP))));
        Symbol result = funcTZ.normalizeSymbol(function);
        assertSame(function, result);
    }
View Full Code Here


        assertSame(function, result);
    }

    @Test
    public void testNormalizeSymbolTzAwareTimestampLiteral() throws Exception {
        Symbol result = normalizeTzAware(
                Literal.newLiteral("day"),
                Literal.newLiteral("UTC"),
                Literal.newLiteral(DataTypes.TIMESTAMP, DataTypes.TIMESTAMP.value("2014-02-25T13:38:01.123")));
        assertLiteralSymbol(result, 1393286400000L, DataTypes.TIMESTAMP);
    }
View Full Code Here

        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

        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

        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

        arguments.add(reference);
        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);

        assertThat(result, instanceOf(Function.class));
        assertThat(((Function) result).info().ident().name(), is(InOperator.NAME));
    }
View Full Code Here

        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

        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

    public void testNormalizeSymbol() throws Exception {

        FunctionImplementation castIntegerToString = functions.get(new FunctionIdent(ToStringFunction.NAME, ImmutableList.<DataType>of(DataTypes.INTEGER)));

        Function function = new Function(castIntegerToString.info(), Arrays.<Symbol>asList(Literal.newLiteral(123)));
        Symbol result = castIntegerToString.normalizeSymbol(function);
        assertLiteralSymbol(result, "123");

        FunctionImplementation castFloatToString = functions.get(new FunctionIdent(ToStringFunction.NAME, ImmutableList.<DataType>of(DataTypes.FLOAT)));
        function = new Function(castFloatToString.info(), Arrays.<Symbol>asList(Literal.newLiteral(0.5f)));
        result = castFloatToString.normalizeSymbol(function);
View Full Code Here

        final DataType arrayType = new ArrayType(DataTypes.STRING);
        ToLongArrayFunction impl = (ToLongArrayFunction)functions.get(
                new FunctionIdent(ToLongArrayFunction.NAME, ImmutableList.of(arrayType)));

        Reference foo = TestingHelpers.createReference("foo", arrayType);
        Symbol symbol = impl.normalizeSymbol(new Function(impl.info(), Arrays.<Symbol>asList(foo)));
        assertThat(symbol, instanceOf(Function.class));
    }
View Full Code Here

TOP

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

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.