use of org.apache.cassandra.index.sasi.conf.IndexMode in project cassandra by apache.
the class SASIIndex method validateOptions.
public static Map<String, String> validateOptions(Map<String, String> options, TableMetadata metadata) {
if (!(metadata.partitioner instanceof Murmur3Partitioner))
throw new ConfigurationException("SASI only supports Murmur3Partitioner.");
String targetColumn = options.get("target");
if (targetColumn == null)
throw new ConfigurationException("unknown target column");
Pair<ColumnMetadata, IndexTarget.Type> target = TargetParser.parse(metadata, targetColumn);
if (target == null)
throw new ConfigurationException("failed to retrieve target column for: " + targetColumn);
if (target.left.isComplex())
throw new ConfigurationException("complex columns are not yet supported by SASI");
IndexMode.validateAnalyzer(options);
IndexMode mode = IndexMode.getMode(target.left, options);
if (mode.mode == Mode.SPARSE) {
if (mode.isLiteral)
throw new ConfigurationException("SPARSE mode is only supported on non-literal columns.");
if (mode.isAnalyzed)
throw new ConfigurationException("SPARSE mode doesn't support analyzers.");
}
return Collections.emptyMap();
}
Aggregations