[jira] [Commented] (CASSANDRA-14245) SELECT JSON prints null on empty strings
[ https://issues.apache.org/jira/browse/CASSANDRA-14245?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16620296#comment-16620296 ] Benjamin Lerer commented on CASSANDRA-14245: [~BrunoZ] it is better if you open another ticket as this patch as already been released in the version 3.11.3. > SELECT JSON prints null on empty strings > > > Key: CASSANDRA-14245 > URL: https://issues.apache.org/jira/browse/CASSANDRA-14245 > Project: Cassandra > Issue Type: Bug > Components: CQL > Environment: Cassandra 3.11.2, Ubuntu 16.04 LTS > >Reporter: Norbert Schultz >Assignee: Francisco Fernandez >Priority: Major > Fix For: 3.11.3, 4.0 > > > SELECT JSON reports an empty string as null. > > Example: > {code:java} > cqlsh:unittest> create table test(id INT, name TEXT, PRIMARY KEY(id)); > cqlsh:unittest> insert into test (id, name) VALUES (1, 'Foo'); > cqlsh:unittest> insert into test (id, name) VALUES (2, ''); > cqlsh:unittest> insert into test (id, name) VALUES (3, null); > cqlsh:unittest> select * from test; > id | name > +-- > 1 | Foo > 2 | > 3 | null > (3 rows) > cqlsh:unittest> select JSON * from test; > [json] > -- > {"id": 1, "name": "Foo"} > {"id": 2, "name": null} > {"id": 3, "name": null} > (3 rows){code} > > This even happens, if the string is part of the Primary Key, which makes the > generated string not insertable. > > {code:java} > cqlsh:unittest> create table test2 (id INT, name TEXT, age INT, PRIMARY > KEY(id, name)); > cqlsh:unittest> insert into test2 (id, name, age) VALUES (1, '', 42); > cqlsh:unittest> select JSON * from test2; > [json] > > {"id": 1, "name": null, "age": 42} > (1 rows) > cqlsh:unittest> insert into test2 JSON '{"id": 1, "name": null, "age": 42}'; > InvalidRequest: Error from server: code=2200 [Invalid query] message="Invalid > null value in condition for column name"{code} > > On an older version of Cassandra (3.0.8) does not have this problem. -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
***UNCHECKED*** [jira] [Commented] (CASSANDRA-14245) SELECT JSON prints null on empty strings
[ https://issues.apache.org/jira/browse/CASSANDRA-14245?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16620282#comment-16620282 ] Bruno commented on CASSANDRA-14245: --- Thanks but when you import such exported using CQL.json(String), you have : Error decoding JSON value for value: Value '' is not a valid blob representation: String representation of blob is missing 0x prefix: com.datastax.driver.core.exceptions.InvalidQueryException: Error decoding JSON value for value: Value '' is not a valid blob representation: String representation of blob is missing 0x prefix: at com.datastax.driver.core.Responses$Error.asException(Responses.java:148) ~[cassandra-driver-core-3.2.0.jar:?] > SELECT JSON prints null on empty strings > > > Key: CASSANDRA-14245 > URL: https://issues.apache.org/jira/browse/CASSANDRA-14245 > Project: Cassandra > Issue Type: Bug > Components: CQL > Environment: Cassandra 3.11.2, Ubuntu 16.04 LTS > >Reporter: Norbert Schultz >Assignee: Francisco Fernandez >Priority: Major > Fix For: 3.11.3, 4.0 > > > SELECT JSON reports an empty string as null. > > Example: > {code:java} > cqlsh:unittest> create table test(id INT, name TEXT, PRIMARY KEY(id)); > cqlsh:unittest> insert into test (id, name) VALUES (1, 'Foo'); > cqlsh:unittest> insert into test (id, name) VALUES (2, ''); > cqlsh:unittest> insert into test (id, name) VALUES (3, null); > cqlsh:unittest> select * from test; > id | name > +-- > 1 | Foo > 2 | > 3 | null > (3 rows) > cqlsh:unittest> select JSON * from test; > [json] > -- > {"id": 1, "name": "Foo"} > {"id": 2, "name": null} > {"id": 3, "name": null} > (3 rows){code} > > This even happens, if the string is part of the Primary Key, which makes the > generated string not insertable. > > {code:java} > cqlsh:unittest> create table test2 (id INT, name TEXT, age INT, PRIMARY > KEY(id, name)); > cqlsh:unittest> insert into test2 (id, name, age) VALUES (1, '', 42); > cqlsh:unittest> select JSON * from test2; > [json] > > {"id": 1, "name": null, "age": 42} > (1 rows) > cqlsh:unittest> insert into test2 JSON '{"id": 1, "name": null, "age": 42}'; > InvalidRequest: Error from server: code=2200 [Invalid query] message="Invalid > null value in condition for column name"{code} > > On an older version of Cassandra (3.0.8) does not have this problem. -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[jira] [Commented] (CASSANDRA-14245) SELECT JSON prints null on empty strings
[ https://issues.apache.org/jira/browse/CASSANDRA-14245?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16418535#comment-16418535 ] Norbert Schultz commented on CASSANDRA-14245: - Thanks for fixing. > SELECT JSON prints null on empty strings > > > Key: CASSANDRA-14245 > URL: https://issues.apache.org/jira/browse/CASSANDRA-14245 > Project: Cassandra > Issue Type: Bug > Components: CQL > Environment: Cassandra 3.11.2, Ubuntu 16.04 LTS > >Reporter: Norbert Schultz >Assignee: Francisco Fernandez >Priority: Major > Fix For: 4.0, 3.11.3 > > > SELECT JSON reports an empty string as null. > > Example: > {code:java} > cqlsh:unittest> create table test(id INT, name TEXT, PRIMARY KEY(id)); > cqlsh:unittest> insert into test (id, name) VALUES (1, 'Foo'); > cqlsh:unittest> insert into test (id, name) VALUES (2, ''); > cqlsh:unittest> insert into test (id, name) VALUES (3, null); > cqlsh:unittest> select * from test; > id | name > +-- > 1 | Foo > 2 | > 3 | null > (3 rows) > cqlsh:unittest> select JSON * from test; > [json] > -- > {"id": 1, "name": "Foo"} > {"id": 2, "name": null} > {"id": 3, "name": null} > (3 rows){code} > > This even happens, if the string is part of the Primary Key, which makes the > generated string not insertable. > > {code:java} > cqlsh:unittest> create table test2 (id INT, name TEXT, age INT, PRIMARY > KEY(id, name)); > cqlsh:unittest> insert into test2 (id, name, age) VALUES (1, '', 42); > cqlsh:unittest> select JSON * from test2; > [json] > > {"id": 1, "name": null, "age": 42} > (1 rows) > cqlsh:unittest> insert into test2 JSON '{"id": 1, "name": null, "age": 42}'; > InvalidRequest: Error from server: code=2200 [Invalid query] message="Invalid > null value in condition for column name"{code} > > On an older version of Cassandra (3.0.8) does not have this problem. -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[jira] [Commented] (CASSANDRA-14245) SELECT JSON prints null on empty strings
[ https://issues.apache.org/jira/browse/CASSANDRA-14245?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16417296#comment-16417296 ] Benjamin Lerer commented on CASSANDRA-14245: The patch and the unit tests results look good. Thanks. > SELECT JSON prints null on empty strings > > > Key: CASSANDRA-14245 > URL: https://issues.apache.org/jira/browse/CASSANDRA-14245 > Project: Cassandra > Issue Type: Bug > Components: CQL > Environment: Cassandra 3.11.2, Ubuntu 16.04 LTS > >Reporter: Norbert Schultz >Assignee: Francisco Fernandez >Priority: Major > > SELECT JSON reports an empty string as null. > > Example: > {code:java} > cqlsh:unittest> create table test(id INT, name TEXT, PRIMARY KEY(id)); > cqlsh:unittest> insert into test (id, name) VALUES (1, 'Foo'); > cqlsh:unittest> insert into test (id, name) VALUES (2, ''); > cqlsh:unittest> insert into test (id, name) VALUES (3, null); > cqlsh:unittest> select * from test; > id | name > +-- > 1 | Foo > 2 | > 3 | null > (3 rows) > cqlsh:unittest> select JSON * from test; > [json] > -- > {"id": 1, "name": "Foo"} > {"id": 2, "name": null} > {"id": 3, "name": null} > (3 rows){code} > > This even happens, if the string is part of the Primary Key, which makes the > generated string not insertable. > > {code:java} > cqlsh:unittest> create table test2 (id INT, name TEXT, age INT, PRIMARY > KEY(id, name)); > cqlsh:unittest> insert into test2 (id, name, age) VALUES (1, '', 42); > cqlsh:unittest> select JSON * from test2; > [json] > > {"id": 1, "name": null, "age": 42} > (1 rows) > cqlsh:unittest> insert into test2 JSON '{"id": 1, "name": null, "age": 42}'; > InvalidRequest: Error from server: code=2200 [Invalid query] message="Invalid > null value in condition for column name"{code} > > On an older version of Cassandra (3.0.8) does not have this problem. -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[jira] [Commented] (CASSANDRA-14245) SELECT JSON prints null on empty strings
[ https://issues.apache.org/jira/browse/CASSANDRA-14245?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16409364#comment-16409364 ] Francisco Fernandez commented on CASSANDRA-14245: - The problem is that the json serializer writes empty buffers as null instead of "". [Patch|https://github.com/apache/cassandra/compare/cassandra-3.11...fcofdez:CASSANDRA-14245-3.11?expand=1] > SELECT JSON prints null on empty strings > > > Key: CASSANDRA-14245 > URL: https://issues.apache.org/jira/browse/CASSANDRA-14245 > Project: Cassandra > Issue Type: Bug > Components: CQL > Environment: Cassandra 3.11.2, Ubuntu 16.04 LTS > >Reporter: Norbert Schultz >Assignee: Francisco Fernandez >Priority: Major > > SELECT JSON reports an empty string as null. > > Example: > {code:java} > cqlsh:unittest> create table test(id INT, name TEXT, PRIMARY KEY(id)); > cqlsh:unittest> insert into test (id, name) VALUES (1, 'Foo'); > cqlsh:unittest> insert into test (id, name) VALUES (2, ''); > cqlsh:unittest> insert into test (id, name) VALUES (3, null); > cqlsh:unittest> select * from test; > id | name > +-- > 1 | Foo > 2 | > 3 | null > (3 rows) > cqlsh:unittest> select JSON * from test; > [json] > -- > {"id": 1, "name": "Foo"} > {"id": 2, "name": null} > {"id": 3, "name": null} > (3 rows){code} > > This even happens, if the string is part of the Primary Key, which makes the > generated string not insertable. > > {code:java} > cqlsh:unittest> create table test2 (id INT, name TEXT, age INT, PRIMARY > KEY(id, name)); > cqlsh:unittest> insert into test2 (id, name, age) VALUES (1, '', 42); > cqlsh:unittest> select JSON * from test2; > [json] > > {"id": 1, "name": null, "age": 42} > (1 rows) > cqlsh:unittest> insert into test2 JSON '{"id": 1, "name": null, "age": 42}'; > InvalidRequest: Error from server: code=2200 [Invalid query] message="Invalid > null value in condition for column name"{code} > > On an older version of Cassandra (3.0.8) does not have this problem. -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org