Search in sources :

Example 1 with NullCallClause

use of com.facebook.presto.spi.function.RoutineCharacteristics.NullCallClause in project presto by prestodb.

the class AlterFunctionTask method execute.

@Override
public ListenableFuture<?> execute(AlterFunction statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, Session session, List<Expression> parameters, WarningCollector warningCollector) {
    Analyzer analyzer = new Analyzer(session, metadata, sqlParser, accessControl, Optional.empty(), parameters, warningCollector);
    analyzer.analyze(statement);
    QualifiedObjectName functionName = qualifyObjectName(statement.getFunctionName());
    AlterRoutineCharacteristics alterRoutineCharacteristics = new AlterRoutineCharacteristics(statement.getCharacteristics().getNullCallClause().map(com.facebook.presto.sql.tree.RoutineCharacteristics.NullCallClause::name).map(NullCallClause::valueOf));
    metadata.getFunctionAndTypeManager().alterFunction(functionName, statement.getParameterTypes().map(types -> types.stream().map(TypeSignature::parseTypeSignature).collect(toImmutableList())), alterRoutineCharacteristics);
    return immediateFuture(null);
}
Also used : WarningCollector(com.facebook.presto.spi.WarningCollector) Futures.immediateFuture(com.google.common.util.concurrent.Futures.immediateFuture) Analyzer(com.facebook.presto.sql.analyzer.Analyzer) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) Session(com.facebook.presto.Session) ImmutableList.toImmutableList(com.google.common.collect.ImmutableList.toImmutableList) NullCallClause(com.facebook.presto.spi.function.RoutineCharacteristics.NullCallClause) TypeSignature(com.facebook.presto.common.type.TypeSignature) SqlParser(com.facebook.presto.sql.parser.SqlParser) Inject(javax.inject.Inject) List(java.util.List) Expression(com.facebook.presto.sql.tree.Expression) AlterFunction(com.facebook.presto.sql.tree.AlterFunction) Objects.requireNonNull(java.util.Objects.requireNonNull) QualifiedObjectName(com.facebook.presto.common.QualifiedObjectName) Optional(java.util.Optional) AlterRoutineCharacteristics(com.facebook.presto.spi.function.AlterRoutineCharacteristics) TransactionManager(com.facebook.presto.transaction.TransactionManager) FunctionAndTypeManager.qualifyObjectName(com.facebook.presto.metadata.FunctionAndTypeManager.qualifyObjectName) Metadata(com.facebook.presto.metadata.Metadata) AccessControl(com.facebook.presto.security.AccessControl) AlterRoutineCharacteristics(com.facebook.presto.spi.function.AlterRoutineCharacteristics) NullCallClause(com.facebook.presto.spi.function.RoutineCharacteristics.NullCallClause) Analyzer(com.facebook.presto.sql.analyzer.Analyzer) QualifiedObjectName(com.facebook.presto.common.QualifiedObjectName)

Aggregations

Session (com.facebook.presto.Session)1 QualifiedObjectName (com.facebook.presto.common.QualifiedObjectName)1 TypeSignature (com.facebook.presto.common.type.TypeSignature)1 FunctionAndTypeManager.qualifyObjectName (com.facebook.presto.metadata.FunctionAndTypeManager.qualifyObjectName)1 Metadata (com.facebook.presto.metadata.Metadata)1 AccessControl (com.facebook.presto.security.AccessControl)1 WarningCollector (com.facebook.presto.spi.WarningCollector)1 AlterRoutineCharacteristics (com.facebook.presto.spi.function.AlterRoutineCharacteristics)1 NullCallClause (com.facebook.presto.spi.function.RoutineCharacteristics.NullCallClause)1 Analyzer (com.facebook.presto.sql.analyzer.Analyzer)1 SqlParser (com.facebook.presto.sql.parser.SqlParser)1 AlterFunction (com.facebook.presto.sql.tree.AlterFunction)1 Expression (com.facebook.presto.sql.tree.Expression)1 TransactionManager (com.facebook.presto.transaction.TransactionManager)1 ImmutableList.toImmutableList (com.google.common.collect.ImmutableList.toImmutableList)1 Futures.immediateFuture (com.google.common.util.concurrent.Futures.immediateFuture)1 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)1 List (java.util.List)1 Objects.requireNonNull (java.util.Objects.requireNonNull)1 Optional (java.util.Optional)1