birschick-bq commented on code in PR #2729:
URL: https://github.com/apache/arrow-adbc/pull/2729#discussion_r2085804821
##########
go/adbc/driver/snowflake/statement.go:
##########
@@ -499,41 +516,58 @@ func (st *statement) ExecuteQuery(ctx context.Context)
(array.RecordReader, int6
st.streamBind = nil
rdr := concatReader{}
- err := rdr.Init(&bind)
+ err = rdr.Init(&bind)
if err != nil {
- return nil, -1, err
+ return
}
- return &rdr, -1, nil
+ reader = &rdr
+ return
}
- loader, err := st.cnxn.cn.QueryArrowStream(ctx, st.query)
+ var loader gosnowflake.ArrowStreamLoader
+ loader, err = st.cnxn.cn.QueryArrowStream(ctx, st.query)
if err != nil {
- return nil, -1, errToAdbcErr(adbc.StatusInternal, err)
+ err = errToAdbcErr(adbc.StatusInternal, err)
+ return
}
- rdr, err := newRecordReader(ctx, st.alloc, loader, st.queueSize,
st.prefetchConcurrency, st.useHighPrecision)
- nrec := loader.TotalRows()
- return rdr, nrec, err
+ reader, err = newRecordReader(ctx, st.alloc, loader, st.queueSize,
st.prefetchConcurrency, st.useHighPrecision)
+ nRows = loader.TotalRows()
+ return
}
// ExecuteUpdate executes a statement that does not generate a result
// set. It returns the number of rows affected if known, otherwise -1.
-func (st *statement) ExecuteUpdate(ctx context.Context) (int64, error) {
+func (st *statement) ExecuteUpdate(ctx context.Context) (numRows int64, err
error) {
+ numRows = -1
+
+ var span trace.Span
+ ctx, span = st.StartSpan(ctx, "ExecuteUpdate")
ctx = st.setQueryContext(ctx)
+ defer func() {
+ if !st.SetErrorOnSpan(span, err) {
+
span.SetAttributes(attribute.Int64("db.response.returned_rows", numRows))
Review Comment:
@lidavidm
Negative numbers are not a problem ...
```
{
"Name": "ExecuteUpdate",
...
"StartTime": "2025-05-09T17:05:17.9897545-07:00",
"EndTime": "2025-05-09T17:05:18.3767651-07:00",
"Attributes": [
{
"Key": "db.response.returned_rows",
"Value": { "Type": "INT64", "Value": -1 }
}
],
...
}
```
Again, I'd suggest that this output would not be used to be read by an
automated system. It would be intended for human review.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]