Search in sources :

Example 36 with VisibleForTesting

use of io.crate.common.annotations.VisibleForTesting in project crate by crate.

the class ResetSettingsPlan method buildSettingsFrom.

@VisibleForTesting
static Settings buildSettingsFrom(Set<Symbol> settings, Function<? super Symbol, Object> eval) {
    Settings.Builder settingsBuilder = Settings.builder();
    for (Symbol symbol : settings) {
        String settingsName = eval.apply(symbol).toString();
        List<String> settingNames = CrateSettings.settingNamesByPrefix(settingsName);
        if (settingNames.size() == 0) {
            throw new IllegalArgumentException(String.format(Locale.ENGLISH, "Setting '%s' is not supported", settingsName));
        }
        for (String name : settingNames) {
            CrateSettings.checkIfRuntimeSetting(name);
            if (CrateSettings.isValidSetting(name) == false) {
                throw new IllegalArgumentException("Setting '" + settingNames + "' is not supported");
            }
            settingsBuilder.put(name, (String) null);
        }
    }
    return settingsBuilder.build();
}
Also used : Symbol(io.crate.expression.symbol.Symbol) CrateSettings(io.crate.metadata.settings.CrateSettings) Settings(org.elasticsearch.common.settings.Settings) VisibleForTesting(io.crate.common.annotations.VisibleForTesting)

Aggregations

VisibleForTesting (io.crate.common.annotations.VisibleForTesting)36 Row (io.crate.data.Row)12 Symbol (io.crate.expression.symbol.Symbol)12 SubQueryResults (io.crate.planner.operators.SubQueryResults)11 Settings (org.elasticsearch.common.settings.Settings)11 RowConsumer (io.crate.data.RowConsumer)10 NodeContext (io.crate.metadata.NodeContext)10 DependencyCarrier (io.crate.planner.DependencyCarrier)10 Plan (io.crate.planner.Plan)10 PlannerContext (io.crate.planner.PlannerContext)10 Function (java.util.function.Function)10 SymbolEvaluator (io.crate.analyze.SymbolEvaluator)9 Row1 (io.crate.data.Row1)9 CoordinatorTxnCtx (io.crate.metadata.CoordinatorTxnCtx)9 ArrayList (java.util.ArrayList)8 OneRowActionListener (io.crate.execution.support.OneRowActionListener)7 Map (java.util.Map)7 ColumnIdent (io.crate.metadata.ColumnIdent)6 DocTableInfo (io.crate.metadata.doc.DocTableInfo)5 Nullable (javax.annotation.Nullable)5