in modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java [1499:1694]
private static void processExtraParam(String name, String val, GridSqlCreateTable res) {
assert !F.isEmpty(name);
switch (name) {
case PARAM_TEMPLATE:
ensureNotEmpty(name, val);
res.templateName(val);
break;
case PARAM_BACKUPS:
ensureNotEmpty(name, val);
int backups = parseIntParam(PARAM_BACKUPS, val);
if (backups < 0) {
throw new IgniteSQLException("\"" + PARAM_BACKUPS + "\" cannot be negative: " + backups,
IgniteQueryErrorCode.PARSING);
}
res.backups(backups);
break;
case PARAM_PARALLELISM:
ensureNotEmpty(name, val);
int qryPar = parseIntParam(PARAM_PARALLELISM, val);
if (qryPar <= 0)
throw new IgniteSQLException("\"" + PARAM_PARALLELISM + "\" must be positive: " +
qryPar, IgniteQueryErrorCode.PARSING);
res.parallelism(qryPar);
break;
case PARAM_ATOMICITY:
ensureNotEmpty(name, val);
try {
res.atomicityMode(CacheAtomicityMode.valueOf(val.toUpperCase()));
}
catch (IllegalArgumentException e) {
String validVals = Arrays.stream(CacheAtomicityMode.values())
.map(Enum::name)
.collect(Collectors.joining(", "));
throw new IgniteSQLException("Invalid value of \"" + PARAM_ATOMICITY + "\" parameter " +
"(should be either " + validVals + "): " + val,
IgniteQueryErrorCode.PARSING, e);
}
break;
case PARAM_CACHE_NAME:
ensureNotEmpty(name, val);
res.cacheName(val);
break;
case PARAM_KEY_TYPE:
ensureNotEmpty(name, val);
res.keyTypeName(val);
break;
case PARAM_VAL_TYPE:
ensureNotEmpty(name, val);
res.valueTypeName(val);
break;
case PARAM_CACHE_GROUP_OLD:
case PARAM_CACHE_GROUP:
ensureNotEmpty(name, val);
res.cacheGroup(val);
break;
case PARAM_AFFINITY_KEY_OLD:
case PARAM_AFFINITY_KEY:
ensureNotEmpty(name, val);
String affColName = null;
// Either strip column name off its quotes, or uppercase it.
if (val.startsWith("'")) {
if (val.length() == 1 || !val.endsWith("'")) {
throw new IgniteSQLException("Affinity key column name does not have trailing quote: " + val,
IgniteQueryErrorCode.PARSING);
}
val = val.substring(1, val.length() - 1);
ensureNotEmpty(name, val);
affColName = val;
}
else {
for (String colName : res.columns().keySet()) {
if (val.equalsIgnoreCase(colName)) {
if (affColName != null) {
throw new IgniteSQLException("Ambiguous affinity column name, use single quotes " +
"for case sensitivity: " + val, IgniteQueryErrorCode.PARSING);
}
affColName = colName;
}
}
}
if (affColName == null || !res.columns().containsKey(affColName)) {
throw new IgniteSQLException("Affinity key column with given name not found: " + val,
IgniteQueryErrorCode.PARSING);
}
if (!res.primaryKeyColumns().contains(affColName)) {
throw new IgniteSQLException("Affinity key column must be one of key columns: " + affColName,
IgniteQueryErrorCode.PARSING);
}
res.affinityKey(affColName);
break;
case PARAM_WRITE_SYNC:
ensureNotEmpty(name, val);
CacheWriteSynchronizationMode writeSyncMode;
if (CacheWriteSynchronizationMode.FULL_ASYNC.name().equalsIgnoreCase(val))
writeSyncMode = CacheWriteSynchronizationMode.FULL_ASYNC;
else if (CacheWriteSynchronizationMode.FULL_SYNC.name().equalsIgnoreCase(val))
writeSyncMode = CacheWriteSynchronizationMode.FULL_SYNC;
else if (CacheWriteSynchronizationMode.PRIMARY_SYNC.name().equalsIgnoreCase(val))
writeSyncMode = CacheWriteSynchronizationMode.PRIMARY_SYNC;
else {
throw new IgniteSQLException("Invalid value of \"" + PARAM_WRITE_SYNC + "\" parameter " +
"(should be FULL_SYNC, FULL_ASYNC, or PRIMARY_SYNC): " + val, IgniteQueryErrorCode.PARSING);
}
res.writeSynchronizationMode(writeSyncMode);
break;
case PARAM_WRAP_KEY: {
res.wrapKey(F.isEmpty(val) || Boolean.parseBoolean(val));
break;
}
case PARAM_WRAP_VALUE:
res.wrapValue(F.isEmpty(val) || Boolean.parseBoolean(val));
break;
case PARAM_DATA_REGION:
ensureNotEmpty(name, val);
res.dataRegionName(val);
break;
case PARAM_ENCRYPTED:
res.encrypted(F.isEmpty(val) || Boolean.parseBoolean(val));
break;
case PARAM_PK_INLINE_SIZE:
ensureNotEmpty(name, val);
int pkInlineSize = parseIntParam(PARAM_PK_INLINE_SIZE, val);
res.primaryKeyInlineSize(pkInlineSize);
break;
case PARAM_AFFINITY_INDEX_INLINE_SIZE:
ensureNotEmpty(name, val);
int affInlineSize = parseIntParam(PARAM_AFFINITY_INDEX_INLINE_SIZE, val);
res.affinityKeyInlineSize(affInlineSize);
break;
default:
throw new IgniteSQLException("Unsupported parameter: " + name, IgniteQueryErrorCode.PARSING);
}
}