Package com.facebook.presto.type

Examples of com.facebook.presto.type.TypeRegistry


        Signature signature = getMagicLiteralFunctionSignature(TIMESTAMP_WITH_TIME_ZONE);
        assertEquals(signature.getName(), "$literal$timestamp with time zone");
        assertEquals(signature.getArgumentTypes(), ImmutableList.of(StandardTypes.BIGINT));
        assertEquals(signature.getReturnType(), StandardTypes.TIMESTAMP_WITH_TIME_ZONE);

        FunctionRegistry registry = new FunctionRegistry(new TypeRegistry(), true);
        FunctionInfo function = registry.resolveFunction(QualifiedName.of(signature.getName()), signature.getArgumentTypes(), false);
        assertEquals(function.getArgumentTypes(), ImmutableList.of(StandardTypes.BIGINT));
        assertEquals(signature.getReturnType(), StandardTypes.TIMESTAMP_WITH_TIME_ZONE);
    }
View Full Code Here


    }

    @Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "\\QFunction already registered: custom_add(bigint,bigint):bigint\\E")
    public void testDuplicateFunctions()
    {
        List<ParametricFunction> functions = new FunctionListBuilder(new TypeRegistry())
                .scalar(CustomFunctions.class)
                .getFunctions();

        functions = FluentIterable.from(functions).filter(new Predicate<ParametricFunction>()
        {
            @Override
            public boolean apply(ParametricFunction input)
            {
                return input.getSignature().getName().equals("custom_add");
            }
        }).toList();

        FunctionRegistry registry = new FunctionRegistry(new TypeRegistry(), true);
        registry.addFunctions(functions);
        registry.addFunctions(functions);
    }
View Full Code Here

    @Test(expectedExceptions = IllegalStateException.class, expectedExceptionsMessageRegExp = "'sum' is both an aggregation and a scalar function")
    public void testConflictingScalarAggregation()
            throws Exception
    {
        List<ParametricFunction> functions = new FunctionListBuilder(new TypeRegistry())
                .scalar(ScalarSum.class)
                .getFunctions();

        FunctionRegistry registry = new FunctionRegistry(new TypeRegistry(), true);
        registry.addFunctions(functions);
    }
View Full Code Here

    @Test
    public void testListingHiddenFunctions()
            throws Exception
    {
        FunctionRegistry registry = new FunctionRegistry(new TypeRegistry(), true);
        List<ParametricFunction> functions = registry.list();
        List<String> names = transform(functions, nameGetter());

        assertTrue(names.contains("length"), "Expected function names " + names + " to contain 'length'");
        assertTrue(names.contains("stddev"), "Expected function names " + names + " to contain 'stddev'");
View Full Code Here

    }

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

{
    @BeforeClass
    public void setup()
    {
        InternalAggregationFunction function = new AggregationCompiler().generateAggregationFunction(CountNull.class);
        functionRegistry.addFunctions(new FunctionListBuilder(new TypeRegistry()).aggregate(function).getFunctions());
    }
View Full Code Here

        HiveConnectorFactory hiveConnectorFactory = new HiveConnectorFactory(
                "hive",
                ImmutableMap.of("node.environment", "test"),
                HiveBenchmarkQueryRunner.class.getClassLoader(),
                metastore,
                new TypeRegistry());

        Map<String, String> hiveCatalogConfig = ImmutableMap.<String, String>builder()
                .put("hive.metastore.uri", "thrift://none.invalid")
                .put("hive.max-split-size", "10GB")
                .build();
View Full Code Here

                    splitProperties,
                    new ArrayList<HivePartitionKey>(),
                    getColumns(),
                    DateTimeZone.getDefault(),
                    DateTimeZone.getDefault(),
                    new TypeRegistry());

            checkCursor(cursor);
        }
        finally {
            //noinspection ResultOfMethodCallIgnored
View Full Code Here

                    split.getLength(),
                    splitProperties,
                    new ArrayList<HivePartitionKey>(),
                    getColumns(),
                    DateTimeZone.getDefault(),
                    new TypeRegistry());

            checkCursor(cursor);
        }
        finally {
            //noinspection ResultOfMethodCallIgnored
View Full Code Here

                hiveClientConfig.getMaxInitialSplits(),
                false,
                true,
                hiveClientConfig.getHiveStorageFormat(),
                false,
                new TypeRegistry());

        metadata = client;
        splitManager = client;
        recordSetProvider = client;
        recordSinkProvider = client;
View Full Code Here

TOP

Related Classes of com.facebook.presto.type.TypeRegistry

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.