-
Notifications
You must be signed in to change notification settings - Fork 179
Description
It appears that there's an issue in accessing data returned by a query containing groupArray().
I have a table which contains a nested array named "eventz". The following is part of the create statement as returned by the "show create table" command:
eventz.EventCode` Array(UInt16) CODEC(LZ4HC(9)), `eventz.EventCnt` Array(UInt32) CODEC(LZ4HC(9)))
Trying the following query from the command-line clickhouse-client works just fine:
SELECT groupArray((`eventz.EventCode`, `eventz.EventCnt`)) from db1.tupletest array join eventz group by cl limit 10;
It returns:
┌─groupArray(tuple(eventz.EventCode, eventz.EventCnt))───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ [(123,10),(456,100),(789,1000),(123,10),(456,100),(789,1000),(123,10),(456,100),(789,1000),(123,10),(456,100),(789,1000)] │
│ [(123,10),(456,100),(789,1000),(123,10),(456,100),(789,1000)]
...
However, from a C++ application using the Clickhouse C++ client library, I get a NULL pointer when I try calling GetAsColumn(). Consider the following code:
client.Select("SELECT groupArray((`eventz.EventCode`, `eventz.EventCnt`)) from db1.tupletest array join eventz group by cl limit 10", [] (const Block& block) mutable
{
size_t rows = block.GetRowCount();
for (int i=0; i < rows; i++){
std::cout << block[0]->As<ColumnArray>() << "\n";
std::cout << block[0]->As<ColumnArray>()->Size() << "\n";
std::cout << block[0]->As<ColumnArray>()->GetAsColumn(i);
...
Returns the following:
0x105d6c0
10
0
...
As you can see, GetAsColumn returned 0 (NULL) instead of a correct pointer.