[jira] [Updated] (CASSANDRA-10027) ALTER TABLE TYPE check broken
[ https://issues.apache.org/jira/browse/CASSANDRA-10027?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Benjamin Lerer updated CASSANDRA-10027: --- Component/s: CQL > ALTER TABLE TYPE check broken > - > > Key: CASSANDRA-10027 > URL: https://issues.apache.org/jira/browse/CASSANDRA-10027 > Project: Cassandra > Issue Type: Bug > Components: CQL >Reporter: Aaron Ploetz >Assignee: Benjamin Lerer >Priority: Minor > Fix For: 2.2.4, 3.0.1, 3.1 > > Attachments: 10027-2.2.txt > > > I stumbled onto the fact that 2.2.0 will allow you to ALTER TYPE of a > {{varint}} to the new {{date}} type. I thought that was an odd conversion to > allow, so I attempted to query it. I received an error on all subsequent > queries, unless I exited or truncated the table. > After truncating, I could then INSERT and query as normal. But the new > {{varint}} values inserted simply were reflected as an offset of the minimum > {{varint}} value. > I'm not sure why that's happening, but if we could simply prevent type > conversion between {{varint}} and {{date}} (and just show the "types are > incompatible" message) that should fix this. > Steps to reproduce: > {code} > aploetz@cqlsh:typeconversion> CREATE TABLE varinttest (key int PRIMARY KEY, > c1 varint); > aploetz@cqlsh:typeconversion> INSERT INTO varinttest (key, c1) VALUES (1,1); > aploetz@cqlsh:typeconversion> SELECT * FROM varinttest ; > key | c1 > -+ >1 | 1 > (1 rows) > aploetz@cqlsh:typeconversion> ALTER TABLE varinttest ALTER c1 TYPE date; > aploetz@cqlsh:typeconversion> SELECT * FROM varinttest ; > Traceback (most recent call last): > File "/usr/bin/cqlsh.py", line 1150, in perform_simple_statement > rows = future.result(self.session.default_timeout) > File > "/usr/share/cassandra/lib/cassandra-driver-internal-only-2.6.0c2.post.zip/cassandra-driver-2.6.0c2.post/cassandra/cluster.py", > line 3296, in result > raise self._final_exception > error: unpack requires a string argument of length 4 > aploetz@cqlsh:typeconversion> SELECT * FROM varinttest ; > NoHostAvailable: ('Unable to complete the operation against any hosts', > {: ConnectionShutdown('Connection to 127.0.0.1 is > defunct',)}) > aploetz@cqlsh:typeconversion> TRUNCATE varinttest ; > aploetz@cqlsh:typeconversion> SELECT * FROM varinttest ; > key | c1 > -+ > (0 rows) > aploetz@cqlsh:typeconversion> INSERT INTO varinttest (key, c1) VALUES (1,1); > aploetz@cqlsh:typeconversion> INSERT INTO varinttest (key, c1) VALUES (2,2); > aploetz@cqlsh:typeconversion> INSERT INTO varinttest (key, c1) VALUES (3,3); > aploetz@cqlsh:typeconversion> SELECT * FROM varinttest ; > key | c1 > -+- >1 | -2147483647 >2 | -2147483646 >3 | -2147483645 > (3 rows) > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (CASSANDRA-10027) ALTER TABLE TYPE check broken
[ https://issues.apache.org/jira/browse/CASSANDRA-10027?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Benjamin Lerer updated CASSANDRA-10027: --- Attachment: 10027-2.2.txt > ALTER TABLE TYPE check broken > - > > Key: CASSANDRA-10027 > URL: https://issues.apache.org/jira/browse/CASSANDRA-10027 > Project: Cassandra > Issue Type: Bug >Reporter: Aaron Ploetz >Assignee: Benjamin Lerer >Priority: Minor > Fix For: 2.2.x, 3.0.x, 3.x > > Attachments: 10027-2.2.txt > > > I stumbled onto the fact that 2.2.0 will allow you to ALTER TYPE of a > {{varint}} to the new {{date}} type. I thought that was an odd conversion to > allow, so I attempted to query it. I received an error on all subsequent > queries, unless I exited or truncated the table. > After truncating, I could then INSERT and query as normal. But the new > {{varint}} values inserted simply were reflected as an offset of the minimum > {{varint}} value. > I'm not sure why that's happening, but if we could simply prevent type > conversion between {{varint}} and {{date}} (and just show the "types are > incompatible" message) that should fix this. > Steps to reproduce: > {code} > aploetz@cqlsh:typeconversion> CREATE TABLE varinttest (key int PRIMARY KEY, > c1 varint); > aploetz@cqlsh:typeconversion> INSERT INTO varinttest (key, c1) VALUES (1,1); > aploetz@cqlsh:typeconversion> SELECT * FROM varinttest ; > key | c1 > -+ >1 | 1 > (1 rows) > aploetz@cqlsh:typeconversion> ALTER TABLE varinttest ALTER c1 TYPE date; > aploetz@cqlsh:typeconversion> SELECT * FROM varinttest ; > Traceback (most recent call last): > File "/usr/bin/cqlsh.py", line 1150, in perform_simple_statement > rows = future.result(self.session.default_timeout) > File > "/usr/share/cassandra/lib/cassandra-driver-internal-only-2.6.0c2.post.zip/cassandra-driver-2.6.0c2.post/cassandra/cluster.py", > line 3296, in result > raise self._final_exception > error: unpack requires a string argument of length 4 > aploetz@cqlsh:typeconversion> SELECT * FROM varinttest ; > NoHostAvailable: ('Unable to complete the operation against any hosts', > {: ConnectionShutdown('Connection to 127.0.0.1 is > defunct',)}) > aploetz@cqlsh:typeconversion> TRUNCATE varinttest ; > aploetz@cqlsh:typeconversion> SELECT * FROM varinttest ; > key | c1 > -+ > (0 rows) > aploetz@cqlsh:typeconversion> INSERT INTO varinttest (key, c1) VALUES (1,1); > aploetz@cqlsh:typeconversion> INSERT INTO varinttest (key, c1) VALUES (2,2); > aploetz@cqlsh:typeconversion> INSERT INTO varinttest (key, c1) VALUES (3,3); > aploetz@cqlsh:typeconversion> SELECT * FROM varinttest ; > key | c1 > -+- >1 | -2147483647 >2 | -2147483646 >3 | -2147483645 > (3 rows) > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (CASSANDRA-10027) ALTER TABLE TYPE check broken
[ https://issues.apache.org/jira/browse/CASSANDRA-10027?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Benjamin Lerer updated CASSANDRA-10027: --- Attachment: (was: cassandra-2.2-10271.txt) > ALTER TABLE TYPE check broken > - > > Key: CASSANDRA-10027 > URL: https://issues.apache.org/jira/browse/CASSANDRA-10027 > Project: Cassandra > Issue Type: Bug >Reporter: Aaron Ploetz >Assignee: Benjamin Lerer >Priority: Minor > Fix For: 2.2.x, 3.0.x, 3.x > > > I stumbled onto the fact that 2.2.0 will allow you to ALTER TYPE of a > {{varint}} to the new {{date}} type. I thought that was an odd conversion to > allow, so I attempted to query it. I received an error on all subsequent > queries, unless I exited or truncated the table. > After truncating, I could then INSERT and query as normal. But the new > {{varint}} values inserted simply were reflected as an offset of the minimum > {{varint}} value. > I'm not sure why that's happening, but if we could simply prevent type > conversion between {{varint}} and {{date}} (and just show the "types are > incompatible" message) that should fix this. > Steps to reproduce: > {code} > aploetz@cqlsh:typeconversion> CREATE TABLE varinttest (key int PRIMARY KEY, > c1 varint); > aploetz@cqlsh:typeconversion> INSERT INTO varinttest (key, c1) VALUES (1,1); > aploetz@cqlsh:typeconversion> SELECT * FROM varinttest ; > key | c1 > -+ >1 | 1 > (1 rows) > aploetz@cqlsh:typeconversion> ALTER TABLE varinttest ALTER c1 TYPE date; > aploetz@cqlsh:typeconversion> SELECT * FROM varinttest ; > Traceback (most recent call last): > File "/usr/bin/cqlsh.py", line 1150, in perform_simple_statement > rows = future.result(self.session.default_timeout) > File > "/usr/share/cassandra/lib/cassandra-driver-internal-only-2.6.0c2.post.zip/cassandra-driver-2.6.0c2.post/cassandra/cluster.py", > line 3296, in result > raise self._final_exception > error: unpack requires a string argument of length 4 > aploetz@cqlsh:typeconversion> SELECT * FROM varinttest ; > NoHostAvailable: ('Unable to complete the operation against any hosts', > {: ConnectionShutdown('Connection to 127.0.0.1 is > defunct',)}) > aploetz@cqlsh:typeconversion> TRUNCATE varinttest ; > aploetz@cqlsh:typeconversion> SELECT * FROM varinttest ; > key | c1 > -+ > (0 rows) > aploetz@cqlsh:typeconversion> INSERT INTO varinttest (key, c1) VALUES (1,1); > aploetz@cqlsh:typeconversion> INSERT INTO varinttest (key, c1) VALUES (2,2); > aploetz@cqlsh:typeconversion> INSERT INTO varinttest (key, c1) VALUES (3,3); > aploetz@cqlsh:typeconversion> SELECT * FROM varinttest ; > key | c1 > -+- >1 | -2147483647 >2 | -2147483646 >3 | -2147483645 > (3 rows) > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (CASSANDRA-10027) ALTER TABLE TYPE check broken
[ https://issues.apache.org/jira/browse/CASSANDRA-10027?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Benjamin Lerer updated CASSANDRA-10027: --- Attachment: cassandra-2.2-10271.txt The problem has been introduced when the {{SimpleDateType}} was created. The {{date}} type should be compatible with the {{int}} type and not with the {{varint}} type. The error was probably caused by the fact that internally the class representing the {{int}} type is the {{Int32Type}} and not the {{IntegerType}}, while the {{bigint}} type is represented by the {{LongType}}. The patch makes sure that the proper type is used and add some unit tests to check the proper behavior. * The unit tests results for 2.2 are [here|http://cassci.datastax.com/view/Dev/view/blerer/job/blerer-10027-2.2-testall/1/] * The dtests results for 2.2 are [here|http://cassci.datastax.com/view/Dev/view/blerer/job/blerer-10027-2.2-dtest/1/] * The unit tests results for 3.0 are [here|http://cassci.datastax.com/view/Dev/view/blerer/job/blerer-10027-3.0-testall/2/] * The dtests results for 3.0 are [here|http://cassci.datastax.com/view/Dev/view/blerer/job/blerer-10027-3.0-dtest/4/] > ALTER TABLE TYPE check broken > - > > Key: CASSANDRA-10027 > URL: https://issues.apache.org/jira/browse/CASSANDRA-10027 > Project: Cassandra > Issue Type: Bug >Reporter: Aaron Ploetz >Assignee: Benjamin Lerer >Priority: Minor > Fix For: 2.1.x, 2.2.x > > Attachments: cassandra-2.2-10271.txt > > > I stumbled onto the fact that 2.2.0 will allow you to ALTER TYPE of a > {{varint}} to the new {{date}} type. I thought that was an odd conversion to > allow, so I attempted to query it. I received an error on all subsequent > queries, unless I exited or truncated the table. > After truncating, I could then INSERT and query as normal. But the new > {{varint}} values inserted simply were reflected as an offset of the minimum > {{varint}} value. > I'm not sure why that's happening, but if we could simply prevent type > conversion between {{varint}} and {{date}} (and just show the "types are > incompatible" message) that should fix this. > Steps to reproduce: > {code} > aploetz@cqlsh:typeconversion> CREATE TABLE varinttest (key int PRIMARY KEY, > c1 varint); > aploetz@cqlsh:typeconversion> INSERT INTO varinttest (key, c1) VALUES (1,1); > aploetz@cqlsh:typeconversion> SELECT * FROM varinttest ; > key | c1 > -+ >1 | 1 > (1 rows) > aploetz@cqlsh:typeconversion> ALTER TABLE varinttest ALTER c1 TYPE date; > aploetz@cqlsh:typeconversion> SELECT * FROM varinttest ; > Traceback (most recent call last): > File "/usr/bin/cqlsh.py", line 1150, in perform_simple_statement > rows = future.result(self.session.default_timeout) > File > "/usr/share/cassandra/lib/cassandra-driver-internal-only-2.6.0c2.post.zip/cassandra-driver-2.6.0c2.post/cassandra/cluster.py", > line 3296, in result > raise self._final_exception > error: unpack requires a string argument of length 4 > aploetz@cqlsh:typeconversion> SELECT * FROM varinttest ; > NoHostAvailable: ('Unable to complete the operation against any hosts', > {: ConnectionShutdown('Connection to 127.0.0.1 is > defunct',)}) > aploetz@cqlsh:typeconversion> TRUNCATE varinttest ; > aploetz@cqlsh:typeconversion> SELECT * FROM varinttest ; > key | c1 > -+ > (0 rows) > aploetz@cqlsh:typeconversion> INSERT INTO varinttest (key, c1) VALUES (1,1); > aploetz@cqlsh:typeconversion> INSERT INTO varinttest (key, c1) VALUES (2,2); > aploetz@cqlsh:typeconversion> INSERT INTO varinttest (key, c1) VALUES (3,3); > aploetz@cqlsh:typeconversion> SELECT * FROM varinttest ; > key | c1 > -+- >1 | -2147483647 >2 | -2147483646 >3 | -2147483645 > (3 rows) > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (CASSANDRA-10027) ALTER TABLE TYPE check broken
[ https://issues.apache.org/jira/browse/CASSANDRA-10027?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Philip Thompson updated CASSANDRA-10027: Assignee: Benjamin Lerer Fix Version/s: 2.2.x > ALTER TABLE TYPE check broken > - > > Key: CASSANDRA-10027 > URL: https://issues.apache.org/jira/browse/CASSANDRA-10027 > Project: Cassandra > Issue Type: Bug > Components: Core >Reporter: Aaron Ploetz >Assignee: Benjamin Lerer >Priority: Minor > Fix For: 2.1.x, 2.2.x > > > I stumbled onto the fact that 2.2.0 will allow you to ALTER TYPE of a > {{varint}} to the new {{date}} type. I thought that was an odd conversion to > allow, so I attempted to query it. I received an error on all subsequent > queries, unless I exited or truncated the table. > After truncating, I could then INSERT and query as normal. But the new > {{varint}} values inserted simply were reflected as an offset of the minimum > {{varint}} value. > I'm not sure why that's happening, but if we could simply prevent type > conversion between {{varint}} and {{date}} (and just show the "types are > incompatible" message) that should fix this. > Steps to reproduce: > {code} > aploetz@cqlsh:typeconversion> CREATE TABLE varinttest (key int PRIMARY KEY, > c1 varint); > aploetz@cqlsh:typeconversion> INSERT INTO varinttest (key, c1) VALUES (1,1); > aploetz@cqlsh:typeconversion> SELECT * FROM varinttest ; > key | c1 > -+ >1 | 1 > (1 rows) > aploetz@cqlsh:typeconversion> ALTER TABLE varinttest ALTER c1 TYPE date; > aploetz@cqlsh:typeconversion> SELECT * FROM varinttest ; > Traceback (most recent call last): > File "/usr/bin/cqlsh.py", line 1150, in perform_simple_statement > rows = future.result(self.session.default_timeout) > File > "/usr/share/cassandra/lib/cassandra-driver-internal-only-2.6.0c2.post.zip/cassandra-driver-2.6.0c2.post/cassandra/cluster.py", > line 3296, in result > raise self._final_exception > error: unpack requires a string argument of length 4 > aploetz@cqlsh:typeconversion> SELECT * FROM varinttest ; > NoHostAvailable: ('Unable to complete the operation against any hosts', > {: ConnectionShutdown('Connection to 127.0.0.1 is > defunct',)}) > aploetz@cqlsh:typeconversion> TRUNCATE varinttest ; > aploetz@cqlsh:typeconversion> SELECT * FROM varinttest ; > key | c1 > -+ > (0 rows) > aploetz@cqlsh:typeconversion> INSERT INTO varinttest (key, c1) VALUES (1,1); > aploetz@cqlsh:typeconversion> INSERT INTO varinttest (key, c1) VALUES (2,2); > aploetz@cqlsh:typeconversion> INSERT INTO varinttest (key, c1) VALUES (3,3); > aploetz@cqlsh:typeconversion> SELECT * FROM varinttest ; > key | c1 > -+- >1 | -2147483647 >2 | -2147483646 >3 | -2147483645 > (3 rows) > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (CASSANDRA-10027) ALTER TABLE TYPE check broken
[ https://issues.apache.org/jira/browse/CASSANDRA-10027?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Robert Stupp updated CASSANDRA-10027: - Summary: ALTER TABLE TYPE check broken (was: ALTER TYPE of varint to date should not be allowed) > ALTER TABLE TYPE check broken > - > > Key: CASSANDRA-10027 > URL: https://issues.apache.org/jira/browse/CASSANDRA-10027 > Project: Cassandra > Issue Type: Bug > Components: Core >Reporter: Aaron Ploetz >Priority: Minor > Fix For: 2.1.x > > > I stumbled onto the fact that 2.2.0 will allow you to ALTER TYPE of a > {{varint}} to the new {{date}} type. I thought that was an odd conversion to > allow, so I attempted to query it. I received an error on all subsequent > queries, unless I exited or truncated the table. > After truncating, I could then INSERT and query as normal. But the new > {{varint}} values inserted simply were reflected as an offset of the minimum > {{varint}} value. > I'm not sure why that's happening, but if we could simply prevent type > conversion between {{varint}} and {{date}} (and just show the "types are > incompatible" message) that should fix this. > Steps to reproduce: > {code} > aploetz@cqlsh:typeconversion> CREATE TABLE varinttest (key int PRIMARY KEY, > c1 varint); > aploetz@cqlsh:typeconversion> INSERT INTO varinttest (key, c1) VALUES (1,1); > aploetz@cqlsh:typeconversion> SELECT * FROM varinttest ; > key | c1 > -+ >1 | 1 > (1 rows) > aploetz@cqlsh:typeconversion> ALTER TABLE varinttest ALTER c1 TYPE date; > aploetz@cqlsh:typeconversion> SELECT * FROM varinttest ; > Traceback (most recent call last): > File "/usr/bin/cqlsh.py", line 1150, in perform_simple_statement > rows = future.result(self.session.default_timeout) > File > "/usr/share/cassandra/lib/cassandra-driver-internal-only-2.6.0c2.post.zip/cassandra-driver-2.6.0c2.post/cassandra/cluster.py", > line 3296, in result > raise self._final_exception > error: unpack requires a string argument of length 4 > aploetz@cqlsh:typeconversion> SELECT * FROM varinttest ; > NoHostAvailable: ('Unable to complete the operation against any hosts', > {: ConnectionShutdown('Connection to 127.0.0.1 is > defunct',)}) > aploetz@cqlsh:typeconversion> TRUNCATE varinttest ; > aploetz@cqlsh:typeconversion> SELECT * FROM varinttest ; > key | c1 > -+ > (0 rows) > aploetz@cqlsh:typeconversion> INSERT INTO varinttest (key, c1) VALUES (1,1); > aploetz@cqlsh:typeconversion> INSERT INTO varinttest (key, c1) VALUES (2,2); > aploetz@cqlsh:typeconversion> INSERT INTO varinttest (key, c1) VALUES (3,3); > aploetz@cqlsh:typeconversion> SELECT * FROM varinttest ; > key | c1 > -+- >1 | -2147483647 >2 | -2147483646 >3 | -2147483645 > (3 rows) > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)