You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Benjamin Lerer (Jira)" <ji...@apache.org> on 2022/10/03 08:08:00 UTC

[jira] [Updated] (CASSANDRA-17918) DESCRIBE output does not quote column names using reserved keywords

     [ https://issues.apache.org/jira/browse/CASSANDRA-17918?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benjamin Lerer updated CASSANDRA-17918:
---------------------------------------
    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. 
 
{code:java}
    @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" +
                        ");"));
    } {code}

  was:
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. 
 
{code:java}
    @Test
    public void testUsingReservedInCreateType() throws Throwable
    {
        String input = String.format("CREATE TYPE %s.test_type (\"token\" text, \"desc\" text);", KEYSPACE);
        schemaChange(input);

        UntypedResultSet rs = execute(String.format("DESC TYPE %s.test_type", KEYSPACE));
        UntypedResultSet.Row row = rs.one();
        String describedCreateStatement = row.getString("create_statement");

        Assert.assertEquals("CREATE TYPE cql_test_keyspace.test_type (\n" +
                            "    token text,\n" +
                            "    desc text\n" +
                            ");",
                            describedCreateStatement);
    } {code}


> DESCRIBE output does not quote column names using reserved keywords
> -------------------------------------------------------------------
>
>                 Key: CASSANDRA-17918
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-17918
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Legacy/CQL
>            Reporter: Yifan Cai
>            Assignee: Bernardo Botella Corbi
>            Priority: Normal
>
> 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. 
>  
> {code:java}
>     @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" +
>                         ");"));
>     } {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org