{"action":"created","issue":{"url":"https://api.github.com/repos/scylladb/scylla/issues/1446","repository_url":"https://api.github.com/repos/scylladb/scylla","labels_url":"https://api.github.com/repos/scylladb/scylla/issues/1446/labels{/name}","comments_url":"https://api.github.com/repos/scylladb/scylla/issues/1446/comments","events_url":"https://api.github.com/repos/scylladb/scylla/issues/1446/events","html_url":"https://github.com/scylladb/scylla/issues/1446","id":164884139,"number":1446,"title":"Row slicing may give wrong answers for compact tables with non-full clustering keys","user":{"login":"tgrabiec","id":283695,"avatar_url":"https://avatars.githubusercontent.com/u/283695?v=3","gravatar_id":"","url":"https://api.github.com/users/tgrabiec","html_url":"https://github.com/tgrabiec","followers_url":"https://api.github.com/users/tgrabiec/followers","following_url":"https://api.github.com/users/tgrabiec/following{/other_user}","gists_url":"https://api.github.com/users/tgrabiec/gists{/gist_id}","starred_url":"https://api.github.com/users/tgrabiec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tgrabiec/subscriptions","organizations_url":"https://api.github.com/users/tgrabiec/orgs","repos_url":"https://api.github.com/users/tgrabiec/repos","events_url":"https://api.github.com/users/tgrabiec/events{/privacy}","received_events_url":"https://api.github.com/users/tgrabiec/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/scylladb/scylla/labels/bug","name":"bug","color":"eb6420"}],"state":"open","locked":false,"assignee":{"login":"haaawk","id":1311149,"avatar_url":"https://avatars.githubusercontent.com/u/1311149?v=3","gravatar_id":"","url":"https://api.github.com/users/haaawk","html_url":"https://github.com/haaawk","followers_url":"https://api.github.com/users/haaawk/followers","following_url":"https://api.github.com/users/haaawk/following{/other_user}","gists_url":"https://api.github.com/users/haaawk/gists{/gist_id}","starred_url":"https://api.github.com/users/haaawk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haaawk/subscriptions","organizations_url":"https://api.github.com/users/haaawk/orgs","repos_url":"https://api.github.com/users/haaawk/repos","events_url":"https://api.github.com/users/haaawk/events{/privacy}","received_events_url":"https://api.github.com/users/haaawk/received_events","type":"User","site_admin":false},"assignees":[{"login":"haaawk","id":1311149,"avatar_url":"https://avatars.githubusercontent.com/u/1311149?v=3","gravatar_id":"","url":"https://api.github.com/users/haaawk","html_url":"https://github.com/haaawk","followers_url":"https://api.github.com/users/haaawk/followers","following_url":"https://api.github.com/users/haaawk/following{/other_user}","gists_url":"https://api.github.com/users/haaawk/gists{/gist_id}","starred_url":"https://api.github.com/users/haaawk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haaawk/subscriptions","organizations_url":"https://api.github.com/users/haaawk/orgs","repos_url":"https://api.github.com/users/haaawk/repos","events_url":"https://api.github.com/users/haaawk/events{/privacy}","received_events_url":"https://api.github.com/users/haaawk/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/scylladb/scylla/milestones/15","html_url":"https://github.com/scylladb/scylla/milestones/1.4","labels_url":"https://api.github.com/repos/scylladb/scylla/milestones/15/labels","id":1794297,"number":15,"title":"1.4","description":"","creator":{"login":"tzach","id":170200,"avatar_url":"https://avatars.githubusercontent.com/u/170200?v=3","gravatar_id":"","url":"https://api.github.com/users/tzach","html_url":"https://github.com/tzach","followers_url":"https://api.github.com/users/tzach/followers","following_url":"https://api.github.com/users/tzach/following{/other_user}","gists_url":"https://api.github.com/users/tzach/gists{/gist_id}","starred_url":"https://api.github.com/users/tzach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tzach/subscriptions","organizations_url":"https://api.github.com/users/tzach/orgs","repos_url":"https://api.github.com/users/tzach/repos","events_url":"https://api.github.com/users/tzach/events{/privacy}","received_events_url":"https://api.github.com/users/tzach/received_events","type":"User","site_admin":false},"open_issues":73,"closed_issues":13,"state":"open","created_at":"2016-05-29T08:33:08Z","updated_at":"2016-08-29T12:16:50Z","due_on":null,"closed_at":null},"comments":9,"created_at":"2016-07-11T16:53:28Z","updated_at":"2016-08-29T14:54:32Z","closed_at":null,"body":"Reproducer:\r\n\r\n```\r\ncqlsh:ks1> create keyspace ks1 WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };\r\ncqlsh:ks1> create table test (pk int, ck1 int, ck2 int, v int, primary key (pk, ck1, ck2)) with compact storage;\r\ncqlsh:ks1> insert into ks1.test (pk, ck1, v) values (1, 1, 0);\r\ncqlsh:ks1> insert into ks1.test (pk, ck1, v) values (1, 2, 0);\r\ncqlsh:ks1> insert into ks1.test (pk, ck1, v) values (1, 3, 0);\r\ncqlsh:ks1> insert into ks1.test (pk, ck1, ck2, v) values (1, 1, 1, 0);\r\ncqlsh:ks1> insert into ks1.test (pk, ck1, ck2, v) values (1, 2, 1, 0);\r\ncqlsh:ks1> insert into ks1.test (pk, ck1, ck2, v) values (1, 3, 1, 0);\r\ncqlsh:ks1> select * from ks1.test where pk = 1 and ck1 = 1 and ck2 >= 1;\r\n\r\n pk | ck1 | ck2  | v\r\n----+-----+------+---\r\n  1 |   1 | null | 0\r\n  1 |   1 |    1 | 0\r\n\r\n(2 rows)\r\n```\r\n\r\nExpected result:\r\n```\r\n\r\n pk | ck1 | ck2  | v\r\n----+-----+------+---\r\n  1 |   1 |    1 | 0\r\n\r\n(1 rows)\r\n```\r\n\r\nThe problem is that prefix equality comparator, used for slicing, doesn't partition keys properly if there are prefixes among the partitioned keys. In the example above where we have keys (1) and (1,1) and a slice with inclusive starting bound of (1, 1), doing lower_bound will return both keys because both are equal to (1,1) in prefix equality.\r\n\r\nWe could fix the problem by using heterogenous comparator, which would treat prefixes in the range differently than prefix in the partitioned sequence. The latter would be treated as if they were full keys with missing components comparing less than anything."},"comment":{"url":"https://api.github.com/repos/scylladb/scylla/issues/comments/243148422","html_url":"https://github.com/scylladb/scylla/issues/1446#issuecomment-243148422","issue_url":"https://api.github.com/repos/scylladb/scylla/issues/1446","id":243148422,"user":{"login":"tgrabiec","id":283695,"avatar_url":"https://avatars.githubusercontent.com/u/283695?v=3","gravatar_id":"","url":"https://api.github.com/users/tgrabiec","html_url":"https://github.com/tgrabiec","followers_url":"https://api.github.com/users/tgrabiec/followers","following_url":"https://api.github.com/users/tgrabiec/following{/other_user}","gists_url":"https://api.github.com/users/tgrabiec/gists{/gist_id}","starred_url":"https://api.github.com/users/tgrabiec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tgrabiec/subscriptions","organizations_url":"https://api.github.com/users/tgrabiec/orgs","repos_url":"https://api.github.com/users/tgrabiec/repos","events_url":"https://api.github.com/users/tgrabiec/events{/privacy}","received_events_url":"https://api.github.com/users/tgrabiec/received_events","type":"User","site_admin":false},"created_at":"2016-08-29T14:54:32Z","updated_at":"2016-08-29T14:54:32Z","body":"Different `bound_kind` would also work, and is in fact less intrusive."}}
{"actor":{"display_login":"tgrabiec"}}