You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Aleksey Yeschenko (JIRA)" <ji...@apache.org> on 2012/12/03 17:35:58 UTC
[jira] [Created] (CASSANDRA-5017) Preparing UPDATE queries with
collections returns suboptimal metadata
Aleksey Yeschenko created CASSANDRA-5017:
--------------------------------------------
Summary: Preparing UPDATE queries with collections returns suboptimal metadata
Key: CASSANDRA-5017
URL: https://issues.apache.org/jira/browse/CASSANDRA-5017
Project: Cassandra
Issue Type: Bug
Affects Versions: 1.2.0 beta 2
Reporter: Aleksey Yeschenko
Assignee: Sylvain Lebresne
Priority: Minor
CQL3, binary protocol.
collections (id int primary key, amap map<int, varchar>);
preparing "UPDATE test.collections SET amap[?] = ? WHERE id = ?" returns the following metadata:
[{column,<<"test">>,<<"collections">>,<<"amap">>,
{map,int,varchar}},
{column,<<"test">>,<<"collections">>,<<"amap">>,
{map,int,varchar}},
{column,<<"test">>,<<"collections">>,<<"id">>,int}]
Ideally it should return [int, varchar, int] types. Less ideally [{map, int, varchar}, int] and expect an encoded map with a single key-value pair. But certainly not what it currently returns.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CASSANDRA-5017) Preparing UPDATE queries with
collections returns suboptimal metadata
Posted by "Aleksey Yeschenko (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CASSANDRA-5017?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13510152#comment-13510152 ]
Aleksey Yeschenko commented on CASSANDRA-5017:
----------------------------------------------
CASSANDRA-5018 in indeed no longer an issue. Also I do get the right columns in my metadata now:
{ok, R} = seestar_client:prepare(Pid, "update test.collections set amap[?] = ? WHERE id = ?").
{ok,{prepared,<<21,71,235,65,143,167,200,103,53,75,239,64,
92,235,243,145>>,
[{column,<<"test">>,<<"collections">>,<<"key(amap)">>,int},
{column,<<"test">>,<<"collections">>,<<"value(amap)">>,
varchar},
{column,<<"test">>,<<"collections">>,<<"id">>,int}]}}
However, when I try to execute the query (or just run it in cqlsh), I get "Bad Request: List operations are only supported on List typed columns, but org.apache.cassandra.db.marshal.MapType(org.apache.cassandra.db.marshal.Int32Type,org.apache.cassandra.db.marshal.UTF8Type) given" error.
> Preparing UPDATE queries with collections returns suboptimal metadata
> ---------------------------------------------------------------------
>
> Key: CASSANDRA-5017
> URL: https://issues.apache.org/jira/browse/CASSANDRA-5017
> Project: Cassandra
> Issue Type: Bug
> Affects Versions: 1.2.0 beta 2
> Reporter: Aleksey Yeschenko
> Assignee: Sylvain Lebresne
> Priority: Minor
> Fix For: 1.2.0 rc1
>
> Attachments: 0001-Return-correct-metadata-when-preparing-map.txt, 0002-Fix-prepared-list-index-and-using-integer-for-map-keys.txt, 0003-Fix-handling-of-prepared-marker-for-deletes.txt
>
>
> CQL3, binary protocol.
> collections (id int primary key, amap map<int, varchar>);
> preparing "UPDATE test.collections SET amap[?] = ? WHERE id = ?" returns the following metadata:
> [{column,<<"test">>,<<"collections">>,<<"amap">>,
> {map,int,varchar}},
> {column,<<"test">>,<<"collections">>,<<"amap">>,
> {map,int,varchar}},
> {column,<<"test">>,<<"collections">>,<<"id">>,int}]
> Ideally it should return [int, varchar, int] types. Less ideally [{map, int, varchar}, int] and expect an encoded map with a single key-value pair. But certainly not what it currently returns.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (CASSANDRA-5017) Preparing UPDATE queries with
collections returns suboptimal metadata
Posted by "Aleksey Yeschenko (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CASSANDRA-5017?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Aleksey Yeschenko updated CASSANDRA-5017:
-----------------------------------------
Reviewer: iamaleksey
> Preparing UPDATE queries with collections returns suboptimal metadata
> ---------------------------------------------------------------------
>
> Key: CASSANDRA-5017
> URL: https://issues.apache.org/jira/browse/CASSANDRA-5017
> Project: Cassandra
> Issue Type: Bug
> Affects Versions: 1.2.0 beta 2
> Reporter: Aleksey Yeschenko
> Assignee: Sylvain Lebresne
> Priority: Minor
> Fix For: 1.2.0 rc1
>
> Attachments: 0001-Return-correct-metadata-when-preparing-map.txt, 0002-Fix-prepared-list-index-and-using-integer-for-map-keys.txt, 0003-Fix-handling-of-prepared-marker-for-deletes.txt
>
>
> CQL3, binary protocol.
> collections (id int primary key, amap map<int, varchar>);
> preparing "UPDATE test.collections SET amap[?] = ? WHERE id = ?" returns the following metadata:
> [{column,<<"test">>,<<"collections">>,<<"amap">>,
> {map,int,varchar}},
> {column,<<"test">>,<<"collections">>,<<"amap">>,
> {map,int,varchar}},
> {column,<<"test">>,<<"collections">>,<<"id">>,int}]
> Ideally it should return [int, varchar, int] types. Less ideally [{map, int, varchar}, int] and expect an encoded map with a single key-value pair. But certainly not what it currently returns.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (CASSANDRA-5017) Preparing UPDATE queries with
collections returns suboptimal metadata
Posted by "Sylvain Lebresne (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CASSANDRA-5017?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sylvain Lebresne updated CASSANDRA-5017:
----------------------------------------
Attachment: 0004-Update-validation-of-ListOperation.txt
Right, forgot to update the validation of ListType. Fourth patch attached to fix that.
> Preparing UPDATE queries with collections returns suboptimal metadata
> ---------------------------------------------------------------------
>
> Key: CASSANDRA-5017
> URL: https://issues.apache.org/jira/browse/CASSANDRA-5017
> Project: Cassandra
> Issue Type: Bug
> Affects Versions: 1.2.0 beta 2
> Reporter: Aleksey Yeschenko
> Assignee: Sylvain Lebresne
> Priority: Minor
> Fix For: 1.2.0 rc1
>
> Attachments: 0001-Return-correct-metadata-when-preparing-map.txt, 0002-Fix-prepared-list-index-and-using-integer-for-map-keys.txt, 0003-Fix-handling-of-prepared-marker-for-deletes.txt, 0004-Update-validation-of-ListOperation.txt
>
>
> CQL3, binary protocol.
> collections (id int primary key, amap map<int, varchar>);
> preparing "UPDATE test.collections SET amap[?] = ? WHERE id = ?" returns the following metadata:
> [{column,<<"test">>,<<"collections">>,<<"amap">>,
> {map,int,varchar}},
> {column,<<"test">>,<<"collections">>,<<"amap">>,
> {map,int,varchar}},
> {column,<<"test">>,<<"collections">>,<<"id">>,int}]
> Ideally it should return [int, varchar, int] types. Less ideally [{map, int, varchar}, int] and expect an encoded map with a single key-value pair. But certainly not what it currently returns.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (CASSANDRA-5017) Preparing UPDATE queries with
collections returns suboptimal metadata
Posted by "Sylvain Lebresne (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CASSANDRA-5017?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sylvain Lebresne updated CASSANDRA-5017:
----------------------------------------
Attachment: 0003-Fix-handling-of-prepared-marker-for-deletes.txt
0002-Fix-prepared-list-index-and-using-integer-for-map-keys.txt
0001-Return-correct-metadata-when-preparing-map.txt
Attaching 3 small patches that fixes a number of problems with prepared queries and collections, including this one, the fact that you weren't allowed to prepare a list index and the fact that delete wasn't working correctly when either a list index or a map key was prepared.
I note we have a small "problem" for the metadata return in all those cases, in that if you do
{noformat}
UPDATE foo SET amap[?] = ? WHERE ...
{noformat}
then it's unclear what name to return for the prepared variables in the metadata. The choice made by the patch is to return 'key(amap)' and 'value(amap)' respectively (and when preparing a list index, we return 'index(alist)').
> Preparing UPDATE queries with collections returns suboptimal metadata
> ---------------------------------------------------------------------
>
> Key: CASSANDRA-5017
> URL: https://issues.apache.org/jira/browse/CASSANDRA-5017
> Project: Cassandra
> Issue Type: Bug
> Affects Versions: 1.2.0 beta 2
> Reporter: Aleksey Yeschenko
> Assignee: Sylvain Lebresne
> Priority: Minor
> Attachments: 0001-Return-correct-metadata-when-preparing-map.txt, 0002-Fix-prepared-list-index-and-using-integer-for-map-keys.txt, 0003-Fix-handling-of-prepared-marker-for-deletes.txt
>
>
> CQL3, binary protocol.
> collections (id int primary key, amap map<int, varchar>);
> preparing "UPDATE test.collections SET amap[?] = ? WHERE id = ?" returns the following metadata:
> [{column,<<"test">>,<<"collections">>,<<"amap">>,
> {map,int,varchar}},
> {column,<<"test">>,<<"collections">>,<<"amap">>,
> {map,int,varchar}},
> {column,<<"test">>,<<"collections">>,<<"id">>,int}]
> Ideally it should return [int, varchar, int] types. Less ideally [{map, int, varchar}, int] and expect an encoded map with a single key-value pair. But certainly not what it currently returns.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CASSANDRA-5017) Preparing UPDATE queries with
collections returns suboptimal metadata
Posted by "Aleksey Yeschenko (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CASSANDRA-5017?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13510595#comment-13510595 ]
Aleksey Yeschenko commented on CASSANDRA-5017:
----------------------------------------------
Everything works now (prepared and unprepared). +1
> Preparing UPDATE queries with collections returns suboptimal metadata
> ---------------------------------------------------------------------
>
> Key: CASSANDRA-5017
> URL: https://issues.apache.org/jira/browse/CASSANDRA-5017
> Project: Cassandra
> Issue Type: Bug
> Affects Versions: 1.2.0 beta 2
> Reporter: Aleksey Yeschenko
> Assignee: Sylvain Lebresne
> Priority: Minor
> Fix For: 1.2.0 rc1
>
> Attachments: 0001-Return-correct-metadata-when-preparing-map.txt, 0002-Fix-prepared-list-index-and-using-integer-for-map-keys.txt, 0003-Fix-handling-of-prepared-marker-for-deletes.txt, 0004-Update-validation-of-ListOperation.txt
>
>
> CQL3, binary protocol.
> collections (id int primary key, amap map<int, varchar>);
> preparing "UPDATE test.collections SET amap[?] = ? WHERE id = ?" returns the following metadata:
> [{column,<<"test">>,<<"collections">>,<<"amap">>,
> {map,int,varchar}},
> {column,<<"test">>,<<"collections">>,<<"amap">>,
> {map,int,varchar}},
> {column,<<"test">>,<<"collections">>,<<"id">>,int}]
> Ideally it should return [int, varchar, int] types. Less ideally [{map, int, varchar}, int] and expect an encoded map with a single key-value pair. But certainly not what it currently returns.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira