(cqlsh) SELECT ... TOKEN() function broken in C* 2.1.1 patch by Philip Thompson; reviewed by Mikhail Stepura for CASSANDRA-8258
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/85150290 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/85150290 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/85150290 Branch: refs/heads/trunk Commit: 8515029020dba0ac7ddda36832f3aa32a58ca738 Parents: a9f65bc Author: Philip Thompson <ptnapol...@gmail.com> Authored: Wed Nov 5 15:31:10 2014 -0800 Committer: Mikhail Stepura <mish...@apache.org> Committed: Wed Nov 5 15:31:10 2014 -0800 ---------------------------------------------------------------------- CHANGES.txt | 1 + pylib/cqlshlib/cql3handling.py | 2 +- pylib/cqlshlib/test/test_cql_parsing.py | 9 ++++++++- 3 files changed, 10 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/85150290/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 2b9e10c..ee18be0 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 2.1.2 + * (cqlsh) Fix SELECT ... TOKEN() function broken in C* 2.1.1 (CASSANDRA-8258) * Fix Cassandra crash when running on JDK8 update 40 (CASSANDRA-8209) * Optimize partitioner tokens (CASSANDRA-8230) * Improve compaction of repaired/unrepaired sstables (CASSANDRA-8004) http://git-wip-us.apache.org/repos/asf/cassandra/blob/85150290/pylib/cqlshlib/cql3handling.py ---------------------------------------------------------------------- diff --git a/pylib/cqlshlib/cql3handling.py b/pylib/cqlshlib/cql3handling.py index e12e7e1..b1179ca 100644 --- a/pylib/cqlshlib/cql3handling.py +++ b/pylib/cqlshlib/cql3handling.py @@ -206,7 +206,7 @@ JUNK ::= /([ \t\r\f\v]+|(--|[/][/])[^\n\r]*([\n\r]|$)|[/][*].*?[*][/])/ ; <mapLiteral> ::= "{" <term> ":" <term> ( "," <term> ":" <term> )* "}" ; -<functionName> ::= <identifier> +<functionName> ::= <identifier> | "TOKEN" ; <statementBody> ::= <useStatement> http://git-wip-us.apache.org/repos/asf/cassandra/blob/85150290/pylib/cqlshlib/test/test_cql_parsing.py ---------------------------------------------------------------------- diff --git a/pylib/cqlshlib/test/test_cql_parsing.py b/pylib/cqlshlib/test/test_cql_parsing.py index 7e4e6f3..f88b839 100644 --- a/pylib/cqlshlib/test/test_cql_parsing.py +++ b/pylib/cqlshlib/test/test_cql_parsing.py @@ -18,10 +18,12 @@ # for Thrift connections, and $CQL_TEST_PORT to the associated port. from .basecase import BaseTestCase, cqlsh +from .cassconnect import get_test_keyspace, testrun_cqlsh, testcall_cqlsh class TestCqlParsing(BaseTestCase): def setUp(self): - pass + self.cqlsh_runner = testrun_cqlsh(cqlver=cqlsh.DEFAULT_CQLVER, env={'COLUMNS': '100000'}) + self.cqlsh = self.cqlsh_runner.__enter__() def tearDown(self): pass @@ -85,3 +87,8 @@ class TestCqlParsing(BaseTestCase): def test_parse_drop_index(self): pass + + def test_parse_select_token(self): + self.cqlsh.cmd_and_response('INSERT INTO has_all_types (num) VALUES (1);') + response = self.cqlsh.cmd_and_response("SELECT token(num) from has_all_types where num=1;") + self.assertIn('-4069959284402364209', response)