IndexMetadata.describe is not appending ; after "CREATE CUSTOM INDEX"
The method IndexMetadata.decribe can create two types of indexes:
-
CUSTOM INDEX -
INDEX
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.
Dear @ekaterinadimitrova2 , @hhughes , what is your view on this? Can we officially fix the describe method for custom indexes?