1

Is it possible to create a Cassandra table with GeoMesa specifying keys (ie - a composite key)? I have a spark job that writes to Cassandra and a composite key is necessary for the output table. I would now like to create/write that same table somehow through the GeoMesa api instead of directly to Cassandra. The format is like this:

CREATE TABLE IF NOT EXISTS mykeyspace.testcompkey (pkey1 text, ckey1 int, attr1 int, attr2 int, minlat decimal, minlong decimal, maxlat decimal, maxlong decimal, updatetime text, PRIMARY KEY((pkey1), ckey1) )

Is this possible? You can see also in the create table statement that I have a partition key and a clustering key. From what I have read, I believe Geoserver does support both Simple and Complex features. I am just wondering if that support also maps over into the realm of Cassandra with GeoMesa?

Thank you

1 Answers1

2

GeoMesa does use composite partition and clustering keys for Cassandra tables, but the keys are not configurable by the user - they are designed to facilitate spatial/temporal/attribute CQL queries.

Keys can be seen in the index table implementations here. The columns field (for example here) defines the primary keys. Columns with partition = true are used for partitioning, the rest are used for clustering.

Emilio Lahr-Vivaz
  • 1,439
  • 6
  • 5
  • You can also see the create table statements logged at info level when you create a new schema (`dataStore.createSchema`) – Emilio Lahr-Vivaz Feb 01 '18 at 15:53
  • Ok so whatever row format that you want to write to GeoMesa has to be without keys, correct? Just flat if you will, because GeoMesa appends it's own keys to the row before writing to Cassandra – user1930364 Feb 01 '18 at 18:40
  • Yes, you interact with it through the geotools API, so you define your data as a `SimpleFeatureType`, which is basically flat. GeoMesa will create multiple tables with different keys to support different query patterns. – Emilio Lahr-Vivaz Feb 01 '18 at 19:04
  • Ok thank you very much for the information, greatly appreciated – user1930364 Feb 01 '18 at 19:27