Hi John,

please see the attached diff for a quick fix which works at least for me.
However, as I do not have a good understanding of the code base, it should
not be used as a patch directly.

Thanks for your help!

Patrik


On Thu, Feb 7, 2013 at 6:57 PM, K. John Wu <[email protected]> wrote:

> Hi, Patrik,
>
> Thanks for the explanation.  Looks like we have not exercised the code
> path you are using.  We will look into fixing this problem shortly and
> get back to you in a day or two.
>
> John
>
>
> On 2/6/13 11:55 PM, Patrik Nisen wrote:
> > Hi John,
> >
> > sorry for not being clear enough, I tried to explain the paths on the
> > code level to help to understand the problem.
> >
> > Indeed, if I got it correctly, ibis.cpp uses table::dump (and further
> > column::dump) to print out the values, which does the conversion,
> > whereas cursor using cursor::fillRow is not. Please see the referenced
> > points of code to see the difference.
> >
> > I understood that the reason for this issue is:
> > - when constructing a table (bord in this case), CATEGORY column is
> > converted into an UINT column with an attached dictionary
> > - cursor::fillRow only sees this UINT column, but is not doing the
> > conversion if a dictionary is present
> >
> > Is this correct? If so, is there a reason for not doing the conversion
> > in this phase?
> >
> > The other question is, if the dictionary is used only for CATEGORY
> > columns. If so, could I just check if the dictionary is present and
> > put the converted values into the vectors holding category values,
> > instead of the uint vectors?
> >
> > Hope this clarifies the issue.
> >
> > Thanks!
> >
> > Patrik
> >
> >
> > On Wed, Feb 6, 2013 at 5:52 PM, K. John Wu <[email protected]
> > <mailto:[email protected]>> wrote:
> >
> >     Hi, Patrik,
> >
> >     I am not sure that I understand your question.  My guess is that
> >     ibis.cpp seems to know how to get back the strings, but your own
> >     program does not.  Is that right?  Or maybe, the cursor class you are
> >     using somehow couldn't get a pointer to the dictionary object?  If
> >     this is the case, then the thing to do is to figure out a way to pass
> >     the pointer to the column object within the cursor object.
> >
> >     In general, using integer representation for strings is a more
> >     efficient especially when there are only a few distinct values.
> >
> >     Please clarify.  Feel free to send us a sample code if your question
> >     could be boiled down to a small piece of code.
> >
> >     John
> >
> >
> >     On 2/6/13 6:37 AM, Patrik Nisen wrote:
> >     > Hi,
> >     >
> >     > I have a text column, which fastbit converted into a category
> column
> >     > when building indexes due to the relatively low cardinality. I am
> >     > trying to access the data through the table interface, iterating
> the
> >     > results with a cursor object. However, the cursor returns only the
> >     > integer representation instead of the original text value.
> Executing
> >     > the same query with the ibis tool seems to be working fine.
> >     >
> >     > I tried to understand the issue and here's what I found, please
> >     > correct me if I got this wrong.
> >     >
> >     > I construct the table myself using the bord class. The constructor
> >     > goes through the select clause and creates the columns for the
> >     table.
> >     > In case of a category column (starting from bord.cpp:186) it
> >     converts
> >     > the column to UINT and sets the dictionary for conversion. The
> >     data is
> >     > then appended to the table.
> >     >
> >     > When I want to iterate through the results, I create a cursor
> object
> >     > and use fetch method to populate a row. However, in cursor::fillRow
> >     > the loop only finds the UINT column and fills in the integer value
> >     > (bord.cpp:11148). The ibis tool seems to work, because the
> >     > column::dump checks if a dictionary is present and uses that if
> >     > available (bord.cpp:2301).
> >     >
> >     > How could this be fixed? Is it fine to fill the catsnames and
> >     > catsvalues if the column is UINT and a dictionary is present, or is
> >     > there other uses for the dictionary as well?
> >     >
> >     > Thank you.
> >     >
> >     > Best regards
> >     >
> >     > Patrik Nisen
> >     >
> >     >
> >     >
> >     >
> >     > _______________________________________________
> >     > FastBit-users mailing list
> >     > [email protected] <mailto:[email protected]>
> >     > https://hpcrdm.lbl.gov/cgi-bin/mailman/listinfo/fastbit-users
> >     >
> >
> >
>

Attachment: cursor-category.diff
Description: Binary data

_______________________________________________
FastBit-users mailing list
[email protected]
https://hpcrdm.lbl.gov/cgi-bin/mailman/listinfo/fastbit-users

Reply via email to