Java 类com.facebook.presto.metadata.FunctionFactory 实例源码
项目:presto-cuebiq-functions
文件:CuebiqPlugin.java
@Override
public <T> List<T> getServices(Class<T> type) {
if (type == FunctionFactory.class) {
return ImmutableList.of(type.cast(new UdfFactory(typeManager)));
}
return ImmutableList.of();
}
项目:hmmongo
文件:ViterbiPlugin.java
@Override
public <T> List<T> getServices(Class<T> type) {
if(type == FunctionFactory.class) {
try {
Map<String, String> properties = new ConfigurationLoader().loadPropertiesFrom("etc/plugin/viterbi.properties");
ViterbiConfig config = new ViterbiConfig(properties);
return ImmutableList.of(type.cast(new ViterbiFunctionFactory(typeManager, config)));
} catch (Exception e) {
e.printStackTrace();
}
}
return ImmutableList.of();
}
项目:presto
文件:MLPlugin.java
@Override
public <T> List<T> getServices(Class<T> type)
{
if (type == FunctionFactory.class) {
return ImmutableList.of(type.cast(new MLFunctionFactory(typeManager)));
}
else if (type == Type.class) {
return ImmutableList.of(type.cast(MODEL), type.cast(REGRESSOR));
}
else if (type == ParametricType.class) {
return ImmutableList.of(type.cast(new ClassifierParametricType()));
}
return ImmutableList.of();
}
项目:presto
文件:TestMLQueries.java
private static LocalQueryRunner createLocalQueryRunner()
{
Session defaultSession = testSessionBuilder()
.setCatalog("local")
.setSchema(TINY_SCHEMA_NAME)
.build();
LocalQueryRunner localQueryRunner = new LocalQueryRunner(defaultSession);
// add the tpch catalog
// local queries run directly against the generator
localQueryRunner.createCatalog(
defaultSession.getCatalog().get(),
new TpchConnectorFactory(localQueryRunner.getNodeManager(), 1),
ImmutableMap.<String, String>of());
MLPlugin plugin = new MLPlugin();
plugin.setTypeManager(localQueryRunner.getTypeManager());
for (Type type : plugin.getServices(Type.class)) {
localQueryRunner.getTypeManager().addType(type);
}
for (ParametricType parametricType : plugin.getServices(ParametricType.class)) {
localQueryRunner.getTypeManager().addParametricType(parametricType);
}
localQueryRunner.getMetadata().getFunctionRegistry().addFunctions(Iterables.getOnlyElement(plugin.getServices(FunctionFactory.class)).listFunctions());
return localQueryRunner;
}
项目:presto
文件:TeradataFunctionsPlugin.java
@Override
public <T> List<T> getServices(Class<T> type)
{
if (type == FunctionFactory.class) {
return ImmutableList.of(type.cast(new TeradataFunctionFactory(typeManager)));
}
return ImmutableList.of();
}