yes, that's what I thought. but, when I use these forms,
INSERT ... ['A']
INSERT ... ['B']

The data is actually appended. not overwritten.
so I guess this is something unexpected?

Thanks,
Aoi

2016-10-12 20:55 GMT-07:00 Vladimir Yudovin <vla...@winguzone.com>:
> If you use form
> INSERT ... ['A']
> INSERT ... ['B']
>
> latest INSERT will overwrite first, because this insert the whole list. It's
> better to use UPDATE like:
> UPDATE ... SET events = events + ['A']
> UPDATE ... SET events = events + ['B']
> These operations add new elements to the end of existing list.
>
>
> From here https://docs.datastax.com/en/cql/3.0/cql/cql_using/use_list_t.html
> :
>
> These update operations are implemented internally without any
> read-before-write. Appending and prepending a new element to the list writes
> only the new element.
>
>
> Best regards, Vladimir Yudovin,
> Winguzone - Hosted Cloud Cassandra on Azure and SoftLayer.
> Launch your cluster in minutes.
>
>
> ---- On Wed, 12 Oct 2016 17:39:46 -0400Aoi Kadoya <cadyan....@gmail.com>
> wrote ----
>
> Hi,
>
> When inserting different data into a list type column from different
> clients at the same time, is data supposed to be combined into one
> list?
>
> For example, if these 2 queries were requested from clients at the
> same timing, how events list should look like after?
>
> INSERT INTO cycling.upcoming_calendar (year, month, events) VALUES
> (2015, 06, ['A']);
> INSERT INTO cycling.upcoming_calendar (year, month, events) VALUES
> (2015, 06, ['B']);
>
> In my understanding, each operation should be treated as atomic, which
> makes me think that even if client throw the queries at the same time,
> cassandra would take them separately and the last insert would update
> the events list. (= data should be either ['A'] or ['B'])
>
> In my environment, I found that some data was saved as like ['A',B']
> in the case like above.
> Is this expected behavior of list data type?
>
> I am still new to cassandra and trying to make myself understood how
> this happened.
> Appreciate if you could help me with figuring this out!
>
> Thanks,
> Aoi
>
>

Reply via email to