kelindar / column

High-performance, columnar, in-memory store with bitmap indexing in Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

check for dynamic columns

Crayzero opened this issue · comments

Hey, recently i have found this awesome project.
When in my situation, there came to the cases where the column is dynamic, eg: add another column after insert some records.
Then when ranging over all the records. query a column on an old record, it could cause panic.
Could you export the columnAt function for Txn or is there any method to check where a column is exists.

You could range through a list of column names inside of a txn.Range call, such as -

collection.Query(func(txn *column.Txn) error {
        return txn.Range(func (i uint32) {
            row_obj := make(column.Object)
            for _, sel := range selectors {
                value, _ := txn.Any(sel).Get()
                row_obj[sel] = value
            }
            result_rows = append(result_rows, row_obj)
        })
        return nil
}

where selectors is a slice of column names (strings).