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

DESCRIBE output does not quote column names using reserved keywords

    XMLWordPrintableJSON

Details

    Description

      The DESCRIBE output of the column names that using reserved keywords are not quoted for UDTs. The following test reproduces. Reading the code, it looks like that the such columns names are not quoted in materialized view, UDF and user defined aggregation. 
      The impact of the bug is that schema described cannot be imported due to the usage of reserved keywords as column names. 
       

          @Test
          public void testUsingReservedInCreateType() throws Throwable
          {
              String type = createType(KEYSPACE_PER_TEST, "CREATE TYPE %s (\"token\" text, \"desc\" text);");               assertRowsNet(executeDescribeNet(KEYSPACE_PER_TEST, "DESCRIBE TYPE " + type),
                      row(KEYSPACE_PER_TEST, "type", type, "CREATE TYPE " + KEYSPACE_PER_TEST + "." + type + " (\n" +
                              "    \"token\" text,\n" +
                              "    \"desc\" text\n" +
                              ");"));
          } 

      Additional information for newcomers:

      • Unit tests for DESCRIBE statements are in DescribeStatementTest
      • The statement implementation is in DescribeStatement and fetch the create statement from the different schema element using  SchemaElement.toCqlString

      Attachments

        Issue Links

          Activity

            People

              smiklosovic Stefan Miklosovic
              yifanc Yifan Cai
              Stefan Miklosovic
              Benjamin Lerer, Yifan Cai
              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 - 50m
                  50m