-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial DataChunk API support #233
Initial DataChunk API support #233
Conversation
Nice! A few suggestions on the public interface. Perhaps
|
@ajzo90, good call, I've made them private. Do you have any other suggestions? |
Small question, is there a reason projection support wasn't added? If not could this still be added via another PR? and if yet should we make a new type to support projection? |
Also for table functions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I am just reviewing this now, I wasn't aware of the PR and didn't have any time to review this week. In the case these need to be fixed, maybe a fix PR would be appropriate?
This PR introduces a new
DataChunk
API. See the discussion here. Ideally, all interaction between go-duckdb and duckdb's data chunks eventually goes through this API without compromising performance. As an outlook, in #219, I further used this API for go-duckdb's scanner.As a first step, this PR moves all interaction between the
Appender
and data chunks to theDataChunk
API and its setter functions, further decreasing the complexity of theAppender
code.This PR adds the following functions:
func (chunk *DataChunk) InitFromTypes(ptr unsafe.Pointer, types []C.duckdb_logical_type) error
func (chunk *DataChunk) Destroy()
func (chunk *DataChunk) SetSize() error
func (chunk *DataChunk) SetValue(colIdx int, rowIdx int, val any) error
Additionally, I reverted the column index in the data chunk when returning an unsupported type error message to 0-based indexing.
Questions
helper.go
file. However, I recommend renaming this file or moving its functions to a different place. What do you think?DataChunk
, and by implication, thevector
structs are becoming universal components without ties to theAppender
. Thus, I renamedappender_vector.go
tovector.go
. Also, I added a new file,vector_setters.go
, to create some functionality separation and decrease file sizes. Is this a good approach?