[ 
https://issues.apache.org/jira/browse/CASSANDRA-17918?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17719367#comment-17719367
 ] 

Stefan Miklosovic commented on CASSANDRA-17918:
-----------------------------------------------

The problem with tests is that the patch introduces this result of aggregate 
description, for example it would describe an aggregate like this:
{code:java}
CREATE AGGREGATE cqlshtests_dligxmowmx.aggmax(int)
    SFUNC cqlshtests_dligxmowmx."fmax"
    STYPE int; {code}
This does not work because the the value of SFUNC is in form "keyspace.name" 
and it does not accept this. There can not be ".". It just expects name of the 
function.

[https://github.com/apache/cassandra/blob/trunk/src/antlr/Parser.g#L671]

[https://github.com/apache/cassandra/blob/trunk/src/antlr/Parser.g#L1567]

So the original author introduced something to CQL but parser was not modified.

I do not know how to fix this. I think we should just leave it out as it was 
and we should just quote the function name. If we are creating an aggregate on 
some keyspace, I do not think that SFUNC is going to ever be something else 
from a function in that keyspace. So the further distinction what keyspace that 
SFUNC is from does not make a lot of sense.

> 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: Stefan Miklosovic
>            Priority: Normal
>             Fix For: 4.0.x, 4.1.x
>
>
> 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}
> +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}}



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to