use of com.facebook.presto.metadata.FunctionAndTypeManager in project presto by prestodb.
the class TestPrecisionRecallAggregation method setUp.
@BeforeClass
public void setUp() {
FunctionAndTypeManager functionAndTypeManager = MetadataManager.createTestMetadataManager().getFunctionAndTypeManager();
precisionRecallFunction = functionAndTypeManager.getAggregateFunctionImplementation(functionAndTypeManager.lookupFunction(this.functionName, fromTypes(BIGINT, BOOLEAN, DOUBLE, DOUBLE)));
}
use of com.facebook.presto.metadata.FunctionAndTypeManager in project presto by prestodb.
the class TestEntropyAggregation method setUp.
@BeforeClass
public void setUp() {
FunctionAndTypeManager functionAndTypeManager = MetadataManager.createTestMetadataManager().getFunctionAndTypeManager();
entropyFunction = functionAndTypeManager.getAggregateFunctionImplementation(functionAndTypeManager.lookupFunction(TestEntropyAggregation.FUNCTION_NAME, fromTypes(BIGINT)));
}
use of com.facebook.presto.metadata.FunctionAndTypeManager in project presto by prestodb.
the class BenchmarkEqualsOperator method setup.
@Setup
public void setup() {
MetadataManager metadata = MetadataManager.createTestMetadataManager();
FunctionAndTypeManager functionAndTypeManager = metadata.getFunctionAndTypeManager();
ExpressionCompiler expressionCompiler = new ExpressionCompiler(metadata, new PageFunctionCompiler(metadata, 0));
RowExpression projection = generateComplexComparisonProjection(functionAndTypeManager, FIELDS_COUNT, COMPARISONS_COUNT);
compiledProcessor = expressionCompiler.compilePageProcessor(SESSION.getSqlFunctionProperties(), Optional.empty(), ImmutableList.of(projection)).get();
}
use of com.facebook.presto.metadata.FunctionAndTypeManager in project presto by prestodb.
the class HiveFunctionsTestUtils method createTestingPrestoServer.
public static TestingPrestoServer createTestingPrestoServer() throws Exception {
TestingPrestoServer server = new TestingPrestoServer();
server.installPlugin(new MemoryPlugin());
server.installPlugin(new HiveFunctionNamespacePlugin());
server.createCatalog("memory", "memory");
FunctionAndTypeManager functionAndTypeManager = server.getInstance(Key.get(FunctionAndTypeManager.class));
functionAndTypeManager.loadFunctionNamespaceManager("hive-functions", "hive", getNamespaceManagerCreationProperties());
server.refreshNodes();
return server;
}
use of com.facebook.presto.metadata.FunctionAndTypeManager in project presto by prestodb.
the class FunctionCallCodeGenerator method generateCall.
public BytecodeNode generateCall(FunctionHandle functionHandle, BytecodeGeneratorContext context, Type returnType, List<RowExpression> arguments, Optional<Variable> outputBlockVariable) {
FunctionAndTypeManager functionAndTypeManager = context.getFunctionManager();
ScalarFunctionImplementation function = functionAndTypeManager.getScalarFunctionImplementation(functionHandle);
checkArgument(function instanceof JavaScalarFunctionImplementation, format("FunctionCallCodeGenerator only handles JavaScalarFunctionImplementation, get %s", function.getClass().getName()));
JavaScalarFunctionImplementation javaFunction = (JavaScalarFunctionImplementation) function;
List<BytecodeNode> argumentsBytecode = new ArrayList<>();
ScalarFunctionImplementationChoice choice = getAllScalarFunctionImplementationChoices(javaFunction).get(0);
for (int i = 0; i < arguments.size(); i++) {
RowExpression argument = arguments.get(i);
ArgumentProperty argumentProperty = choice.getArgumentProperty(i);
if (argumentProperty.getArgumentType() == VALUE_TYPE) {
argumentsBytecode.add(context.generate(argument, Optional.empty()));
} else {
argumentsBytecode.add(context.generate(argument, Optional.empty(), Optional.of(argumentProperty.getLambdaInterface())));
}
}
return context.generateCall(functionAndTypeManager.getFunctionMetadata(functionHandle).getName().getObjectName(), javaFunction, argumentsBytecode, outputBlockVariable.map(variable -> new OutputBlockVariableAndType(variable, returnType)));
}
Aggregations