[jira] [Updated] (CASSANDRA-17919) Capital P gets confused in the parser for a Duration in places where IDENT are needed
[ https://issues.apache.org/jira/browse/CASSANDRA-17919?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Stefan Miklosovic updated CASSANDRA-17919: -- Fix Version/s: 3.11.15 4.0.10 4.1.2 5.0 (was: 3.11.x) (was: 5.x) (was: 4.0.x) (was: 4.1.x) Source Control Link: https://github.com/apache/cassandra/commit/0f3a990dd2bc9532752a711a49a131c63d52e3c7 Resolution: Fixed Status: Resolved (was: Ready to Commit) > Capital P gets confused in the parser for a Duration in places where IDENT > are needed > - > > Key: CASSANDRA-17919 > URL: https://issues.apache.org/jira/browse/CASSANDRA-17919 > Project: Cassandra > Issue Type: Bug > Components: CQL/Syntax >Reporter: David Capwell >Assignee: Maxim Chanturiay >Priority: Normal > Fix For: 3.11.15, 4.0.10, 4.1.2, 5.0 > > Time Spent: 1h > Remaining Estimate: 0h > > This was found while adding Accord Transaction syntax into CQL and fuzz > testing to validate all possible cases… in doing this the following was found > {code} > String query = "BEGIN TRANSACTION\n" + >" LET P = (SELECT v FROM " + keyspace + ".tbl > WHERE k=? AND c=?);\n" + >" LET row2 = (SELECT v FROM " + keyspace + ".tbl > WHERE k=? AND c=?);\n" + >" SELECT v FROM " + keyspace + ".tbl WHERE k=? > AND c=?;\n" + >" IF P IS NULL AND row2.v = ? THEN\n" + >"INSERT INTO " + keyspace + ".tbl (k, c, v) > VALUES (?, ?, ?);\n" + >" END IF\n" + >"COMMIT TRANSACTION"; > {code} > Fails with > {code} > SyntaxException: line 2:6 mismatched input 'P' expecting IDENT (BEGIN > TRANSACTION LET [P]...) > {code} > The new LET syntax found this, but was able to reproduce in other cases > {code} > cqlsh:ks> CREATE TABLE P (k INT PRIMARY KEY); > SyntaxException: line 1:13 no viable alternative at input 'P' (CREATE TABLE > [P]...) > cqlsh:ks> > cqlsh:ks> CREATE TABLE p (k INT PRIMARY KEY); > cqlsh:ks> > {code} -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[jira] [Updated] (CASSANDRA-17919) Capital P gets confused in the parser for a Duration in places where IDENT are needed
[ https://issues.apache.org/jira/browse/CASSANDRA-17919?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Stefan Miklosovic updated CASSANDRA-17919: -- Status: Ready to Commit (was: Testing) > Capital P gets confused in the parser for a Duration in places where IDENT > are needed > - > > Key: CASSANDRA-17919 > URL: https://issues.apache.org/jira/browse/CASSANDRA-17919 > Project: Cassandra > Issue Type: Bug > Components: CQL/Syntax >Reporter: David Capwell >Assignee: Maxim Chanturiay >Priority: Normal > Fix For: 3.11.x, 4.0.x, 4.1.x, 5.x > > Time Spent: 1h > Remaining Estimate: 0h > > This was found while adding Accord Transaction syntax into CQL and fuzz > testing to validate all possible cases… in doing this the following was found > {code} > String query = "BEGIN TRANSACTION\n" + >" LET P = (SELECT v FROM " + keyspace + ".tbl > WHERE k=? AND c=?);\n" + >" LET row2 = (SELECT v FROM " + keyspace + ".tbl > WHERE k=? AND c=?);\n" + >" SELECT v FROM " + keyspace + ".tbl WHERE k=? > AND c=?;\n" + >" IF P IS NULL AND row2.v = ? THEN\n" + >"INSERT INTO " + keyspace + ".tbl (k, c, v) > VALUES (?, ?, ?);\n" + >" END IF\n" + >"COMMIT TRANSACTION"; > {code} > Fails with > {code} > SyntaxException: line 2:6 mismatched input 'P' expecting IDENT (BEGIN > TRANSACTION LET [P]...) > {code} > The new LET syntax found this, but was able to reproduce in other cases > {code} > cqlsh:ks> CREATE TABLE P (k INT PRIMARY KEY); > SyntaxException: line 1:13 no viable alternative at input 'P' (CREATE TABLE > [P]...) > cqlsh:ks> > cqlsh:ks> CREATE TABLE p (k INT PRIMARY KEY); > cqlsh:ks> > {code} -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[jira] [Updated] (CASSANDRA-17919) Capital P gets confused in the parser for a Duration in places where IDENT are needed
[ https://issues.apache.org/jira/browse/CASSANDRA-17919?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Stefan Miklosovic updated CASSANDRA-17919: -- Tester: Stefan Miklosovic Status: Testing (was: Requires Testing) > Capital P gets confused in the parser for a Duration in places where IDENT > are needed > - > > Key: CASSANDRA-17919 > URL: https://issues.apache.org/jira/browse/CASSANDRA-17919 > Project: Cassandra > Issue Type: Bug > Components: CQL/Syntax >Reporter: David Capwell >Assignee: Maxim Chanturiay >Priority: Normal > Fix For: 3.11.x, 4.0.x, 4.1.x, 5.x > > Time Spent: 1h > Remaining Estimate: 0h > > This was found while adding Accord Transaction syntax into CQL and fuzz > testing to validate all possible cases… in doing this the following was found > {code} > String query = "BEGIN TRANSACTION\n" + >" LET P = (SELECT v FROM " + keyspace + ".tbl > WHERE k=? AND c=?);\n" + >" LET row2 = (SELECT v FROM " + keyspace + ".tbl > WHERE k=? AND c=?);\n" + >" SELECT v FROM " + keyspace + ".tbl WHERE k=? > AND c=?;\n" + >" IF P IS NULL AND row2.v = ? THEN\n" + >"INSERT INTO " + keyspace + ".tbl (k, c, v) > VALUES (?, ?, ?);\n" + >" END IF\n" + >"COMMIT TRANSACTION"; > {code} > Fails with > {code} > SyntaxException: line 2:6 mismatched input 'P' expecting IDENT (BEGIN > TRANSACTION LET [P]...) > {code} > The new LET syntax found this, but was able to reproduce in other cases > {code} > cqlsh:ks> CREATE TABLE P (k INT PRIMARY KEY); > SyntaxException: line 1:13 no viable alternative at input 'P' (CREATE TABLE > [P]...) > cqlsh:ks> > cqlsh:ks> CREATE TABLE p (k INT PRIMARY KEY); > cqlsh:ks> > {code} -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[jira] [Updated] (CASSANDRA-17919) Capital P gets confused in the parser for a Duration in places where IDENT are needed
[ https://issues.apache.org/jira/browse/CASSANDRA-17919?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Benjamin Lerer updated CASSANDRA-17919: --- Status: Review In Progress (was: Needs Committer) > Capital P gets confused in the parser for a Duration in places where IDENT > are needed > - > > Key: CASSANDRA-17919 > URL: https://issues.apache.org/jira/browse/CASSANDRA-17919 > Project: Cassandra > Issue Type: Bug > Components: CQL/Syntax >Reporter: David Capwell >Assignee: Maxim Chanturiay >Priority: Normal > Fix For: 3.11.x, 4.0.x, 4.1.x, 5.x > > Time Spent: 1h > Remaining Estimate: 0h > > This was found while adding Accord Transaction syntax into CQL and fuzz > testing to validate all possible cases… in doing this the following was found > {code} > String query = "BEGIN TRANSACTION\n" + >" LET P = (SELECT v FROM " + keyspace + ".tbl > WHERE k=? AND c=?);\n" + >" LET row2 = (SELECT v FROM " + keyspace + ".tbl > WHERE k=? AND c=?);\n" + >" SELECT v FROM " + keyspace + ".tbl WHERE k=? > AND c=?;\n" + >" IF P IS NULL AND row2.v = ? THEN\n" + >"INSERT INTO " + keyspace + ".tbl (k, c, v) > VALUES (?, ?, ?);\n" + >" END IF\n" + >"COMMIT TRANSACTION"; > {code} > Fails with > {code} > SyntaxException: line 2:6 mismatched input 'P' expecting IDENT (BEGIN > TRANSACTION LET [P]...) > {code} > The new LET syntax found this, but was able to reproduce in other cases > {code} > cqlsh:ks> CREATE TABLE P (k INT PRIMARY KEY); > SyntaxException: line 1:13 no viable alternative at input 'P' (CREATE TABLE > [P]...) > cqlsh:ks> > cqlsh:ks> CREATE TABLE p (k INT PRIMARY KEY); > cqlsh:ks> > {code} -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[jira] [Updated] (CASSANDRA-17919) Capital P gets confused in the parser for a Duration in places where IDENT are needed
[ https://issues.apache.org/jira/browse/CASSANDRA-17919?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Benjamin Lerer updated CASSANDRA-17919: --- Reviewers: Benjamin Lerer, Stefan Miklosovic (was: Stefan Miklosovic) > Capital P gets confused in the parser for a Duration in places where IDENT > are needed > - > > Key: CASSANDRA-17919 > URL: https://issues.apache.org/jira/browse/CASSANDRA-17919 > Project: Cassandra > Issue Type: Bug > Components: CQL/Syntax >Reporter: David Capwell >Assignee: Maxim Chanturiay >Priority: Normal > Fix For: 3.11.x, 4.0.x, 4.1.x, 5.x > > Time Spent: 1h > Remaining Estimate: 0h > > This was found while adding Accord Transaction syntax into CQL and fuzz > testing to validate all possible cases… in doing this the following was found > {code} > String query = "BEGIN TRANSACTION\n" + >" LET P = (SELECT v FROM " + keyspace + ".tbl > WHERE k=? AND c=?);\n" + >" LET row2 = (SELECT v FROM " + keyspace + ".tbl > WHERE k=? AND c=?);\n" + >" SELECT v FROM " + keyspace + ".tbl WHERE k=? > AND c=?;\n" + >" IF P IS NULL AND row2.v = ? THEN\n" + >"INSERT INTO " + keyspace + ".tbl (k, c, v) > VALUES (?, ?, ?);\n" + >" END IF\n" + >"COMMIT TRANSACTION"; > {code} > Fails with > {code} > SyntaxException: line 2:6 mismatched input 'P' expecting IDENT (BEGIN > TRANSACTION LET [P]...) > {code} > The new LET syntax found this, but was able to reproduce in other cases > {code} > cqlsh:ks> CREATE TABLE P (k INT PRIMARY KEY); > SyntaxException: line 1:13 no viable alternative at input 'P' (CREATE TABLE > [P]...) > cqlsh:ks> > cqlsh:ks> CREATE TABLE p (k INT PRIMARY KEY); > cqlsh:ks> > {code} -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[jira] [Updated] (CASSANDRA-17919) Capital P gets confused in the parser for a Duration in places where IDENT are needed
[ https://issues.apache.org/jira/browse/CASSANDRA-17919?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Benjamin Lerer updated CASSANDRA-17919: --- Status: Requires Testing (was: Review In Progress) > Capital P gets confused in the parser for a Duration in places where IDENT > are needed > - > > Key: CASSANDRA-17919 > URL: https://issues.apache.org/jira/browse/CASSANDRA-17919 > Project: Cassandra > Issue Type: Bug > Components: CQL/Syntax >Reporter: David Capwell >Assignee: Maxim Chanturiay >Priority: Normal > Fix For: 3.11.x, 4.0.x, 4.1.x, 5.x > > Time Spent: 1h > Remaining Estimate: 0h > > This was found while adding Accord Transaction syntax into CQL and fuzz > testing to validate all possible cases… in doing this the following was found > {code} > String query = "BEGIN TRANSACTION\n" + >" LET P = (SELECT v FROM " + keyspace + ".tbl > WHERE k=? AND c=?);\n" + >" LET row2 = (SELECT v FROM " + keyspace + ".tbl > WHERE k=? AND c=?);\n" + >" SELECT v FROM " + keyspace + ".tbl WHERE k=? > AND c=?;\n" + >" IF P IS NULL AND row2.v = ? THEN\n" + >"INSERT INTO " + keyspace + ".tbl (k, c, v) > VALUES (?, ?, ?);\n" + >" END IF\n" + >"COMMIT TRANSACTION"; > {code} > Fails with > {code} > SyntaxException: line 2:6 mismatched input 'P' expecting IDENT (BEGIN > TRANSACTION LET [P]...) > {code} > The new LET syntax found this, but was able to reproduce in other cases > {code} > cqlsh:ks> CREATE TABLE P (k INT PRIMARY KEY); > SyntaxException: line 1:13 no viable alternative at input 'P' (CREATE TABLE > [P]...) > cqlsh:ks> > cqlsh:ks> CREATE TABLE p (k INT PRIMARY KEY); > cqlsh:ks> > {code} -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[jira] [Updated] (CASSANDRA-17919) Capital P gets confused in the parser for a Duration in places where IDENT are needed
[ https://issues.apache.org/jira/browse/CASSANDRA-17919?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Stefan Miklosovic updated CASSANDRA-17919: -- Status: Needs Committer (was: Review In Progress) > Capital P gets confused in the parser for a Duration in places where IDENT > are needed > - > > Key: CASSANDRA-17919 > URL: https://issues.apache.org/jira/browse/CASSANDRA-17919 > Project: Cassandra > Issue Type: Bug > Components: CQL/Syntax >Reporter: David Capwell >Assignee: Maxim Chanturiay >Priority: Normal > Fix For: 3.11.x, 4.0.x, 4.1.x, 5.x > > Time Spent: 1h > Remaining Estimate: 0h > > This was found while adding Accord Transaction syntax into CQL and fuzz > testing to validate all possible cases… in doing this the following was found > {code} > String query = "BEGIN TRANSACTION\n" + >" LET P = (SELECT v FROM " + keyspace + ".tbl > WHERE k=? AND c=?);\n" + >" LET row2 = (SELECT v FROM " + keyspace + ".tbl > WHERE k=? AND c=?);\n" + >" SELECT v FROM " + keyspace + ".tbl WHERE k=? > AND c=?;\n" + >" IF P IS NULL AND row2.v = ? THEN\n" + >"INSERT INTO " + keyspace + ".tbl (k, c, v) > VALUES (?, ?, ?);\n" + >" END IF\n" + >"COMMIT TRANSACTION"; > {code} > Fails with > {code} > SyntaxException: line 2:6 mismatched input 'P' expecting IDENT (BEGIN > TRANSACTION LET [P]...) > {code} > The new LET syntax found this, but was able to reproduce in other cases > {code} > cqlsh:ks> CREATE TABLE P (k INT PRIMARY KEY); > SyntaxException: line 1:13 no viable alternative at input 'P' (CREATE TABLE > [P]...) > cqlsh:ks> > cqlsh:ks> CREATE TABLE p (k INT PRIMARY KEY); > cqlsh:ks> > {code} -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[jira] [Updated] (CASSANDRA-17919) Capital P gets confused in the parser for a Duration in places where IDENT are needed
[ https://issues.apache.org/jira/browse/CASSANDRA-17919?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Stefan Miklosovic updated CASSANDRA-17919: -- Reviewers: Stefan Miklosovic, Stefan Miklosovic Stefan Miklosovic, Stefan Miklosovic (was: Stefan Miklosovic) Status: Review In Progress (was: Patch Available) > Capital P gets confused in the parser for a Duration in places where IDENT > are needed > - > > Key: CASSANDRA-17919 > URL: https://issues.apache.org/jira/browse/CASSANDRA-17919 > Project: Cassandra > Issue Type: Bug > Components: CQL/Syntax >Reporter: David Capwell >Assignee: Maxim Chanturiay >Priority: Normal > Fix For: 3.11.x, 4.0.x, 4.1.x > > Time Spent: 1h > Remaining Estimate: 0h > > This was found while adding Accord Transaction syntax into CQL and fuzz > testing to validate all possible cases… in doing this the following was found > {code} > String query = "BEGIN TRANSACTION\n" + >" LET P = (SELECT v FROM " + keyspace + ".tbl > WHERE k=? AND c=?);\n" + >" LET row2 = (SELECT v FROM " + keyspace + ".tbl > WHERE k=? AND c=?);\n" + >" SELECT v FROM " + keyspace + ".tbl WHERE k=? > AND c=?;\n" + >" IF P IS NULL AND row2.v = ? THEN\n" + >"INSERT INTO " + keyspace + ".tbl (k, c, v) > VALUES (?, ?, ?);\n" + >" END IF\n" + >"COMMIT TRANSACTION"; > {code} > Fails with > {code} > SyntaxException: line 2:6 mismatched input 'P' expecting IDENT (BEGIN > TRANSACTION LET [P]...) > {code} > The new LET syntax found this, but was able to reproduce in other cases > {code} > cqlsh:ks> CREATE TABLE P (k INT PRIMARY KEY); > SyntaxException: line 1:13 no viable alternative at input 'P' (CREATE TABLE > [P]...) > cqlsh:ks> > cqlsh:ks> CREATE TABLE p (k INT PRIMARY KEY); > cqlsh:ks> > {code} -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[jira] [Updated] (CASSANDRA-17919) Capital P gets confused in the parser for a Duration in places where IDENT are needed
[ https://issues.apache.org/jira/browse/CASSANDRA-17919?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Stefan Miklosovic updated CASSANDRA-17919: -- Fix Version/s: 5.x > Capital P gets confused in the parser for a Duration in places where IDENT > are needed > - > > Key: CASSANDRA-17919 > URL: https://issues.apache.org/jira/browse/CASSANDRA-17919 > Project: Cassandra > Issue Type: Bug > Components: CQL/Syntax >Reporter: David Capwell >Assignee: Maxim Chanturiay >Priority: Normal > Fix For: 3.11.x, 4.0.x, 4.1.x, 5.x > > Time Spent: 1h > Remaining Estimate: 0h > > This was found while adding Accord Transaction syntax into CQL and fuzz > testing to validate all possible cases… in doing this the following was found > {code} > String query = "BEGIN TRANSACTION\n" + >" LET P = (SELECT v FROM " + keyspace + ".tbl > WHERE k=? AND c=?);\n" + >" LET row2 = (SELECT v FROM " + keyspace + ".tbl > WHERE k=? AND c=?);\n" + >" SELECT v FROM " + keyspace + ".tbl WHERE k=? > AND c=?;\n" + >" IF P IS NULL AND row2.v = ? THEN\n" + >"INSERT INTO " + keyspace + ".tbl (k, c, v) > VALUES (?, ?, ?);\n" + >" END IF\n" + >"COMMIT TRANSACTION"; > {code} > Fails with > {code} > SyntaxException: line 2:6 mismatched input 'P' expecting IDENT (BEGIN > TRANSACTION LET [P]...) > {code} > The new LET syntax found this, but was able to reproduce in other cases > {code} > cqlsh:ks> CREATE TABLE P (k INT PRIMARY KEY); > SyntaxException: line 1:13 no viable alternative at input 'P' (CREATE TABLE > [P]...) > cqlsh:ks> > cqlsh:ks> CREATE TABLE p (k INT PRIMARY KEY); > cqlsh:ks> > {code} -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[jira] [Updated] (CASSANDRA-17919) Capital P gets confused in the parser for a Duration in places where IDENT are needed
[ https://issues.apache.org/jira/browse/CASSANDRA-17919?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Maxim Chanturiay updated CASSANDRA-17919: - Test and Documentation Plan: *Pull requests* * cassandra-3.11 - [https://github.com/apache/cassandra/pull/1977] * cassandra-4.0 - [https://github.com/apache/cassandra/pull/1975] * cassandra-4.1 - [https://github.com/apache/cassandra/pull/1976] * trunk - [https://github.com/apache/cassandra/pull/2283] *Source code changes* There was a change in the Lexer.g. Capital letter "P" is no longer a valid representation for 0 duration. It has to comply with [https://en.wikipedia.org/wiki/ISO_8601#Durations] (see Benjamin Lerer's comment). A couple of examples for valid 0 duration representation are: {code:java} PT0S P0D PT0H P0W P0Y0M0DT0H0M0S {code} *Unit tests changes* The following tests have been expanded with new logic to cover the ticket's changes: * org.apache.cassandra.cql3.validation.operations.CreateTest * org.apache.cassandra.cql3.validation.operations.DropTest * org.apache.cassandra.cql3.validation.operations.InsertTest *Manual test case flow* Let's go through the case where we create a "P" keyspace, use it, create a "P" table and insert 0 duration twice with the correct format (the updated), select all rows, try to insert 0 duration with incorrect format, get the error and lastly drop the "P" keyspace. {code:java} cqlsh> CREATE KEYSPACE IF NOT EXISTS P WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}; cqlsh> USE P; cqlsh:p> CREATE TABLE P (a INT PRIMARY KEY, b DURATION); cqlsh:p> INSERT INTO P (a, b) VALUES (1, PT0S); cqlsh:p> INSERT INTO P (a, b) VALUES (2, P0D); cqlsh:p> SELECT * FROM P; a | b ---+--- 1 | 2 | (2 rows) cqlsh:p> INSERT INTO P (a, b) VALUES (3, P); SyntaxException: line 1:33 no viable alternative at input ')' (... b) VALUES (3, [P])...) cqlsh:p> DROP KEYSPACE P; cqlsh:p> describe keyspaces; system system_distributed system_traces system_virtual_schema system_auth system_schema system_views {code} was: *Pull requests* * cassandra-3.11 - [https://github.com/apache/cassandra/pull/1977] * cassandra-4.0 - [https://github.com/apache/cassandra/pull/1975] * cassandra-4.1 - [https://github.com/apache/cassandra/pull/1976] *Source code changes* There was a change in the Lexer.g. Capital letter "P" is no longer a valid representation for 0 duration. It has to comply with [https://en.wikipedia.org/wiki/ISO_8601#Durations] (see Benjamin Lerer's comment). A couple of examples for valid 0 duration representation are: {code:java} PT0S P0D PT0H P0W P0Y0M0DT0H0M0S {code} *Unit tests changes* The following tests have been expanded with new logic to cover the ticket's changes: * org.apache.cassandra.cql3.validation.operations.CreateTest * org.apache.cassandra.cql3.validation.operations.DropTest * org.apache.cassandra.cql3.validation.operations.InsertTest *Manual test case flow* Let's go through the case where we create a "P" keyspace, use it, create a "P" table and insert 0 duration twice with the correct format (the updated), select all rows, try to insert 0 duration with incorrect format, get the error and lastly drop the "P" keyspace. {code:java} cqlsh> CREATE KEYSPACE IF NOT EXISTS P WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}; cqlsh> USE P; cqlsh:p> CREATE TABLE P (a INT PRIMARY KEY, b DURATION); cqlsh:p> INSERT INTO P (a, b) VALUES (1, PT0S); cqlsh:p> INSERT INTO P (a, b) VALUES (2, P0D); cqlsh:p> SELECT * FROM P; a | b ---+--- 1 | 2 | (2 rows) cqlsh:p> INSERT INTO P (a, b) VALUES (3, P); SyntaxException: line 1:33 no viable alternative at input ')' (... b) VALUES (3, [P])...) cqlsh:p> DROP KEYSPACE P; cqlsh:p> describe keyspaces; system system_distributed system_traces system_virtual_schema system_auth system_schema system_views {code} > Capital P gets confused in the parser for a Duration in places where IDENT > are needed > - > > Key: CASSANDRA-17919 > URL: https://issues.apache.org/jira/browse/CASSANDRA-17919 > Project: Cassandra > Issue Type: Bug > Components: CQL/Syntax >Reporter: David Capwell >Assignee: Maxim Chanturiay >Priority: Normal > Fix For: 3.11.x, 4.0.x, 4.1.x > > Time Spent: 1h > Remaining Estimate: 0h > > This was found while adding Accord Transaction syntax into CQL and fuzz > testing to validate all possible cases… in doing this the following was found > {code} > String query = "BEGIN TRANSACTION\n" + >" LET P = (SELECT v FROM " + keyspace + ".tbl > WHERE k=? AND c=?);\n" + >" LET row2 = (SELECT v FROM " + keyspace + ".tbl > WHERE k=? AND c=?);\n"
[jira] [Updated] (CASSANDRA-17919) Capital P gets confused in the parser for a Duration in places where IDENT are needed
[ https://issues.apache.org/jira/browse/CASSANDRA-17919?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Maxim Chanturiay updated CASSANDRA-17919: - Test and Documentation Plan: *Pull requests* * cassandra-3.11 - [https://github.com/apache/cassandra/pull/1977] * cassandra-4.0 - [https://github.com/apache/cassandra/pull/1975] * cassandra-4.1 - [https://github.com/apache/cassandra/pull/1976] *Source code changes* There was a change in the Lexer.g. Capital letter "P" is no longer a valid representation for 0 duration. It has to comply with [https://en.wikipedia.org/wiki/ISO_8601#Durations] (see Benjamin Lerer's comment). A couple of examples for valid 0 duration representation are: {code:java} PT0S P0D PT0H P0W P0Y0M0DT0H0M0S {code} *Unit tests changes* The following tests have been expanded with new logic to cover the ticket's changes: * org.apache.cassandra.cql3.validation.operations.CreateTest * org.apache.cassandra.cql3.validation.operations.DropTest * org.apache.cassandra.cql3.validation.operations.InsertTest *Manual test case flow* Let's go through the case where we create a "P" keyspace, use it, create a "P" table and insert 0 duration twice with the correct format (the updated), select all rows, try to insert 0 duration with incorrect format, get the error and lastly drop the "P" keyspace. {code:java} cqlsh> CREATE KEYSPACE IF NOT EXISTS P WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}; cqlsh> USE P; cqlsh:p> CREATE TABLE P (a INT PRIMARY KEY, b DURATION); cqlsh:p> INSERT INTO P (a, b) VALUES (1, PT0S); cqlsh:p> INSERT INTO P (a, b) VALUES (2, P0D); cqlsh:p> SELECT * FROM P; a | b ---+--- 1 | 2 | (2 rows) cqlsh:p> INSERT INTO P (a, b) VALUES (3, P); SyntaxException: line 1:33 no viable alternative at input ')' (... b) VALUES (3, [P])...) cqlsh:p> DROP KEYSPACE P; cqlsh:p> describe keyspaces; system system_distributed system_traces system_virtual_schema system_auth system_schema system_views {code} was: *Pull requests* * cassandra-3.11 - https://github.com/apache/cassandra/pull/1977 * cassandra-4.0 - https://github.com/apache/cassandra/pull/1975 * cassandra-4.1 - https://github.com/apache/cassandra/pull/1976 *Source code changes* There was a change in the Lexer.g. Capital letter "P" is no longer a valid representation for 0 duration. It has to comply with https://en.wikipedia.org/wiki/ISO_8601#Durations (see Benjamin Lerer's comment). A couple of examples for valid 0 duration representation are: {code:java} PT0S P0D PT0H P0W P0Y0M0DT0H0M0S {code} *Unit tests changes* The following tests have been expanded with new logic to cover the ticket's changes: * org.apache.cassandra.cql3.validation.operations.CreateTest * org.apache.cassandra.cql3.validation.operations.DropTest * org.apache.cassandra.cql3.validation.operations.InsertTest *Manual test case flow* Let's go through the case where we create a "P" keyspace, use it, create a "P" table and insert 0 duration twice with the correct format (the updated), select all rows, try to insert 0 duration with incorrect format, get the error and lastly drop the "P" keyspace. {code:java} cqlsh> CREATE KEYSPACE IF NOT EXISTS P WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}; cqlsh> USE P; cqlsh:p> CREATE TABLE P (a INT PRIMARY KEY, b DURATION); cqlsh:p> INSERT INTO P (a, b) VALUES (1, PT0S); cqlsh:p> INSERT INTO P (a, b) VALUES (2, P0D); cqlsh:p> SELECT * FROM P; a | b ---+--- 1 | 2 | (2 rows) cqlsh:p> INSERT INTO P (a, b) VALUES (3, P); SyntaxException: line 1:33 no viable alternative at input ')' (... b) VALUES (3, [P])...) cqlsh:p> DROP KEYSPACE P; cqlsh:p> {code} > Capital P gets confused in the parser for a Duration in places where IDENT > are needed > - > > Key: CASSANDRA-17919 > URL: https://issues.apache.org/jira/browse/CASSANDRA-17919 > Project: Cassandra > Issue Type: Bug > Components: CQL/Syntax >Reporter: David Capwell >Assignee: Maxim Chanturiay >Priority: Normal > Fix For: 3.11.x, 4.0.x, 4.1.x > > Time Spent: 50m > Remaining Estimate: 0h > > This was found while adding Accord Transaction syntax into CQL and fuzz > testing to validate all possible cases… in doing this the following was found > {code} > String query = "BEGIN TRANSACTION\n" + >" LET P = (SELECT v FROM " + keyspace + ".tbl > WHERE k=? AND c=?);\n" + >" LET row2 = (SELECT v FROM " + keyspace + ".tbl > WHERE k=? AND c=?);\n" + >" SELECT v FROM " + keyspace + ".tbl WHERE k=? > AND c=?;\n" + >" IF P IS NULL AND row2.v = ? THEN\n" + >"I
[jira] [Updated] (CASSANDRA-17919) Capital P gets confused in the parser for a Duration in places where IDENT are needed
[ https://issues.apache.org/jira/browse/CASSANDRA-17919?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Maxim Chanturiay updated CASSANDRA-17919: - Test and Documentation Plan: *Pull requests* * cassandra-3.11 - https://github.com/apache/cassandra/pull/1977 * cassandra-4.0 - https://github.com/apache/cassandra/pull/1975 * cassandra-4.1 - https://github.com/apache/cassandra/pull/1976 *Source code changes* There was a change in the Lexer.g. Capital letter "P" is no longer a valid representation for 0 duration. It has to comply with https://en.wikipedia.org/wiki/ISO_8601#Durations (see Benjamin Lerer's comment). A couple of examples for valid 0 duration representation are: {code:java} PT0S P0D PT0H P0W P0Y0M0DT0H0M0S {code} *Unit tests changes* The following tests have been expanded with new logic to cover the ticket's changes: * org.apache.cassandra.cql3.validation.operations.CreateTest * org.apache.cassandra.cql3.validation.operations.DropTest * org.apache.cassandra.cql3.validation.operations.InsertTest *Manual test case flow* Let's go through the case where we create a "P" keyspace, use it, create a "P" table and insert 0 duration twice with the correct format (the updated), select all rows, try to insert 0 duration with incorrect format, get the error and lastly drop the "P" keyspace. {code:java} cqlsh> CREATE KEYSPACE IF NOT EXISTS P WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}; cqlsh> USE P; cqlsh:p> CREATE TABLE P (a INT PRIMARY KEY, b DURATION); cqlsh:p> INSERT INTO P (a, b) VALUES (1, PT0S); cqlsh:p> INSERT INTO P (a, b) VALUES (2, P0D); cqlsh:p> SELECT * FROM P; a | b ---+--- 1 | 2 | (2 rows) cqlsh:p> INSERT INTO P (a, b) VALUES (3, P); SyntaxException: line 1:33 no viable alternative at input ')' (... b) VALUES (3, [P])...) cqlsh:p> DROP KEYSPACE P; cqlsh:p> {code} Status: Patch Available (was: Open) [~dcapwell] [~blerer] hello! I've submitted the patch with the pull requests for the relevant versions. > Capital P gets confused in the parser for a Duration in places where IDENT > are needed > - > > Key: CASSANDRA-17919 > URL: https://issues.apache.org/jira/browse/CASSANDRA-17919 > Project: Cassandra > Issue Type: Bug > Components: CQL/Syntax >Reporter: David Capwell >Assignee: Maxim Chanturiay >Priority: Normal > Fix For: 3.11.x, 4.0.x, 4.1.x > > Time Spent: 50m > Remaining Estimate: 0h > > This was found while adding Accord Transaction syntax into CQL and fuzz > testing to validate all possible cases… in doing this the following was found > {code} > String query = "BEGIN TRANSACTION\n" + >" LET P = (SELECT v FROM " + keyspace + ".tbl > WHERE k=? AND c=?);\n" + >" LET row2 = (SELECT v FROM " + keyspace + ".tbl > WHERE k=? AND c=?);\n" + >" SELECT v FROM " + keyspace + ".tbl WHERE k=? > AND c=?;\n" + >" IF P IS NULL AND row2.v = ? THEN\n" + >"INSERT INTO " + keyspace + ".tbl (k, c, v) > VALUES (?, ?, ?);\n" + >" END IF\n" + >"COMMIT TRANSACTION"; > {code} > Fails with > {code} > SyntaxException: line 2:6 mismatched input 'P' expecting IDENT (BEGIN > TRANSACTION LET [P]...) > {code} > The new LET syntax found this, but was able to reproduce in other cases > {code} > cqlsh:ks> CREATE TABLE P (k INT PRIMARY KEY); > SyntaxException: line 1:13 no viable alternative at input 'P' (CREATE TABLE > [P]...) > cqlsh:ks> > cqlsh:ks> CREATE TABLE p (k INT PRIMARY KEY); > cqlsh:ks> > {code} -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[jira] [Updated] (CASSANDRA-17919) Capital P gets confused in the parser for a Duration in places where IDENT are needed
[ https://issues.apache.org/jira/browse/CASSANDRA-17919?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Benjamin Lerer updated CASSANDRA-17919: --- Fix Version/s: 3.11.x 4.0.x 4.1.x Since Version: 3.10 > Capital P gets confused in the parser for a Duration in places where IDENT > are needed > - > > Key: CASSANDRA-17919 > URL: https://issues.apache.org/jira/browse/CASSANDRA-17919 > Project: Cassandra > Issue Type: Bug > Components: CQL/Syntax >Reporter: David Capwell >Assignee: Maxim Chanturiay >Priority: Normal > Fix For: 3.11.x, 4.0.x, 4.1.x > > > This was found while adding Accord Transaction syntax into CQL and fuzz > testing to validate all possible cases… in doing this the following was found > {code} > String query = "BEGIN TRANSACTION\n" + >" LET P = (SELECT v FROM " + keyspace + ".tbl > WHERE k=? AND c=?);\n" + >" LET row2 = (SELECT v FROM " + keyspace + ".tbl > WHERE k=? AND c=?);\n" + >" SELECT v FROM " + keyspace + ".tbl WHERE k=? > AND c=?;\n" + >" IF P IS NULL AND row2.v = ? THEN\n" + >"INSERT INTO " + keyspace + ".tbl (k, c, v) > VALUES (?, ?, ?);\n" + >" END IF\n" + >"COMMIT TRANSACTION"; > {code} > Fails with > {code} > SyntaxException: line 2:6 mismatched input 'P' expecting IDENT (BEGIN > TRANSACTION LET [P]...) > {code} > The new LET syntax found this, but was able to reproduce in other cases > {code} > cqlsh:ks> CREATE TABLE P (k INT PRIMARY KEY); > SyntaxException: line 1:13 no viable alternative at input 'P' (CREATE TABLE > [P]...) > cqlsh:ks> > cqlsh:ks> CREATE TABLE p (k INT PRIMARY KEY); > cqlsh:ks> > {code} -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[jira] [Updated] (CASSANDRA-17919) Capital P gets confused in the parser for a Duration in places where IDENT are needed
[ https://issues.apache.org/jira/browse/CASSANDRA-17919?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Benjamin Lerer updated CASSANDRA-17919: --- Complexity: Low Hanging Fruit (was: Normal) > Capital P gets confused in the parser for a Duration in places where IDENT > are needed > - > > Key: CASSANDRA-17919 > URL: https://issues.apache.org/jira/browse/CASSANDRA-17919 > Project: Cassandra > Issue Type: Bug > Components: CQL/Syntax >Reporter: David Capwell >Priority: Normal > > This was found while adding Accord Transaction syntax into CQL and fuzz > testing to validate all possible cases… in doing this the following was found > {code} > String query = "BEGIN TRANSACTION\n" + >" LET P = (SELECT v FROM " + keyspace + ".tbl > WHERE k=? AND c=?);\n" + >" LET row2 = (SELECT v FROM " + keyspace + ".tbl > WHERE k=? AND c=?);\n" + >" SELECT v FROM " + keyspace + ".tbl WHERE k=? > AND c=?;\n" + >" IF P IS NULL AND row2.v = ? THEN\n" + >"INSERT INTO " + keyspace + ".tbl (k, c, v) > VALUES (?, ?, ?);\n" + >" END IF\n" + >"COMMIT TRANSACTION"; > {code} > Fails with > {code} > SyntaxException: line 2:6 mismatched input 'P' expecting IDENT (BEGIN > TRANSACTION LET [P]...) > {code} > The new LET syntax found this, but was able to reproduce in other cases > {code} > cqlsh:ks> CREATE TABLE P (k INT PRIMARY KEY); > SyntaxException: line 1:13 no viable alternative at input 'P' (CREATE TABLE > [P]...) > cqlsh:ks> > cqlsh:ks> CREATE TABLE p (k INT PRIMARY KEY); > cqlsh:ks> > {code} -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[jira] [Updated] (CASSANDRA-17919) Capital P gets confused in the parser for a Duration in places where IDENT are needed
[ https://issues.apache.org/jira/browse/CASSANDRA-17919?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] David Capwell updated CASSANDRA-17919: -- Bug Category: Parent values: Correctness(12982)Level 1 values: API / Semantic Definition(13162) Complexity: Normal Discovered By: Fuzz Test Severity: Normal Status: Open (was: Triage Needed) > Capital P gets confused in the parser for a Duration in places where IDENT > are needed > - > > Key: CASSANDRA-17919 > URL: https://issues.apache.org/jira/browse/CASSANDRA-17919 > Project: Cassandra > Issue Type: Bug > Components: CQL/Syntax >Reporter: David Capwell >Priority: Normal > > This was found while adding Accord Transaction syntax into CQL and fuzz > testing to validate all possible cases… in doing this the following was found > {code} > String query = "BEGIN TRANSACTION\n" + >" LET P = (SELECT v FROM " + keyspace + ".tbl > WHERE k=? AND c=?);\n" + >" LET row2 = (SELECT v FROM " + keyspace + ".tbl > WHERE k=? AND c=?);\n" + >" SELECT v FROM " + keyspace + ".tbl WHERE k=? > AND c=?;\n" + >" IF P IS NULL AND row2.v = ? THEN\n" + >"INSERT INTO " + keyspace + ".tbl (k, c, v) > VALUES (?, ?, ?);\n" + >" END IF\n" + >"COMMIT TRANSACTION"; > {code} > Fails with > {code} > SyntaxException: line 2:6 mismatched input 'P' expecting IDENT (BEGIN > TRANSACTION LET [P]...) > {code} > The new LET syntax found this, but was able to reproduce in other cases > {code} > cqlsh:ks> CREATE TABLE P (k INT PRIMARY KEY); > SyntaxException: line 1:13 no viable alternative at input 'P' (CREATE TABLE > [P]...) > cqlsh:ks> > cqlsh:ks> CREATE TABLE p (k INT PRIMARY KEY); > cqlsh:ks> > {code} -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org