Examples of SqlIntervalYearMonth


Examples of com.facebook.presto.spi.type.SqlIntervalYearMonth

    @Test
    public void testLiteral()
            throws Exception
    {
        assertFunction("INTERVAL '124-30' YEAR TO MONTH", new SqlIntervalYearMonth(124, 30));
        assertFunction("INTERVAL '124' YEAR TO MONTH", new SqlIntervalYearMonth(124, 0));

        assertFunction("INTERVAL '124' YEAR", new SqlIntervalYearMonth(124, 0));

        assertFunction("INTERVAL '30' MONTH", new SqlIntervalYearMonth(0, 30));
    }
View Full Code Here

Examples of com.facebook.presto.spi.type.SqlIntervalYearMonth

    @Test
    public void testAdd()
            throws Exception
    {
        assertFunction("INTERVAL '3' MONTH + INTERVAL '3' MONTH", new SqlIntervalYearMonth(6));
        assertFunction("INTERVAL '6' YEAR + INTERVAL '6' YEAR", new SqlIntervalYearMonth(12 * 12));
        assertFunction("INTERVAL '3' MONTH + INTERVAL '6' YEAR", new SqlIntervalYearMonth((6 * 12) + (3)));
    }
View Full Code Here

Examples of com.facebook.presto.spi.type.SqlIntervalYearMonth

    @Test
    public void testSubtract()
            throws Exception
    {
        assertFunction("INTERVAL '6' MONTH - INTERVAL '3' MONTH", new SqlIntervalYearMonth(3));
        assertFunction("INTERVAL '9' YEAR - INTERVAL '6' YEAR", new SqlIntervalYearMonth(3 * 12));
        assertFunction("INTERVAL '3' MONTH - INTERVAL '6' YEAR", new SqlIntervalYearMonth((3) - (6 * 12)));
    }
View Full Code Here

Examples of com.facebook.presto.spi.type.SqlIntervalYearMonth

    @Test
    public void testMultiply()
            throws Exception
    {
        assertFunction("INTERVAL '6' MONTH * 2", new SqlIntervalYearMonth(12));
        assertFunction("2 * INTERVAL '6' MONTH", new SqlIntervalYearMonth(12));
        assertFunction("INTERVAL '10' MONTH * 2.5", new SqlIntervalYearMonth(25));
        assertFunction("2.5 * INTERVAL '10' MONTH", new SqlIntervalYearMonth(25));

        assertFunction("INTERVAL '6' YEAR * 2", new SqlIntervalYearMonth(12 * 12));
        assertFunction("2 * INTERVAL '6' YEAR", new SqlIntervalYearMonth(12 * 12));
        assertFunction("INTERVAL '1' YEAR * 2.5", new SqlIntervalYearMonth((long) (2.5 * 12)));
        assertFunction("2.5 * INTERVAL '1' YEAR", new SqlIntervalYearMonth((long) (2.5 * 12)));
    }
View Full Code Here

Examples of com.facebook.presto.spi.type.SqlIntervalYearMonth

    @Test
    public void testDivide()
            throws Exception
    {
        assertFunction("INTERVAL '30' MONTH / 2", new SqlIntervalYearMonth(15));
        assertFunction("INTERVAL '60' MONTH / 2.5", new SqlIntervalYearMonth(24));

        assertFunction("INTERVAL '3' YEAR / 2", new SqlIntervalYearMonth(18));
        assertFunction("INTERVAL '4' YEAR / 4.8", new SqlIntervalYearMonth(10));
    }
View Full Code Here

Examples of com.facebook.presto.spi.type.SqlIntervalYearMonth

    @Test
    public void testNegation()
            throws Exception
    {
        assertFunction("- INTERVAL '3' MONTH", new SqlIntervalYearMonth(-3));
        assertFunction("- INTERVAL '6' YEAR", new SqlIntervalYearMonth(-72));
    }
View Full Code Here

Examples of com.facebook.presto.spi.type.SqlIntervalYearMonth

    @Test
    public void testCastToSlice()
            throws Exception
    {
        assertFunction("cast(INTERVAL '124-30' YEAR TO MONTH as varchar)", "126-6");
        assertFunction("cast(INTERVAL '124-30' YEAR TO MONTH as varchar)", new SqlIntervalYearMonth(124, 30).toString());

        assertFunction("cast(INTERVAL '124' YEAR TO MONTH as varchar)", new SqlIntervalYearMonth(124, 0).toString());
        assertFunction("cast(INTERVAL '124' YEAR as varchar)", new SqlIntervalYearMonth(124, 0).toString());

        assertFunction("cast(INTERVAL '30' MONTH as varchar)", new SqlIntervalYearMonth(0, 30).toString());
    }
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.