Zixi Wang created ARROW-15051:
---------------------------------

             Summary: [C#] Not nullable field can have null values
                 Key: ARROW-15051
                 URL: https://issues.apache.org/jira/browse/ARROW-15051
             Project: Apache Arrow
          Issue Type: Bug
          Components: C#
    Affects Versions: 6.0.1
            Reporter: Zixi Wang


When the record batch schema field's parameter of nullable is set to false, it 
supposes to make the field not null, however, it can still have null values.

 

Code to produce:

            var memoryAllocator = new NativeMemoryAllocator(alignment: 64);
            var stream1 = File.OpenWrite(@"c:\temp\data\test.arrow");
            
            Schema schema = new Schema
            (new List<Field>
            {
                new Field("Column A", StringType.Default, false)
            },
            default
            );

            List<string> rows = new List<string>();
            rows.Add("11");
            rows.Add("22");
            rows.Add(null);

            ArrowFileWriter writer = new ArrowFileWriter(stream1, schema);

            var recordBatch1 = new RecordBatch.Builder(memoryAllocator)
                .Append("Column A", false, col => col.String(array => 
array.AppendRange(rows)))
                .Build();
            writer.WriteRecordBatch(recordBatch1);
            writer.WriteEnd();
            stream1.Close();



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to