Skip to content
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

Inappropriate process fetch command #26

Closed
Darlez opened this issue Jul 21, 2021 · 1 comment · Fixed by #27
Closed

Inappropriate process fetch command #26

Darlez opened this issue Jul 21, 2021 · 1 comment · Fixed by #27
Labels
bug Unwanted / harmful behavior

Comments

@Darlez
Copy link

Darlez commented Jul 21, 2021

I am trying to get big query response and encounter problem: if results doesn't fit in one fetch I get panic: runtime error: index out of range [18725] with length 18725 (number depends on fetchsize property)

goroutine 1 [running]:
github.com/exasol/exasol-driver-go.(*queryResults).Next(0xc000030200, 0xc0002d0320, 0xa, 0xa, 0x1866da0, 0x197eb01)
       ./mod/github.com/exasol/exasol-driver-go@v0.0.0-20210713141110-54f0a9140b6c/result_set.go:106 +0x4a5

After some research I discovered the root of issue, I guess. In ./result_set.go in func (results *queryResults) Next(dest []driver.Value) there is code

result := &SQLQueryResponseResultSetData{}
err := results.con.send(context.Background(), &FetchCommand{
	Command:         Command{"fetch"},
	ResultSetHandle: results.data.ResultSetHandle,
	StartPosition:   results.rowPointer,
	NumBytes:        results.con.config.FetchSize,
}, result)
if err != nil {
	return err
}

results.fetchedRows = results.fetchedRows + result.NumRowsInMessage

But, according fetch command structure, response doesn't have NumRowsInMessage field, and thereby application panic, if result set doesn't fit in on fetch.
I suppose, we need change result.NumRowsInMessage -> result.NumRows and that's all, but I am not so good in low-level driver implementation, so please, check it by yourself and correct me, if I am wrong.

@Nightapes Nightapes added bug Unwanted / harmful behavior source:external labels Jul 22, 2021
Nightapes added a commit that referenced this issue Jul 22, 2021
@Nightapes
Copy link
Contributor

@Darlez Thank you for reporting the bug and the solution.
We created a fix and release a new version soon.

Nightapes added a commit that referenced this issue Jul 22, 2021
* * #26 fix fetch command

* test: use own schema for fetch itest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unwanted / harmful behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants