use of io.crate.sql.tree.CreateBlobTable in project crate by crate.
the class CreateBlobTablePlan method buildSettings.
@VisibleForTesting
public static Settings buildSettings(CreateBlobTable<Symbol> createBlobTable, CoordinatorTxnCtx txnCtx, NodeContext nodeCtx, Row params, SubQueryResults subQueryResults, NumberOfShards numberOfShards) {
Function<? super Symbol, Object> eval = x -> SymbolEvaluator.evaluate(txnCtx, nodeCtx, x, params, subQueryResults);
CreateBlobTable<Object> blobTable = createBlobTable.map(eval);
GenericProperties<Object> properties = blobTable.genericProperties();
// apply default in case it is not specified in the properties,
// if it is it will get overwritten afterwards.
TableParameter tableParameter = new TableParameter();
TablePropertiesAnalyzer.analyzeWithBoundValues(tableParameter, TableParameters.CREATE_BLOB_TABLE_PARAMETERS, properties, true);
Settings.Builder builder = Settings.builder();
builder.put(tableParameter.settings());
builder.put(SETTING_INDEX_BLOBS_ENABLED.getKey(), true);
int numShards;
ClusteredBy<Object> clusteredBy = blobTable.clusteredBy();
if (clusteredBy != null) {
numShards = numberOfShards.fromClusteredByClause(clusteredBy);
} else {
numShards = numberOfShards.defaultNumberOfShards();
}
builder.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, numShards);
return builder.build();
}
Aggregations