Package com.facebook.presto.spi.type

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


    @Test
    public void testBasic()
            throws Exception
    {
        TypeManager typeManager = new TypeRegistry();
        Signature signature = new Signature("foo", ImmutableList.of(typeParameter("T")), "T", ImmutableList.of("T"), false, true);
        assertNotNull(signature.bindTypeParameters(ImmutableList.<Type>of(BIGINT), true, typeManager));
        assertNotNull(signature.bindTypeParameters(ImmutableList.of(VARCHAR), true, typeManager));
        assertNull(signature.bindTypeParameters(ImmutableList.of(VARCHAR, BIGINT), true, typeManager));
        assertNotNull(signature.bindTypeParameters(ImmutableList.of(typeManager.getType("array<bigint>")), true, typeManager));
    }
View Full Code Here


    @Test
    public void testNonParametric()
            throws Exception
    {
        TypeManager typeManager = new TypeRegistry();
        Signature signature = new Signature("foo", ImmutableList.<TypeParameter>of(), "boolean", ImmutableList.of("bigint"), false, true);
        assertNotNull(signature.bindTypeParameters(ImmutableList.of(BIGINT), true, typeManager));
        assertNull(signature.bindTypeParameters(ImmutableList.of(VARCHAR), true, typeManager));
        assertNull(signature.bindTypeParameters(ImmutableList.of(VARCHAR, BIGINT), true, typeManager));
        assertNull(signature.bindTypeParameters(ImmutableList.of(typeManager.getType("array<bigint>")), true, typeManager));
    }
View Full Code Here

    @Test
    public void testArray()
            throws Exception
    {
        TypeManager typeManager = new TypeRegistry();
        Signature signature = new Signature("get", ImmutableList.of(typeParameter("T")), "T", ImmutableList.of("array<T>"), false, true);
        assertNotNull(signature.bindTypeParameters(ImmutableList.of(typeManager.getType("array<bigint>")), true, typeManager));
        assertNull(signature.bindTypeParameters(ImmutableList.of(BIGINT), true, typeManager));

        signature = new Signature("contains", ImmutableList.of(comparableTypeParameter("T")), "T", ImmutableList.of("array<T>", "T"), false, true);
        assertNotNull(signature.bindTypeParameters(ImmutableList.of(typeManager.getType("array<bigint>"), BIGINT), true, typeManager));
        assertNull(signature.bindTypeParameters(ImmutableList.of(typeManager.getType("array<bigint>"), VARCHAR), true, typeManager));
        assertNull(signature.bindTypeParameters(ImmutableList.of(typeManager.getType("array<HyperLogLog>"), HYPER_LOG_LOG), true, typeManager));

        signature = new Signature("foo", ImmutableList.of(typeParameter("T")), "T", ImmutableList.of("array<T>", "array<T>"), false, true);
        assertNotNull(signature.bindTypeParameters(ImmutableList.of(typeManager.getType("array<bigint>"), typeManager.getType("array<bigint>")), true, typeManager));
        assertNull(signature.bindTypeParameters(ImmutableList.of(typeManager.getType("array<bigint>"), typeManager.getType("array<varchar>")), true, typeManager));
    }
View Full Code Here

    @Test
    public void testMap()
            throws Exception
    {
        TypeManager typeManager = new TypeRegistry();
        Signature signature = new Signature("get", ImmutableList.of(typeParameter("K"), typeParameter("V")), "V", ImmutableList.of("map<K,V>", "K"), false, true);
        assertNotNull(signature.bindTypeParameters(ImmutableList.of(typeManager.getType("map<bigint,varchar>"), BIGINT), true, typeManager));
        assertNull(signature.bindTypeParameters(ImmutableList.of(typeManager.getType("map<bigint,varchar>"), VARCHAR), true, typeManager));
    }
View Full Code Here

    @Test
    public void testVarArgs()
            throws Exception
    {
        TypeManager typeManager = new TypeRegistry();
        Signature signature = new Signature("foo", ImmutableList.of(typeParameter("T")), "boolean", ImmutableList.of("T"), true, true);
        assertNotNull(signature.bindTypeParameters(ImmutableList.of(BIGINT), true, typeManager));
        assertNotNull(signature.bindTypeParameters(ImmutableList.of(VARCHAR), true, typeManager));
        assertNotNull(signature.bindTypeParameters(ImmutableList.of(BIGINT, BIGINT), true, typeManager));
        assertNull(signature.bindTypeParameters(ImmutableList.of(VARCHAR, BIGINT), true, typeManager));
View Full Code Here

    @Test
    public void testCoercion()
            throws Exception
    {
        TypeManager typeManager = new TypeRegistry();
        Signature signature = new Signature("foo", ImmutableList.of(typeParameter("T")), "boolean", ImmutableList.of("T", "double"), true, true);
        assertNotNull(signature.bindTypeParameters(ImmutableList.of(DOUBLE, DOUBLE), true, typeManager));
        assertNotNull(signature.bindTypeParameters(ImmutableList.of(BIGINT, BIGINT), true, typeManager));
        assertNotNull(signature.bindTypeParameters(ImmutableList.of(VARCHAR, BIGINT), true, typeManager));
        assertNull(signature.bindTypeParameters(ImmutableList.of(BIGINT, VARCHAR), true, typeManager));
View Full Code Here

    }

    @Test
    public void testNonexistentType()
    {
        TypeManager typeManager = new TypeRegistry();
        assertNull(typeManager.getType("not a real type"));
    }
View Full Code Here

                    .put("storage.data-directory", dataDir.getAbsolutePath())
                    .put("storage.compress", "false")
                    .build();

            BlockEncodingSerde blockEncodingSerde = createTestingBlockEncodingManager();
            TypeManager typeManager = new TypeRegistry();

            return new RaptorConnectorFactory(config, nodeManager, blockEncodingSerde, typeManager);
        }
        catch (Exception e) {
            throw Throwables.propagate(e);
View Full Code Here

                    .put("metadata.db.filename", databaseDir.getAbsolutePath())
                    .put("storage.data-directory", dataDir.getAbsolutePath())
                    .build();

            BlockEncodingSerde blockEncodingSerde = createTestingBlockEncodingManager();
            TypeManager typeManager = new TypeRegistry();

            return new RaptorConnectorFactory(config, nodeManager, blockEncodingSerde, typeManager);
        }
        catch (Exception e) {
            throw Throwables.propagate(e);
View Full Code Here

                    .put("storage.data-directory", dataDir.getAbsolutePath())
                    .put("storage.compress", "false")
                    .build();

            BlockEncodingSerde blockEncodingSerde = createTestingBlockEncodingManager();
            TypeManager typeManager = new TypeRegistry();

            return new RaptorConnectorFactory(config, nodeManager, blockEncodingSerde, typeManager);
        }
        catch (Exception e) {
            throw Throwables.propagate(e);
View Full Code Here

TOP

Related Classes of com.facebook.presto.spi.type.TypeManager

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.