{"id":22152153,"url":"https://github.com/findinpath/cassandra-select-distinct-partition-keys","last_synced_at":"2026-04-25T16:34:21.221Z","repository":{"id":112790725,"uuid":"219617111","full_name":"findinpath/cassandra-select-distinct-partition-keys","owner":"findinpath","description":"Demo on how to select the distinct partition keys of a Cassandra table","archived":false,"fork":false,"pushed_at":"2019-11-05T23:15:24.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T13:27:22.106Z","etag":null,"topics":["cassandra","distinct-partition-keys","testcontainers"],"latest_commit_sha":null,"homepage":"https://www.findinpath.com/distinct-cassandra-partition-keys/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/findinpath.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-04T23:36:58.000Z","updated_at":"2019-11-07T22:31:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"1391944b-eaf0-460b-91f9-21ce4f3fa9ed","html_url":"https://github.com/findinpath/cassandra-select-distinct-partition-keys","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/findinpath/cassandra-select-distinct-partition-keys","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/findinpath%2Fcassandra-select-distinct-partition-keys","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/findinpath%2Fcassandra-select-distinct-partition-keys/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/findinpath%2Fcassandra-select-distinct-partition-keys/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/findinpath%2Fcassandra-select-distinct-partition-keys/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/findinpath","download_url":"https://codeload.github.com/findinpath/cassandra-select-distinct-partition-keys/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/findinpath%2Fcassandra-select-distinct-partition-keys/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32269462,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-25T09:15:33.318Z","status":"ssl_error","status_checked_at":"2026-04-25T09:15:31.997Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cassandra","distinct-partition-keys","testcontainers"],"created_at":"2024-12-02T00:47:27.209Z","updated_at":"2026-04-25T16:34:21.204Z","avatar_url":"https://github.com/findinpath.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"Demo on how to select the distinct partition keys of a table\n============================================================\n\n\nThis is a simple showcase on how to select all the distinct partition keys\nfrom a Cassandra table.\n\n\nThere is also a corresponding [blog](https://www.findinpath.com/distinct-cassandra-partition-keys/) \npost for this project.\n\n\nThe way to select a page of distinct partition keys is summarized in the following code snippet:\n\n```java\nprivate ResultSet getDistinctUserIdsBatch(Session session, Optional\u003cUUID\u003e lastUserIdProcessed,\n        int batchSize) {\n    var batchedDistinctUserSelect = QueryBuilder.select(USER_ID_COLUMN_NAME)\n            .distinct()\n            .from(DEMO_KEYSPACE_NAME, USER_BOOKMARKS_TABLE_NAME);\n\n    lastUserIdProcessed.ifPresent(\n            uuid -\u003e batchedDistinctUserSelect.where(gt(token(USER_ID_COLUMN_NAME), token(uuid))));\n\n    batchedDistinctUserSelect.limit(batchSize);\n\n    return session.execute(batchedDistinctUserSelect);\n}\n``` \n\n\nThe project contains a unit test which spawns a Cassandra \ncontainer (via [testcontainers](https://www.testcontainers.org/) library)\n, fills it with data (user bookmarks) and then selects all the distinct user ids\nfrom the table in a page fashion. ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffindinpath%2Fcassandra-select-distinct-partition-keys","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffindinpath%2Fcassandra-select-distinct-partition-keys","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffindinpath%2Fcassandra-select-distinct-partition-keys/lists"}