use of io.crate.metadata.settings.session.SessionSetting in project crate by crate.
the class SetSessionPlan method executeOrFail.
@Override
public void executeOrFail(DependencyCarrier executor, PlannerContext plannerContext, RowConsumer consumer, Row params, SubQueryResults subQueryResults) throws Exception {
Function<? super Symbol, Object> eval = x -> SymbolEvaluator.evaluate(plannerContext.transactionContext(), plannerContext.nodeContext(), x, params, subQueryResults);
SessionContext sessionContext = plannerContext.transactionContext().sessionContext();
Assignment<Symbol> assignment = settings.get(0);
String settingName = eval.apply(assignment.columnName()).toString();
validateSetting(settingName);
SessionSetting<?> sessionSetting = sessionSettingRegistry.settings().get(settingName);
if (sessionSetting == null) {
LOGGER.info("SET SESSION STATEMENT WILL BE IGNORED: {}", settingName);
} else {
sessionSetting.apply(sessionContext, assignment.expressions(), eval);
}
consumer.accept(InMemoryBatchIterator.empty(SENTINEL), null);
}
Aggregations