Note that there are some explanatory texts on larger screens.

plurals
  1. POAstyanax map data access cql3
    primarykey
    data
    text
    <p>I'm trying to access a map column type using Astyanax. From the examples I've taken the following. I'm looping the rows and can get the data from all the columns except the column storename which has datatype MAP. I assume I need to loop over the elements of the map to get the data into my object but I can't figure out how to do get the map data from the column. </p> <p>I'm trying column.getValue and have tried getByteBuffer but can't get either to work. I can get a column object and I see there is a ColumnMap interface but I can't figure out how to get the data into an object that extends or uses it. I also see a MapSerializer interfaces but not sure how to implement that either...</p> <pre><code> List&lt;Store&gt; stores = new ArrayList&lt;Store&gt;(); for (Row&lt;Integer, String&gt; row : result.getResult().getRows()) { Store store = new Store(); ColumnList&lt;String&gt; columns = row.getColumns(); store.setStoreID(columns.getStringValue("store_id", null)); store.setShopName(columns.getStringValue("shopname", null)); // lost trying to get the columns Map data here // should I loop the map or pass the data straight to my store object as a map? // How do I access the map data in this column? for ( Map&lt;String, String&gt; map : columns.getValue("storename", imap, result).getResult() ) { store.setStoreNames( "lang", "storename"); } stores.add(store); } </code></pre> <p>I'm a bit confused with getValue() as it takes a Serializer as it's 2nd argument and a default as it's 3rd. How do I pass the MapSerializer in as the 2nd argument or should I even be using getValue() method? Is the default a key value from the Map? If I want to return all values in the map what then? Thanks.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload