Get All Counters

Oct 23, 2011 at 6:06 PM

Hi Folks,

So I my system I´m creating several counters and there is a moment that I need to get all counter. In this moment I run this command

var query = from x in context.CounterColumnList where x.ColumnFamily == "System_Counters" select x;

That´s ok. It give me the counters.

But it only give me 100 counts and I would like all counts.

How can I remove the top 100 limitation?

Thanks for your help.

Coordinator
Oct 23, 2011 at 9:06 PM

Default of column count is 100. It followed thrift api.

If you want to get more than 100 column, use TakeColumn method. Next code will get 1000 column.

var query = from x in context.CounterColumnList where x.ColumnFamily == "System_Counters" select x;
foreach(var entity in query.TakeColumn(1000))
{
    // write your code
}

Oct 23, 2011 at 9:07 PM

Ok sabro,

But there is any way to Take All?

Coordinator
Oct 23, 2011 at 9:33 PM

You can't get more than int.MaxValue columns. Because SliceRange.Count is int. You should write next code.

query.TakeColumn(int.MaxValue);

Oct 24, 2011 at 6:06 PM

Ok sabro, it solved my problems but it still smell bad .. lol ...

I was wondering, the TakeWhile didn´t solve this problem?

Coordinator
Oct 24, 2011 at 6:31 PM

LINQ Expression of Cassandraemon is transformed into calling thrift api.

Therefore SliceRange.Count is used every time.

Sep 13, 2013 at 9:04 PM
Hi!

We are using the 1.0 version, and the TakeColumn is not working well... I guess... This code brings only 100 counts.
                var records = (from x in context.ColumnList
                               where x.ColumnFamily == "Feeds"
                               select x).TakeColumn(1000);
On the other hand, if I use just Take(1000), it works fine!
                var records = (from x in context.ColumnList
                               where x.ColumnFamily == "Feeds"
                               select x).Take(1000);
Is it right?