This is an automated email from the ASF dual-hosted git repository.

zeroshade pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 1550c95  ARROW-7901: [Go][Integration] enable integration tests for 
null case
1550c95 is described below

commit 1550c95f2cd9c9366c5814590cb3178d5a229d1e
Author: Matthew Topol <[email protected]>
AuthorDate: Wed Oct 13 17:35:37 2021 -0400

    ARROW-7901: [Go][Integration] enable integration tests for null case
    
    Closes #11392 from zeroshade/arrow-7901-null
    
    Authored-by: Matthew Topol <[email protected]>
    Signed-off-by: Matthew Topol <[email protected]>
---
 dev/archery/archery/integration/datagen.py       |  2 --
 docs/source/status.rst                           |  2 +-
 go/arrow/flight/record_batch_writer.go           |  9 +++------
 go/arrow/internal/flight_integration/scenario.go |  2 ++
 go/arrow/ipc/writer.go                           | 15 +++++++--------
 5 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/dev/archery/archery/integration/datagen.py 
b/dev/archery/archery/integration/datagen.py
index 8a9f4de..2d90d6c 100644
--- a/dev/archery/archery/integration/datagen.py
+++ b/dev/archery/archery/integration/datagen.py
@@ -1563,12 +1563,10 @@ def get_generated_json_files(tempdir=None):
 
         generate_null_case([10, 0])
         .skip_category('C#')
-        .skip_category('Go')    # TODO(ARROW-7901)
         .skip_category('JS'),   # TODO(ARROW-7900)
 
         generate_null_trivial_case([0, 0])
         .skip_category('C#')
-        .skip_category('Go')    # TODO(ARROW-7901)
         .skip_category('JS'),   # TODO(ARROW-7900)
 
         generate_decimal128_case()
diff --git a/docs/source/status.rst b/docs/source/status.rst
index 39d4c66..e238048 100644
--- a/docs/source/status.rst
+++ b/docs/source/status.rst
@@ -30,7 +30,7 @@ Data Types
 | Data type         | C++   | Java  | Go    | JavaScript | C#    | Rust  | 
Julia |
 | (primitive)       |       |       |       |            |       |       |     
  |
 
+===================+=======+=======+=======+============+=======+=======+=======+
-| Null              | ✓     | ✓     |       |            |       |  ✓    | ✓   
  |
+| Null              | ✓     | ✓     | ✓     |            |       |  ✓    | ✓   
  |
 
+-------------------+-------+-------+-------+------------+-------+-------+-------+
 | Boolean           | ✓     | ✓     | ✓     | ✓          |  ✓    |  ✓    | ✓   
  |
 
+-------------------+-------+-------+-------+------------+-------+-------+-------+
diff --git a/go/arrow/flight/record_batch_writer.go 
b/go/arrow/flight/record_batch_writer.go
index 857b125..b3e114a 100644
--- a/go/arrow/flight/record_batch_writer.go
+++ b/go/arrow/flight/record_batch_writer.go
@@ -58,23 +58,20 @@ func (f *flightPayloadWriter) Close() error { return nil }
 // are written.
 type Writer struct {
        *ipc.Writer
-       pw   *flightPayloadWriter
-       desc *FlightDescriptor
+       pw *flightPayloadWriter
 }
 
 // SetFlightDescriptor sets the flight descriptor into the next payload that 
will
 // be written by the flight writer. It will only be put into the very next 
payload
 // and afterwards the writer will no longer keep it's pointer to the 
descriptor.
 func (w *Writer) SetFlightDescriptor(descr *FlightDescriptor) {
-       w.desc = descr
+       w.pw.fd.FlightDescriptor = descr
 }
 
 // Write writes a recordbatch payload and returns any error, implementing the 
arrio.Writer interface
 func (w *Writer) Write(rec array.Record) error {
-       if w.desc != nil {
-               w.pw.fd.FlightDescriptor = w.desc
+       if w.pw.fd.FlightDescriptor != nil {
                defer func() {
-                       w.desc = nil
                        w.pw.fd.FlightDescriptor = nil
                }()
        }
diff --git a/go/arrow/internal/flight_integration/scenario.go 
b/go/arrow/internal/flight_integration/scenario.go
index 32e5006..afe4505 100644
--- a/go/arrow/internal/flight_integration/scenario.go
+++ b/go/arrow/internal/flight_integration/scenario.go
@@ -189,6 +189,8 @@ func (s *defaultIntegrationTester) RunClient(addr string, 
opts ...grpc.DialOptio
                }
        }
 
+       wr.Close()
+
        if err := stream.CloseSend(); err != nil {
                return err
        }
diff --git a/go/arrow/ipc/writer.go b/go/arrow/ipc/writer.go
index 020601f..e1f0b4d 100644
--- a/go/arrow/ipc/writer.go
+++ b/go/arrow/ipc/writer.go
@@ -332,18 +332,17 @@ func (w *recordEncoder) visit(p *Payload, arr 
array.Interface) error {
                Offset: 0,
        })
 
+       if arr.DataType().ID() == arrow.NULL {
+               return nil
+       }
+
        switch arr.NullN() {
        case 0:
                p.body = append(p.body, nil)
        default:
-               switch arr.DataType().ID() {
-               case arrow.NULL:
-                       // Null type has no validity bitmap
-               default:
-                       data := arr.Data()
-                       bitmap := newTruncatedBitmap(w.mem, 
int64(data.Offset()), int64(data.Len()), data.Buffers()[0])
-                       p.body = append(p.body, bitmap)
-               }
+               data := arr.Data()
+               bitmap := newTruncatedBitmap(w.mem, int64(data.Offset()), 
int64(data.Len()), data.Buffers()[0])
+               p.body = append(p.body, bitmap)
        }
 
        switch dtype := arr.DataType().(type) {

Reply via email to