IndexMetadata.describe is not appending ; after "CREATE CUSTOM INDEX" #1917
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The method IndexMetadata.decribe can create two types of indexes:
When the code produces a CQL statement for the first type (custom), there is no semicolon at the end of the statement. i.e. The method produces a CQL statement as
CREATE CUSTOM INDEX mykeyspace_mytable_idx ON mykeyspace.mytable (lucene)
USING 'com.stratio.cassandra.lucene.Index'
WITH OPTIONS = {
'refresh_seconds' : '1',
'schema' : '{
default_analyzer: "english",
fields: {
"template_code": {
type: "uuid"
},
"status": {
type : "string"
}
}
}'}
instead of
CREATE CUSTOM INDEX mykeyspace_mytable_idx ON mykeyspace.mytable (lucene)
USING 'com.stratio.cassandra.lucene.Index'
WITH OPTIONS = {
'refresh_seconds' : '1',
'schema' : '{
default_analyzer: "english",
fields: {
"template_code": {
type: "uuid"
},
"status": {
type : "string"
}
}
}'};
The second type (a non custom index) is NOT affected by this as it contains
builder … .append(String.format(" (%s);", getTarget()));
at the end of the “else” section. The first type ends with the builder.decreaseIndent().append("}"); We should add builder.append(“;”); statement either at the end of the if section or before return builder.build(); and remove the semicolon from .append(String.format(" (%s);", getTarget()));
All other Describable classes (AggregateMetadata, FunctionMetadata, KeyspaceMetadata, UserDefinedType, DseGraphTableMetadata, DefaultDseViewMetadata) are NOT suffering from this defect.