use of com.facebook.presto.block.BlockEncodingManager in project presto by prestodb.
the class TaskTestUtils method createTestingPlanner.
public static LocalExecutionPlanner createTestingPlanner() {
MetadataManager metadata = MetadataManager.createTestMetadataManager();
PageSourceManager pageSourceManager = new PageSourceManager();
pageSourceManager.addConnectorPageSourceProvider(CONNECTOR_ID, new TestingPageSourceProvider());
// we don't start the finalizer so nothing will be collected, which is ok for a test
FinalizerService finalizerService = new FinalizerService();
NodeScheduler nodeScheduler = new NodeScheduler(new LegacyNetworkTopology(), new InMemoryNodeManager(), new NodeSchedulerConfig().setIncludeCoordinator(true), new NodeTaskMap(finalizerService));
NodePartitioningManager nodePartitioningManager = new NodePartitioningManager(nodeScheduler);
return new LocalExecutionPlanner(metadata, new SqlParser(), Optional.empty(), pageSourceManager, new IndexManager(), nodePartitioningManager, new PageSinkManager(), new MockExchangeClientSupplier(), new ExpressionCompiler(metadata), new JoinFilterFunctionCompiler(metadata), new IndexJoinLookupStats(), new CompilerConfig(), new TaskManagerConfig(), new BinarySpillerFactory(new BlockEncodingManager(metadata.getTypeManager()), new FeaturesConfig()), new TestingBlockEncodingSerde(new TestingTypeManager()), new PagesIndex.TestingFactory(), new JoinCompiler(), new LookupJoinOperators(new JoinProbeCompiler()));
}
use of com.facebook.presto.block.BlockEncodingManager in project presto by prestodb.
the class TestFunctionRegistry method testIdentityCast.
@Test
public void testIdentityCast() {
TypeRegistry typeManager = new TypeRegistry();
FunctionRegistry registry = new FunctionRegistry(typeManager, new BlockEncodingManager(typeManager), new FeaturesConfig());
Signature exactOperator = registry.getCoercion(HYPER_LOG_LOG, HYPER_LOG_LOG);
assertEquals(exactOperator.getName(), mangleOperatorName(OperatorType.CAST.name()));
assertEquals(transform(exactOperator.getArgumentTypes(), Functions.toStringFunction()), ImmutableList.of(StandardTypes.HYPER_LOG_LOG));
assertEquals(exactOperator.getReturnType().getBase(), StandardTypes.HYPER_LOG_LOG);
}
use of com.facebook.presto.block.BlockEncodingManager in project presto by prestodb.
the class TestFunctionRegistry method testConflictingScalarAggregation.
@Test(expectedExceptions = IllegalStateException.class, expectedExceptionsMessageRegExp = "'sum' is both an aggregation and a scalar function")
public void testConflictingScalarAggregation() throws Exception {
List<SqlFunction> functions = new FunctionListBuilder().scalars(ScalarSum.class).getFunctions();
TypeRegistry typeManager = new TypeRegistry();
FunctionRegistry registry = new FunctionRegistry(typeManager, new BlockEncodingManager(typeManager), new FeaturesConfig());
registry.addFunctions(functions);
}
use of com.facebook.presto.block.BlockEncodingManager in project presto by prestodb.
the class TestFunctionRegistry method testExactMatchBeforeCoercion.
@Test
public void testExactMatchBeforeCoercion() {
TypeRegistry typeManager = new TypeRegistry();
FunctionRegistry registry = new FunctionRegistry(typeManager, new BlockEncodingManager(typeManager), new FeaturesConfig());
boolean foundOperator = false;
for (SqlFunction function : registry.listOperators()) {
OperatorType operatorType = unmangleOperator(function.getSignature().getName());
if (operatorType == OperatorType.CAST || operatorType == OperatorType.SATURATED_FLOOR_CAST) {
continue;
}
if (!function.getSignature().getTypeVariableConstraints().isEmpty()) {
continue;
}
if (function.getSignature().getArgumentTypes().stream().anyMatch(TypeSignature::isCalculated)) {
continue;
}
Signature exactOperator = registry.resolveOperator(operatorType, resolveTypes(function.getSignature().getArgumentTypes(), typeManager));
assertEquals(exactOperator, function.getSignature());
foundOperator = true;
}
assertTrue(foundOperator);
}
use of com.facebook.presto.block.BlockEncodingManager in project presto by prestodb.
the class TestTypeRegistry method testCastOperatorsExistForCoercions.
@Test
public void testCastOperatorsExistForCoercions() {
FunctionRegistry functionRegistry = new FunctionRegistry(typeRegistry, new BlockEncodingManager(typeRegistry), new FeaturesConfig());
Set<Type> types = getStandardPrimitiveTypes();
for (Type sourceType : types) {
for (Type resultType : types) {
if (typeRegistry.canCoerce(sourceType, resultType) && sourceType != UNKNOWN && resultType != UNKNOWN) {
assertTrue(functionRegistry.canResolveOperator(OperatorType.CAST, resultType, ImmutableList.of(sourceType)), format("'%s' -> '%s' coercion exists but there is no cast operator", sourceType, resultType));
}
}
}
}
Aggregations