range on multiple columns in cassandra

no one

My table :

CREATE TABLE user_position (
  geopart text, // first 3 characters of geohash
  geohash text,
  datetime timestamp,
  userId bigint,
  PRIMARY KEY ((geopart), geohash, datetime, user_id)
);

My dummy query :

select * from user_position where geopart = 'abc' and geohash > 'a' and geohash < 'z' and datetime >= '2015-08-08 15:08:58+0530';

Error:

Bad Request: PRIMARY KEY column "datetime" cannot be restricted (preceding column "geohash" is restricted by a non-EQ relation)

Question:

What I am doing wrong? If range on multiple columns is not possible in Cassandra then how can I achieve this?

Alec Collier

Cassandra is quite restrictive when it comes to querying, in that it is not general purpose like a RDBMS. You cannot perform a range query on multiple columns in Cassandra. The following rules also apply:

  • If not doing a select all, you will need to provide the partition key so Cassandra can find the node with the data you're looking for
  • You can only filter on columns which are in the primary key (partition key and clustering columns)
  • The order of the columns in the primary key definition is important -- this is how Cassandra still store the data on disk
  • You can only filter on a clustering column if the 'previous' column is also filtered (in the order of the primary key definition)
  • Once you perform a range query, you cannot further filter on a subsequent clustering column

All of these rules are there to avoid people running anti-patterns within Cassandra.

One option you have to perform a range query on multiple columns and to have a more robust method of retrieving your data is to integrate with a search platform such as Solr.

Este artigo é coletado da Internet.

Se houver alguma infração, entre em [email protected] Delete.

editar em
0

deixe-me dizer algumas palavras

0comentários
loginDepois de participar da revisão

Artigos relacionados

TOP lista

  1. 1

    R Shiny: use HTML em funções (como textInput, checkboxGroupInput)

  2. 2

    UITextView não está exibindo texto longo

  3. 3

    Dependência circular de diálogo personalizado

  4. 4

    Acessando relatório de campanhas na AdMob usando a API do Adsense

  5. 5

    Como assinar digitalmente um documento PDF com assinatura e texto visíveis usando Java

  6. 6

    R Folheto. Dados de pontos de grupo em células para resumir muitos pontos de dados

  7. 7

    Setas rotuladas horizontais apontando para uma linha vertical

  8. 8

    O Chromium e o Firefox exibem as cores de maneira diferente e não sei qual deles está fazendo certo

  9. 9

    Definir um clipe em uma trama nascida no mar

  10. 10

    Por que meus intervalos de confiança de 95% da minha regressão multivariada estão sendo plotados como uma linha de loess?

  11. 11

    Como dinamizar um Dataframe do pandas em Python?

  12. 12

    regex para destacar novos caracteres de linha no início e no fim

  13. 13

    Why isn't my C# .Net Core Rest API route finding my method?

  14. 14

    Como obter a entrada de trás de diálogo em treeview pyqt5 python 3

  15. 15

    Tabela CSS: barra de rolagem para a primeira coluna e largura automática para a coluna restante

  16. 16

    How to create dynamic navigation menu select from database using Codeigniter?

  17. 17

    Como recuperar parâmetros de entrada usando C #?

  18. 18

    Changing long, lat values of Polygon coordinates in python

  19. 19

    Livros sobre criptografia do muito básico ao muito avançado

  20. 20

    Método \ "POST \" não permitido no framework Django rest com ações extras & ModelViewset

  21. 21

    Pesquisa classificada, conte números abaixo do valor desejado

quentelabel

Arquivo