com.facebook.presto.metadata.Metadata.addFunctions()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(191)

本文整理了Java中com.facebook.presto.metadata.Metadata.addFunctions()方法的一些代码示例,展示了Metadata.addFunctions()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Metadata.addFunctions()方法的具体详情如下:
包路径:com.facebook.presto.metadata.Metadata
类名称:Metadata
方法名:addFunctions

Metadata.addFunctions介绍

暂无

代码示例

代码示例来源:origin: prestodb/presto

public FunctionAssertions addFunctions(List<? extends SqlFunction> functionInfos)
{
  metadata.addFunctions(functionInfos);
  return this;
}

代码示例来源:origin: prestodb/presto

@BeforeClass
public void setUp()
{
  functionAssertions.getMetadata().addFunctions(ImmutableList.of(APPLY_FUNCTION, INVOKE_FUNCTION));
}

代码示例来源:origin: prestodb/presto

@BeforeClass
  protected void registerFunctions()
  {
    functionAssertions.getMetadata().addFunctions(
        extractFunctions(new MLPlugin().getFunctions()));
  }
}

代码示例来源:origin: prestodb/presto

protected void registerFunctions(Plugin plugin)
{
  functionAssertions.getMetadata().addFunctions(extractFunctions(plugin.getFunctions()));
}

代码示例来源:origin: prestodb/presto

public FunctionAssertions addScalarFunctions(Class<?> clazz)
{
  metadata.addFunctions(new FunctionListBuilder().scalars(clazz).getFunctions());
  return this;
}

代码示例来源:origin: prestodb/presto

@BeforeClass
protected void registerFunctions()
{
  GeoPlugin plugin = new GeoPlugin();
  for (Type type : plugin.getTypes()) {
    functionAssertions.getTypeRegistry().addType(type);
  }
  functionAssertions.getMetadata().addFunctions(extractFunctions(plugin.getFunctions()));
  functionAssertions.getMetadata().addFunctions(ImmutableList.of(APPLY_FUNCTION));
}

代码示例来源:origin: prestodb/presto

public StandaloneQueryRunner(Session defaultSession)
    throws Exception
{
  requireNonNull(defaultSession, "defaultSession is null");
  try {
    server = createTestingPrestoServer();
  }
  catch (Exception e) {
    close();
    throw e;
  }
  this.prestoClient = new TestingPrestoClient(server, defaultSession);
  refreshNodes();
  server.getMetadata().addFunctions(AbstractTestQueries.CUSTOM_FUNCTIONS);
  SessionPropertyManager sessionPropertyManager = server.getMetadata().getSessionPropertyManager();
  sessionPropertyManager.addSystemSessionProperties(TEST_SYSTEM_PROPERTIES);
  sessionPropertyManager.addConnectorSessionProperties(new ConnectorId("catalog"), TEST_CATALOG_PROPERTIES);
}

代码示例来源:origin: prestodb/presto

server.getMetadata().addFunctions(AbstractTestQueries.CUSTOM_FUNCTIONS);

代码示例来源:origin: prestodb/presto

@Test
public void testEvaluateClassifierPredictions()
{
  metadata.addFunctions(extractFunctions(new MLPlugin().getFunctions()));
  InternalAggregationFunction aggregation = metadata.getFunctionRegistry().getAggregateFunctionImplementation(
      new Signature("evaluate_classifier_predictions",
          AGGREGATE,
          parseTypeSignature(StandardTypes.VARCHAR), parseTypeSignature(StandardTypes.BIGINT), parseTypeSignature(StandardTypes.BIGINT)));
  Accumulator accumulator = aggregation.bind(ImmutableList.of(0, 1), Optional.empty()).createAccumulator();
  accumulator.addInput(getPage());
  BlockBuilder finalOut = accumulator.getFinalType().createBlockBuilder(null, 1);
  accumulator.evaluateFinal(finalOut);
  Block block = finalOut.build();
  String output = VARCHAR.getSlice(block, 0).toStringUtf8();
  List<String> parts = ImmutableList.copyOf(Splitter.on('\n').omitEmptyStrings().split(output));
  assertEquals(parts.size(), 7, output);
  assertEquals(parts.get(0), "Accuracy: 1/2 (50.00%)");
}

代码示例来源:origin: prestodb/presto

@BeforeClass
protected void registerFunctions()
{
  GeoPlugin plugin = new GeoPlugin();
  for (Type type : plugin.getTypes()) {
    functionAssertions.getTypeRegistry().addType(type);
  }
  functionAssertions.getMetadata().addFunctions(extractFunctions(plugin.getFunctions()));
}

代码示例来源:origin: prestodb/presto

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(1),
      ImmutableMap.of());
  localQueryRunner.getMetadata().addFunctions(CUSTOM_FUNCTIONS);
  SessionPropertyManager sessionPropertyManager = localQueryRunner.getMetadata().getSessionPropertyManager();
  sessionPropertyManager.addSystemSessionProperties(TEST_SYSTEM_PROPERTIES);
  sessionPropertyManager.addConnectorSessionProperties(new ConnectorId(TESTING_CATALOG), TEST_CATALOG_PROPERTIES);
  return localQueryRunner;
}

代码示例来源:origin: prestodb/presto

public static LocalQueryRunner createLocalQueryRunner()
{
  Session defaultSession = testSessionBuilder()
      .setCatalog("local")
      .setSchema(TINY_SCHEMA_NAME)
      .setSystemProperty(PUSH_PARTIAL_AGGREGATION_THROUGH_JOIN, "true")
      .build();
  LocalQueryRunner localQueryRunner = new LocalQueryRunner(defaultSession);
  // add the tpch catalog
  // local queries run directly against the generator
  localQueryRunner.createCatalog(
      defaultSession.getCatalog().get(),
      new TpchConnectorFactory(1),
      ImmutableMap.of());
  localQueryRunner.getMetadata().addFunctions(CUSTOM_FUNCTIONS);
  SessionPropertyManager sessionPropertyManager = localQueryRunner.getMetadata().getSessionPropertyManager();
  sessionPropertyManager.addSystemSessionProperties(TEST_SYSTEM_PROPERTIES);
  sessionPropertyManager.addConnectorSessionProperties(new ConnectorId(TESTING_CATALOG), TEST_CATALOG_PROPERTIES);
  return localQueryRunner;
}

代码示例来源:origin: prestodb/presto

@BeforeClass
public void registerFunctions()
{
  GeoPlugin plugin = new GeoPlugin();
  for (Type type : plugin.getTypes()) {
    functionAssertions.getTypeRegistry().addType(type);
  }
  functionAssertions.getMetadata().addFunctions(extractFunctions(plugin.getFunctions()));
  function = functionAssertions
      .getMetadata()
      .getFunctionRegistry()
      .getAggregateFunctionImplementation(new Signature(
          getFunctionName(),
          FunctionKind.AGGREGATE,
          parseTypeSignature(GeometryType.GEOMETRY_TYPE_NAME),
          parseTypeSignature(GeometryType.GEOMETRY_TYPE_NAME)));
}

代码示例来源:origin: prestodb/presto

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(1),
        ImmutableMap.of());

    MLPlugin plugin = new MLPlugin();
    for (Type type : plugin.getTypes()) {
      localQueryRunner.getTypeManager().addType(type);
    }
    for (ParametricType parametricType : plugin.getParametricTypes()) {
      localQueryRunner.getTypeManager().addParametricType(parametricType);
    }
    localQueryRunner.getMetadata().addFunctions(extractFunctions(new MLPlugin().getFunctions()));

    return localQueryRunner;
  }
}

代码示例来源:origin: prestodb/presto

metadata.addFunctions(extractFunctions(functionClass));

代码示例来源:origin: uk.co.nichesolutions.presto/presto-main

public FunctionAssertions addFunctions(List<SqlFunction> functionInfos)
{
  metadata.addFunctions(functionInfos);
  return this;
}

代码示例来源:origin: com.facebook.presto/presto-geospatial

@BeforeClass
protected void registerFunctions()
{
  GeoPlugin plugin = new GeoPlugin();
  for (Type type : plugin.getTypes()) {
    functionAssertions.getTypeRegistry().addType(type);
  }
  functionAssertions.getMetadata().addFunctions(extractFunctions(plugin.getFunctions()));
  functionAssertions.getMetadata().addFunctions(ImmutableList.of(APPLY_FUNCTION));
}

代码示例来源:origin: com.facebook.presto/presto-tests

public StandaloneQueryRunner(Session defaultSession)
    throws Exception
{
  requireNonNull(defaultSession, "defaultSession is null");
  try {
    server = createTestingPrestoServer();
  }
  catch (Exception e) {
    close();
    throw e;
  }
  this.prestoClient = new TestingPrestoClient(server, defaultSession);
  refreshNodes();
  server.getMetadata().addFunctions(AbstractTestQueries.CUSTOM_FUNCTIONS);
  SessionPropertyManager sessionPropertyManager = server.getMetadata().getSessionPropertyManager();
  sessionPropertyManager.addSystemSessionProperties(TEST_SYSTEM_PROPERTIES);
  sessionPropertyManager.addConnectorSessionProperties(new ConnectorId("catalog"), TEST_CATALOG_PROPERTIES);
}

代码示例来源:origin: uk.co.nichesolutions.presto/presto-main

public FunctionAssertions addScalarFunctions(Class<?> clazz)
{
  metadata.addFunctions(new FunctionListBuilder(metadata.getTypeManager()).scalar(clazz).getFunctions());
  return this;
}

代码示例来源:origin: com.facebook.presto/presto-geospatial

@BeforeClass
public void registerFunctions()
{
  GeoPlugin plugin = new GeoPlugin();
  for (Type type : plugin.getTypes()) {
    functionAssertions.getTypeRegistry().addType(type);
  }
  functionAssertions.getMetadata().addFunctions(extractFunctions(plugin.getFunctions()));
  function = functionAssertions
      .getMetadata()
      .getFunctionRegistry()
      .getAggregateFunctionImplementation(new Signature(
          getFunctionName(),
          FunctionKind.AGGREGATE,
          parseTypeSignature(GeometryType.GEOMETRY_TYPE_NAME),
          parseTypeSignature(GeometryType.GEOMETRY_TYPE_NAME)));
}

相关文章