# Regarding selecting map index from a table

**URL:** <https://forum.scylladb.com/t/regarding-selecting-map-index-from-a-table/4197>\
**Category:** ScyllaDB\
**Tags:** data-model, java-driver, udt\
**Created:** [December 16, 2024, 7:22pm UTC](https://forum.scylladb.com/t/regarding-selecting-map-index-from-a-table/4197 "2024-12-16T19:22:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Neeraj\_Chatterjee](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.scylladb.com/neeraj_chatterjee/32/1232_2.png) [@Neeraj\_Chatterjee](https://forum.scylladb.com/u/Neeraj_Chatterjee)\
**Post date:** [December 16, 2024, 7:22pm UTC](https://forum.scylladb.com/t/regarding-selecting-map-index-from-a-table/4197/1 "2024-12-16T19:22:15Z")

</div>

I am using this version :  
`[cqlsh 6.1.0 | Cassandra 3.0.8 | CQL spec 3.3.1 | Native protocol v4]`  
and have this following udt and table schema :

```auto
CREATE TYPE notificationstore.fcm_details (
    app_version_code int,
    client_type text,
    created_at bigint,
    updated_at bigint
);

```

```auto
CREATE TABLE anonymous_fcm_record (
    user_id text PRIMARY KEY,
    fcm_detail_map map<text, frozen<fcm_details>>
) WITH compaction = {
    'class': 'SizeTieredCompactionStrategy'
};

```

I want to use this CQL query in ScyllaDB Java driver (fetch the fcm\_details for the provided userId and fcmToken) :

```auto
SELECT fcm_detail_map[:fcmToken]
FROM anonymous_fcm_record
WHERE user_id = :userId

```

By creating this Select query and SimpleStatement :

```auto
 Select selectQuery = QueryBuilder.selectFrom("anonymous_fcm_record")
                .element(CqlIdentifier.fromCql("fcm_detail_map"), QueryBuilder.bindMarker("fcmToken"))
                .whereColumn("user_id").isEqualTo(QueryBuilder.bindMarker("user_id"));

        return selectQuery.build();

```

I also tried using `Selector` in-place of `CqlIdentifier`.

But in both the scenarios I was getting this error :  
`no viable alternative at input 'fcm_detail_map'`

Is it possible to serve the use-case with the existing version or any further releases or it’s not yet supported in ScyllaDB?

---

<div class="post-metadata">

**Author:** ![Neeraj\_Chatterjee](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.scylladb.com/neeraj_chatterjee/32/1232_2.png) [@Neeraj\_Chatterjee](https://forum.scylladb.com/u/Neeraj_Chatterjee)\
**Post date:** [December 17, 2024, 1:00pm UTC](https://forum.scylladb.com/t/regarding-selecting-map-index-from-a-table/4197/2 "2024-12-17T13:00:10Z")

</div>

I am using `com.datastax.oss.driver.api.core` driver in java.

---

<div class="post-metadata">

**Author:** ![Dmitry\_Kropachev](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.scylladb.com/dmitry_kropachev/32/1467_2.png) [@Dmitry\_Kropachev](https://forum.scylladb.com/u/Dmitry_Kropachev)\
**Post date:** [April 15, 2025, 10:41am UTC](https://forum.scylladb.com/t/regarding-selecting-map-index-from-a-table/4197/3 "2025-04-15T10:41:11Z")

</div>

You should have been using `Selector.column` instead of `CqlIdentifier.fromCql`:

```auto
 Select selectQuery = QueryBuilder.selectFrom("anonymous_fcm_record")
                .element(Selector.column("fcm_detail_map"), QueryBuilder.bindMarker("fcmToken"))
                .whereColumn("user_id").isEqualTo(QueryBuilder.bindMarker("user_id"));

        return selectQuery.build();

```
