You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Ron Sher <ro...@gmail.com> on 2013/01/23 08:17:44 UTC

looking for best practice for using thrift's scannerGet for scanning rows in a loop

Hi,

I'm using thrift through c#.

I'm trying to scan rows using the code below.
The problem is that an extra scannerGet throws IOException, instead of
returning null or an empty List.
Am I missing something?
What is the recommended way to do that?

Thanks,
Ron

                TScan scan = new TScan
                                 {
                                     StartRow =
"siteID=104908\0comb=1\0date=20130120\0cid=\0".GetBytes(),
                                     FilterString =
                                         "InclusiveStopFilter
('siteID=104908\0comb=1\0date=20130121\0cid=\0')"
                                         .GetBytes()
                                 };
                int scannerOpenWithScan =
conn.scannerOpenWithScan(TableName.GetBytes(), scan, null);

                List<TRowResult> scannerGet =
conn.scannerGet(scannerOpenWithScan);
                while (scannerGet != null && scannerGet.Count > 0)
                {
                    TRowResult row = scannerGet[0];

                    Console.WriteLine("key:" + row.Row.GetString());

                    Console.WriteLine("Columns:");
                    foreach (var column in row.Columns)
                    {
                        Console.WriteLine("key:" + column.Key.GetString());
                        byte[] valueAsHostOrder = column.Value.Value;
                        Array.Reverse(valueAsHostOrder);
                        Console.WriteLine("value:" +
GetFromBytes(column.Value.Value));
                    }
                    scannerGet = conn.scannerGet(scannerOpenWithScan);
                }

Re: looking for best practice for using thrift's scannerGet for scanning rows in a loop

Posted by Stack <st...@duboce.net>.
On Tue, Jan 22, 2013 at 11:17 PM, Ron Sher <ro...@gmail.com> wrote:

> scannerGet


Did you get your code from study of what is in src/examples/thrift ?

St.Ack