Hi John,
As you mentioned the problem was the the function dump() as well as
get getColumnAsString() from cursor class neglected to check the
presence of dictionary. I coped the code to handle UINT values from
mensa.cpp class:. Rest is just refactoring to use same code base for
dump() as well as getColumnAsString() method.
case ibis::UINT: {
+ const array_t<const uint32_t>* vals =
+ static_cast<const array_t<const uint32_t>*>(column.cval);
+ if (column.dic == 0) {
+ out << (*vals)[i];
}
+ else if ((*vals)[i] > column.dic->size()) {
+ out << (*vals)[i];
+ }
+ else if ((*vals)[i] > 0) {
+ out << '"' << (*column.dic)[(*vals)[i]] << '"';
+ }
+ break;
}
cheers,
gaurav
On Fri, Jul 6, 2012 at 10:56 PM, K. John Wu <[email protected]> wrote:
> Hi, Gaurav,
>
> The problem is not likely due to the printing function dump. Your
> changes are not obviously different what were there before. A
> CATEGORICAL value is internally turned into uint32_t when you select
> over it. This was a feature requested by a number of users earlier.
> Processing CATEGORICAL values as integers is quite a bit more
> efficient than processing them as the strings. The problem might be
> that the function dump neglected to check for the presence of a
> dictionary, or maybe the cursor class has not implemented support for
> this new feature yet. I will look into it as soon as I finish with
> the current bunch of changes.
>
> Thanks.
>
> John
>
>
>
>
> On 7/4/12 10:47 AM, Gaurav Agarwal wrote:
>> Hi John,
>>
>> I found few issues with dump()ing a cursor row as string (and also
>> with cursor::getColumnAsString() method). I encountered this when the
>> table contained a CATEGORY and an unbinned equality index created over
>> it (I did not try to reproduce this with other kind of index). These
>> methods were returning the dictionary index of the cell value in the
>> CATEGORY column and not the actual value itself.
>>
>> I've created a patch for it and am attaching it here for your review.
>> Pls let me know if this is the best way to do this or if any changes
>> are needed to the patch. I've also done some code refactoring to
>> remove code duplication between cursor::dump() and
>> cursor::getColumnAsString() methods.
>>
>> -gaurav
>>
>>
>>
>> _______________________________________________
>> FastBit-users mailing list
>> [email protected]
>> https://hpcrdm.lbl.gov/cgi-bin/mailman/listinfo/fastbit-users
>>
>
_______________________________________________
FastBit-users mailing list
[email protected]
https://hpcrdm.lbl.gov/cgi-bin/mailman/listinfo/fastbit-users