You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "lidavidm (via GitHub)" <gi...@apache.org> on 2023/06/21 15:02:29 UTC

[GitHub] [arrow-adbc] lidavidm commented on a diff in pull request #828: fix(go/adbc/driver/snowflake): fix potential deadlock and error handling

lidavidm commented on code in PR #828:
URL: https://github.com/apache/arrow-adbc/pull/828#discussion_r1237155048


##########
go/adbc/driver/snowflake/record_reader.go:
##########
@@ -297,39 +298,41 @@ func newRecordReader(ctx context.Context, alloc memory.Allocator, ld gosnowflake
 	}
 
 	lastChannelIndex := len(chs) - 1
-	for i, b := range batches[1:] {
-		batch, batchIdx := b, i+1
-		chs[batchIdx] = make(chan arrow.Record, bufferSize)
-		group.Go(func() error {
-			// close channels (except the last) so that Next can move on to the next channel properly
-			if batchIdx != lastChannelIndex {
-				defer close(chs[batchIdx])
-			}
-
-			rdr, err := batch.GetStream(ctx)
-			if err != nil {
-				return err
-			}
-			defer rdr.Close()
+	go func() {

Review Comment:
   Do we need to do this for Flight SQL too?



##########
go/adbc/driver/snowflake/driver.go:
##########
@@ -162,7 +162,11 @@ func errToAdbcErr(code adbc.Status, err error) error {
 	if errors.As(err, &sferr) {
 		var sqlstate [5]byte
 		if len(sferr.SQLState) > 0 {
-			copy(sqlstate[:], sferr.SQLState[:5])
+			if len(sferr.SQLState) <= 5 {
+				copy(sqlstate[:], sferr.SQLState)
+			} else {
+				copy(sqlstate[:], sferr.SQLState[:5])

Review Comment:
   Is there any penalty to always just slicing?
   
   Should we embed SQLState into the error message always/if it's longer than 5?



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org