Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-16482

CQL schema generated by DESCRIBE KEYSPACE fails to import with custom indexes

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Normal
    • Resolution: Fixed
    • Fix Version/s: 4.0-rc1, 4.0
    • Component/s: CQL/Syntax
    • Labels:
      None

      Description

      The CQL schema generated by a DESCRIBE KEYSPACE on a keyspace with a table that contains a custom index cannot be reimported.

      The reimport of the schema fails with:

      InvalidRequest: Error from server: code=2200 [Invalid query] message="Cannot specify class_name as a CUSTOM option"
      

      The reason for this is that the custom index definition is created with class_name and target options added to it in it's WITH OPTIONS section. This is then picked up by the IndexAttributes.validate method that specifically rejects them.

      Note: This only seems to happen if the custom index was created with options in the first place. So if the CREATE CUSTOM INDEX statement didn't originally have a WITH OPTIONS section then it won't have the class_name and target options added to it.

      Steps to reproduce

      CREATE KEYSPACE test WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'};
      CREATE TABLE test.test (id int PRIMARY KEY, value text);
      CREATE CUSTOM INDEX ON test.test(value) USING 'org.apache.cassandra.index.sasi.SASIIndex' WITH OPTIONS = {'is_literal': 'false'};
      DESCRIBE KEYSPACE test;
      

      Trying to import the resultant schema will fail.

        Attachments

          Activity

            People

            • Assignee:
              blerer Benjamin Lerer
              Reporter:
              mike_tr_adamson Mike Adamson
              Authors:
              Benjamin Lerer
              Reviewers:
              Brandon Williams
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 10m
                10m