Ok, here is a workaround
[though I suspect that performance is going to degrade (with respect to
CHAR column for example[1]) because BUNtail is being called for each row...]
sql_column *col = mvc_bind_column(m, tbl, colname[icol]);
BAT *b = table_funcs.full_column(m->session->tr, col); //read the entire
column into continuous memory on the tail heap of the BAT b
BATiter *iterators = NULL;
blob *blob_record;
int ib;
iterators = GDKzalloc(sizeof(BATiter));
iterators[0] = bat_iterator(b); // blob column iterator
for (irow=0; irow < nrow; irow++) {
blob_record = (blob*) BUNtail(iterators[0], irow);
for (ib=0; ib < blob_record->nitems; ib++) {
printf("blob data = %c, %02x\n", blob_record->data[ib],
blob_record->data[ib]);
}
}
p.s.
[1]
//For CHAR column it would look like this:
sql_column *col = mvc_bind_column(m, tbl, colname[icol]);
BAT *b = table_funcs.full_column(m->session->tr, col); //read the entire
column into continuous memory on the tail heap of the BAT b
char *tvbase, *cptr;
unsigned char *readucrows;
tvbase = (char *) b->T.vheap->base + GDK_VAROFFSET;
readucrows = (unsigned char *) b->T.heap.base;
for (irow=0; irow < nrow; irow++) {
cptr = tvbase + *readucrows++;
}
Anton
On Fri, Nov 10, 2017 at 4:13 PM, Anton Kravchenko <
kravchenko.anton86(a)gmail.com> wrote:
> I wonder how one would read BLOB column and loop over its rows?
>
> BAT *b = table_funcs.full_column(m->session->tr, blob_col_name);
> //blob *readblobrows = (blob*) b->T.heap.base;
> //unsigned char *readblobrows = (unsigned char*) b->T.heap.base;
>
> p.s.
> For INT column it would be go like this:
> int * readintrows = (int *) b->T.heap.base;
> for (irow=0; irow < nrow; irow++) {
> intvalue = *readintrows++;
> }
>
> Thanks,
> Anton
>
Dear developers of MonetDB,
I hope you are the right recipients of this mail that can help us in getting some more insights into MonetDB’s Code.
Currently, me and my student (Florian) want to integrate our index structure Elf (www.elf.ovgu.de <http://www.elf.ovgu.de/>) into MonetDB as a proof of concept and to show its competitiveness to fast main-memory scans. However, we’ve got a hard time to understand some part of the code — we hope that you could help us with this.
While the kernel (gdk) is well documented, we hardly find any documentation that may help us in answering the following questions:
Which function takes care of filling the BATs when inserting into a table (i.e., sql_table/sql_rel)?
COPY INTO creates a MAL-procedure copy_into, which is preparing the copy, but does not finally execute the copy. Which function is executed for this?
Regarding ChangeSets: what is dset and nelm used for?
Any pointer or explanation for these questions would be great!
Regards,
David and Florian
M.Sc. David Broneske
Otto-von-Guericke-Universität Magdeburg
Department of Technical and Business Information Systems <http://wwwiti.cs.uni-magdeburg.de/>
Databases and Software Engineering <http://wwwiti.cs.uni-magdeburg.de/iti_db/index_en.php>
P.O. Box 4120, D-39016 Magdeburg, Germany
Office: Building 29, Room112
Tel: +49 391 67-52994 <tel:+49 391 67-52994> Fax: +49 391 67-12020 <fax:+49 391 67-12020>