本文整理了Java中com.facebook.presto.metadata.Metadata.getFunctionRegistry()
方法的一些代码示例,展示了Metadata.getFunctionRegistry()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Metadata.getFunctionRegistry()
方法的具体详情如下:
包路径:com.facebook.presto.metadata.Metadata
类名称:Metadata
方法名:getFunctionRegistry
暂无
代码示例来源:origin: prestodb/presto
private LiteralVisitor(Metadata metadata)
{
this.metadata = metadata;
this.functionInvoker = new InterpretedFunctionInvoker(metadata.getFunctionRegistry());
}
代码示例来源:origin: prestodb/presto
@Inject
public JoinCompiler(Metadata metadata, FeaturesConfig config)
{
this.registry = requireNonNull(metadata, "metadata is null").getFunctionRegistry();
this.groupByUsesEqualTo = requireNonNull(config, "config is null").isGroupByUsesEqualTo();
}
代码示例来源:origin: prestodb/presto
@Inject
public DefaultFactory(OrderingCompiler orderingCompiler, JoinCompiler joinCompiler, FeaturesConfig featuresConfig, Metadata metadata)
{
this.orderingCompiler = requireNonNull(orderingCompiler, "orderingCompiler is null");
this.joinCompiler = requireNonNull(joinCompiler, "joinCompiler is null");
this.eagerCompact = requireNonNull(featuresConfig, "featuresConfig is null").isPagesIndexEagerCompactionEnabled();
this.functionRegistry = requireNonNull(metadata, "metadata is null").getFunctionRegistry();
this.groupByUsesEqualTo = featuresConfig.isGroupByUsesEqualTo();
}
代码示例来源:origin: prestodb/presto
private Optional<Signature> getSaturatedFloorCastOperator(Type fromType, Type toType)
{
if (metadata.getFunctionRegistry().canResolveOperator(SATURATED_FLOOR_CAST, toType, ImmutableList.of(fromType))) {
return Optional.of(internalOperator(SATURATED_FLOOR_CAST, toType, ImmutableList.of(fromType)));
}
return Optional.empty();
}
代码示例来源:origin: prestodb/presto
private Visitor(Metadata metadata, Session session, TypeProvider types)
{
this.metadata = requireNonNull(metadata, "metadata is null");
this.literalEncoder = new LiteralEncoder(metadata.getBlockEncodingSerde());
this.session = requireNonNull(session, "session is null");
this.types = requireNonNull(types, "types is null");
this.functionInvoker = new InterpretedFunctionInvoker(metadata.getFunctionRegistry());
}
代码示例来源:origin: prestodb/presto
public static ExpressionAnalyzer createConstantAnalyzer(Metadata metadata, Session session, List<Expression> parameters, WarningCollector warningCollector, boolean isDescribe)
{
return createWithoutSubqueries(
metadata.getFunctionRegistry(),
metadata.getTypeManager(),
session,
parameters,
EXPRESSION_NOT_CONSTANT,
"Constant expression cannot contain a subquery",
warningCollector,
isDescribe);
}
代码示例来源:origin: prestodb/presto
public static ExpressionAnalyzer createConstantAnalyzer(Metadata metadata, Session session, List<Expression> parameters, WarningCollector warningCollector)
{
return createWithoutSubqueries(
metadata.getFunctionRegistry(),
metadata.getTypeManager(),
session,
parameters,
EXPRESSION_NOT_CONSTANT,
"Constant expression cannot contain a subquery",
warningCollector,
false);
}
代码示例来源:origin: prestodb/presto
private boolean hasAggregates(QuerySpecification node)
{
ImmutableList.Builder<Node> toExtractBuilder = ImmutableList.builder();
toExtractBuilder.addAll(node.getSelect().getSelectItems().stream()
.filter(SingleColumn.class::isInstance)
.collect(toImmutableList()));
toExtractBuilder.addAll(getSortItemsFromOrderBy(node.getOrderBy()));
node.getHaving().ifPresent(toExtractBuilder::add);
List<FunctionCall> aggregates = extractAggregateFunctions(toExtractBuilder.build(), metadata.getFunctionRegistry());
return !aggregates.isEmpty();
}
代码示例来源:origin: prestodb/presto
private Signature getFunctionSignature(QualifiedName functionName, Symbol argument)
{
return metadata.getFunctionRegistry()
.resolveFunction(
functionName,
ImmutableList.of(new TypeSignatureProvider(symbolAllocator.getTypes().get(argument).getTypeSignature())));
}
代码示例来源:origin: prestodb/presto
private ColumnStatisticsAggregation createAggregation(QualifiedName functionName, SymbolReference input, Type inputType, Type outputType)
{
Signature signature = metadata.getFunctionRegistry().resolveFunction(functionName, TypeSignatureProvider.fromTypes(ImmutableList.of(inputType)));
Type resolvedType = metadata.getType(getOnlyElement(signature.getArgumentTypes()));
verify(resolvedType.equals(inputType), "resolved function input type does not match the input type: %s != %s", resolvedType, inputType);
return new ColumnStatisticsAggregation(
new AggregationNode.Aggregation(
new FunctionCall(functionName, ImmutableList.of(input)),
signature,
Optional.empty()),
outputType);
}
代码示例来源:origin: prestodb/presto
@Override
protected List<? extends OperatorFactory> createOperatorFactories()
{
OperatorFactory tableScanOperator = createTableScanOperator(0, new PlanNodeId("test"), "orders", "orderkey");
InternalAggregationFunction countFunction = localQueryRunner.getMetadata().getFunctionRegistry().getAggregateFunctionImplementation(
new Signature("count", AGGREGATE, BIGINT.getTypeSignature()));
AggregationOperatorFactory aggregationOperator = new AggregationOperatorFactory(1, new PlanNodeId("test"), Step.SINGLE, ImmutableList.of(countFunction.bind(ImmutableList.of(0), Optional.empty())), false);
return ImmutableList.of(tableScanOperator, aggregationOperator);
}
代码示例来源:origin: prestodb/presto
protected void registerScalarFunction(SqlScalarFunction sqlScalarFunction)
{
Metadata metadata = functionAssertions.getMetadata();
metadata.getFunctionRegistry().addFunctions(ImmutableList.of(sqlScalarFunction));
}
代码示例来源:origin: prestodb/presto
public HandTpchQuery6(LocalQueryRunner localQueryRunner)
{
super(localQueryRunner, "hand_tpch_query_6", 10, 100);
doubleSum = localQueryRunner.getMetadata().getFunctionRegistry().getAggregateFunctionImplementation(
new Signature("sum", AGGREGATE, DOUBLE.getTypeSignature(), DOUBLE.getTypeSignature()));
}
代码示例来源:origin: prestodb/presto
private RowExpression rowExpression(String expression, Type type)
{
SymbolToInputRewriter symbolToInputRewriter = new SymbolToInputRewriter(sourceLayout);
Expression inputReferenceExpression = symbolToInputRewriter.rewrite(createExpression(expression, METADATA, TypeProvider.copyOf(symbolTypes)));
ImmutableMap.Builder<Integer, Type> builder = ImmutableMap.builder();
for (int i = 0; i < columnCount; i++) {
builder.put(i, type);
}
Map<Integer, Type> types = builder.build();
Map<NodeRef<Expression>, Type> expressionTypes = getExpressionTypesFromInput(TEST_SESSION, METADATA, SQL_PARSER, types, inputReferenceExpression, emptyList(), WarningCollector.NOOP);
return SqlToRowExpressionTranslator.translate(inputReferenceExpression, SCALAR, expressionTypes, METADATA.getFunctionRegistry(), METADATA.getTypeManager(), TEST_SESSION, true);
}
代码示例来源:origin: prestodb/presto
private AggregationBuilder addAggregation(Symbol output, Expression expression, List<Type> inputTypes, Optional<Symbol> mask)
{
checkArgument(expression instanceof FunctionCall);
FunctionCall aggregation = (FunctionCall) expression;
Signature signature = metadata.getFunctionRegistry().resolveFunction(aggregation.getName(), TypeSignatureProvider.fromTypes(inputTypes));
return addAggregation(output, new Aggregation(aggregation, signature, mask));
}
代码示例来源:origin: prestodb/presto
protected void registerScalar(Class<?> clazz)
{
Metadata metadata = functionAssertions.getMetadata();
List<SqlFunction> functions = new FunctionListBuilder()
.scalars(clazz)
.getFunctions();
metadata.getFunctionRegistry().addFunctions(functions);
}
代码示例来源:origin: prestodb/presto
private String formatPlan(PlanNode plan, TypeProvider types)
{
StatsProvider statsProvider = new CachingStatsProvider(statsCalculator, session, types);
CostProvider costProvider = new CachingCostProvider(costCalculator, statsProvider, session, types);
return inTransaction(session -> textLogicalPlan(plan, types, metadata.getFunctionRegistry(), StatsAndCosts.create(plan, statsProvider, costProvider), session, 2, false));
}
代码示例来源:origin: prestodb/presto
protected void registerParametricScalar(Class<?> clazz)
{
Metadata metadata = functionAssertions.getMetadata();
List<SqlFunction> functions = new FunctionListBuilder()
.scalar(clazz)
.getFunctions();
metadata.getFunctionRegistry().addFunctions(functions);
}
代码示例来源:origin: prestodb/presto
@Test
public void doesNotFireOnPlanWithoutApplyNode()
{
tester().assertThat(new TransformCorrelatedScalarAggregationToJoin(tester().getMetadata().getFunctionRegistry()))
.on(p -> p.values(p.symbol("a")))
.doesNotFire();
}
代码示例来源:origin: prestodb/presto
@Test
public void doesNotFireOnCorrelatedWithoutAggregation()
{
tester().assertThat(new TransformCorrelatedScalarAggregationToJoin(tester().getMetadata().getFunctionRegistry()))
.on(p -> p.lateral(
ImmutableList.of(p.symbol("corr")),
p.values(p.symbol("corr")),
p.values(p.symbol("a"))))
.doesNotFire();
}
内容来源于网络,如有侵权,请联系作者删除!