caldempsey commented on code in PR #152:
URL: https://github.com/apache/spark-connect-go/pull/152#discussion_r2203031614
##########
spark/sql/types/arrow.go:
##########
@@ -68,6 +68,12 @@ func ReadArrowTableToRows(table arrow.Table) ([]Row, error) {
return result, nil
}
+func ReadArrowRecordToRows(record arrow.Record) ([]Row, error) {
+ table := array.NewTableFromRecords(record.Schema(),
[]arrow.Record{record})
+ defer table.Release()
+ return ReadArrowTableToRows(table)
+}
+
Review Comment:
Seems a bit inefficient to create a whole array.NewTableFromRecords. We
should be able to go straight from records to rows, but I've left this for
convenience sake.
##########
spark/client/base/base.go:
##########
@@ -48,5 +48,6 @@ type SparkConnectClient interface {
type ExecuteResponseStream interface {
ToTable() (*types.StructType, arrow.Table, error)
+ ToRecordBatches(ctx context.Context) (<-chan arrow.Record, <-chan
error, *types.StructType)
Review Comment:
Added so we can consume Apache Arrow record batches rather than the entire
table at once, in truth, ToTable should re-use private methods w/
ToRecordBatches, but I've avoided this to avoid breaking clients for now.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]