use of org.apache.ignite.internal.processors.query.stat.config.StatisticsColumnOverrides in project ignite by apache.
the class SqlAnalyzeCommand method buildConfig.
/**
* Build statistics object configuration from command arguments.
*
* @param target Statistics target.
* @param params Map of parameter to value strings.
* @return Statistics object configuration.
* @throws IgniteSQLException In case of unexpected parameter.
*/
public StatisticsObjectConfiguration buildConfig(StatisticsTarget target, Map<String, String> params) throws IgniteSQLException {
byte maxChangedRows = getByteOrDefault(params, MAX_CHANGED_PARTITION_ROWS_PERCENT, StatisticsObjectConfiguration.DEFAULT_OBSOLESCENCE_MAX_PERCENT);
StatisticsColumnOverrides overrides = overrides(params);
if (!F.isEmpty(params))
throw new IgniteSQLException("");
List<StatisticsColumnConfiguration> colCfgs = (target.columns() == null) ? Collections.emptyList() : Arrays.stream(target.columns()).map(col -> new StatisticsColumnConfiguration(col, overrides)).collect(Collectors.toList());
return new StatisticsObjectConfiguration(target.key(), colCfgs, maxChangedRows);
}
use of org.apache.ignite.internal.processors.query.stat.config.StatisticsColumnOverrides in project ignite by apache.
the class SqlAnalyzeCommand method overrides.
/**
* Try to cut overrides parameters from ANALYZE command params and return StatisticsColumnOverrides if at least one
* overriding parameter found.
*
* @param params ANALYZE params to cut overrides from.
* @return StatisticsColumnOverrides or {@code null} if there is no overriding parameters.
*/
private static StatisticsColumnOverrides overrides(Map<String, String> params) {
if (params == null)
return null;
Long total = null;
Long nulls = null;
Long distinct = null;
Integer size = null;
String val = params.remove(TOTAL);
if (val != null)
total = Long.parseLong(val);
val = params.remove(DISTINCT);
if (val != null)
distinct = Long.parseLong(val);
val = params.remove(NULLS);
if (val != null)
nulls = Long.parseLong(val);
val = params.remove(SIZE);
if (val != null)
size = Integer.parseInt(val);
if (size == null && nulls == null && total == null && distinct == null)
return null;
else
return new StatisticsColumnOverrides(nulls, distinct, total, size);
}
Aggregations