Search in sources :

Example 1 with AnalyzedCreateRepository

use of io.crate.analyze.AnalyzedCreateRepository in project crate by crate.

the class CreateRepositoryPlan method createRequest.

@VisibleForTesting
public static PutRepositoryRequest createRequest(AnalyzedCreateRepository createRepository, CoordinatorTxnCtx txnCtx, NodeContext nodeCtx, Row parameters, SubQueryResults subQueryResults, RepositoryParamValidator repositoryParamValidator) {
    Function<? super Symbol, Object> eval = x -> SymbolEvaluator.evaluate(txnCtx, nodeCtx, x, parameters, subQueryResults);
    var genericProperties = createRepository.properties().map(eval);
    var settings = genericPropertiesToSettings(genericProperties, // supported settings for the repository type
    repositoryParamValidator.settingsForType(createRepository.type()).all());
    repositoryParamValidator.validate(createRepository.type(), createRepository.properties(), settings);
    PutRepositoryRequest request = new PutRepositoryRequest(createRepository.name());
    request.type(createRepository.type());
    request.settings(settings);
    return request;
}
Also used : NodeContext(io.crate.metadata.NodeContext) GenericPropertiesConverter.genericPropertiesToSettings(io.crate.analyze.GenericPropertiesConverter.genericPropertiesToSettings) RepositoryParamValidator(io.crate.analyze.repositories.RepositoryParamValidator) Function(java.util.function.Function) RowConsumer(io.crate.data.RowConsumer) DependencyCarrier(io.crate.planner.DependencyCarrier) PutRepositoryRequest(org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryRequest) SymbolEvaluator(io.crate.analyze.SymbolEvaluator) Row(io.crate.data.Row) AnalyzedCreateRepository(io.crate.analyze.AnalyzedCreateRepository) Symbol(io.crate.expression.symbol.Symbol) PlannerContext(io.crate.planner.PlannerContext) Plan(io.crate.planner.Plan) SubQueryResults(io.crate.planner.operators.SubQueryResults) VisibleForTesting(io.crate.common.annotations.VisibleForTesting) OneRowActionListener(io.crate.execution.support.OneRowActionListener) Row1(io.crate.data.Row1) CoordinatorTxnCtx(io.crate.metadata.CoordinatorTxnCtx) PutRepositoryRequest(org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryRequest) VisibleForTesting(io.crate.common.annotations.VisibleForTesting)

Aggregations

AnalyzedCreateRepository (io.crate.analyze.AnalyzedCreateRepository)1 GenericPropertiesConverter.genericPropertiesToSettings (io.crate.analyze.GenericPropertiesConverter.genericPropertiesToSettings)1 SymbolEvaluator (io.crate.analyze.SymbolEvaluator)1 RepositoryParamValidator (io.crate.analyze.repositories.RepositoryParamValidator)1 VisibleForTesting (io.crate.common.annotations.VisibleForTesting)1 Row (io.crate.data.Row)1 Row1 (io.crate.data.Row1)1 RowConsumer (io.crate.data.RowConsumer)1 OneRowActionListener (io.crate.execution.support.OneRowActionListener)1 Symbol (io.crate.expression.symbol.Symbol)1 CoordinatorTxnCtx (io.crate.metadata.CoordinatorTxnCtx)1 NodeContext (io.crate.metadata.NodeContext)1 DependencyCarrier (io.crate.planner.DependencyCarrier)1 Plan (io.crate.planner.Plan)1 PlannerContext (io.crate.planner.PlannerContext)1 SubQueryResults (io.crate.planner.operators.SubQueryResults)1 Function (java.util.function.Function)1 PutRepositoryRequest (org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryRequest)1