4 ms·
Go team does acknowledge [1] it as a bug, so there is some point here However, that said, I wonder if OP (duckdb) could have written their solution [2] differe
by harikb 3y ago
Go team does acknowledge [1] it as a bug, so there is some point here
However, that said, I wonder if OP (duckdb) could have written their solution [2] differently. Shouldn't they be able to select from a Pipe as well as Error channel simultaneously? (similar to how they are doing it inside here [3]). If not, I would have create a go-routine that does blocking read on the Pipe and then pass it on to another channel to select on.
[1] https://github.com/golang/go/issues/66239 https://github.com/golang/go/issues/66239
[2] https://github.com/scratchdata/scratchdata/blob/7c1a0fcd0e202126c581924c3bee2b1b2b10335d/pkg/destinations/duckdb/query.go#L14 https://github.com/scratchdata/scratchdata/blob/7c1a0fcd0e20...
[3] https://github.com/scratchdata/scratchdata/blob/7c1a0fcd0e202126c581924c3bee2b1b2b10335d/pkg/destinations/duckdb/query.go#L94 https://github.com/scratchdata/scratchdata/blob/7c1a0fcd0e20...
- memset 3y agoI’m not sure you can. Both the Open() and Read() calls will block. You can select() on a pipe but not on open. I haven’t checked to see if you can select on a non blocking fd though. This is what the go wrappers do behind the scenes.