[
https://issues.apache.org/jira/browse/CASSANDRA-17667?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17544812#comment-17544812
]
Attila Homoki edited comment on CASSANDRA-17667 at 6/1/22 11:03 AM:
--------------------------------------------------------------------
No worries [~bereng] :)
Yes, the culprit is the {{strip_comment_blocks}} function which been committed
to {{cqlsh.py}} in 2020 :
[https://github.com/apache/cassandra/commit/1b1b87cfe3a9a93c393d1f3c1e003394260edeb5]
and the function hasn't been changed since it was introduced.
This is the original JIRA: https://issues.apache.org/jira/browse/CASSANDRA-15802
This is the code part which causing the problem:
{code:java}
if '/*' in result:
result = re.sub('[/][*].*', "", result)
in_comment = True
if '*/' in result:
result = re.sub('.*[*][/]', "", result){code}
As a fix, I'm thinking about modifying the above part to prevent the
replacements of the "/{*}" or "{*}/" if these are found in single quote
enclosed string literals.
Any thoughts?
was (Author: JIRAUSER289805):
No worries [~bereng] :)
Yes, the culprit is the {{strip_comment_blocks}} function which been committed
to {{cqlsh.py}} in 2020 :
[https://github.com/apache/cassandra/commit/1b1b87cfe3a9a93c393d1f3c1e003394260edeb5]
and the function hasn't been changed since it was introduced.
This is the original JIRA: https://issues.apache.org/jira/browse/CASSANDRA-15802
This is the code part which causing the problem:
{code:java}
if '/*' in result:
result = re.sub('[/][*].*', "", result)
in_comment = True
if '*/' in result:
result = re.sub('.*[*][/]', "", result){code}
As a fix, I'm thinking about modifying the above part to prevent the
replacements of the "/*" or "*/" if these are found in single quote enclosed
string literals.
Any thoughts?
> Text value containing "/*" interpreted as multiline comment in cqlsh
> --------------------------------------------------------------------
>
> Key: CASSANDRA-17667
> URL: https://issues.apache.org/jira/browse/CASSANDRA-17667
> Project: Cassandra
> Issue Type: Bug
> Components: CQL/Interpreter
> Reporter: ANOOP THOMAS
> Assignee: Attila Homoki
> Priority: Normal
> Fix For: 4.0.x, 4.1-beta, 4.1.x
>
>
> I use CQLSH command line utility to load some DDLs. The version of utility I
> use is this:
> {noformat}
> [cqlsh 6.0.0 | Cassandra 4.0.0.47 | CQL spec 3.4.5 | Native protocol
> v5]{noformat}
> Command that loads DDL.cql:
> {noformat}
> cqlsh -u username -p password cassandra.example.com 65503 --ssl -f DDL.cql
> {noformat}
> I have a line in CQL script that breaks the syntax.
> {noformat}
> INSERT into tablename (key,columnname1,columnname2) VALUES
> ('keyName','value1','/value2/*/value3');{noformat}
> {{/*}} here is interpreted as start of multi-line comment. It used to work on
> older versions of cqlsh. The error I see looks like this:
> {noformat}
> SyntaxException: line 4:2 mismatched input 'Update' expecting ')'
> (...,'value1','/value2INSERT into tablename(INSERT into tablename
> (key,columnname1,columnname2)) VALUES ('[Update]-...) SyntaxException: line
> 1:0 no viable alternative at input '(' ([(]...)
> {noformat}
> Same behavior while running in interactive mode too. {{/*}} inside a CQL
> statement should not be interpreted as start of multi-line comment.
--
This message was sent by Atlassian Jira
(v8.20.7#820007)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]