Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-10719

[C#] ArrowStreamWriter doesn't write schema metadata

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.0.0
    • C#

    Description

      See this TODO in the code:

      https://github.com/apache/arrow/blob/master/csharp/src/Apache.Arrow/Ipc/ArrowStreamWriter.cs#L445

       

      A simple test case:

       

      // Build schema
      var schemaBuilder = new Schema.Builder();
      schemaBuilder.Field(f => f
          .Name("Ints")
          .Nullable(true)
          .DataType(Int32Type.Default)
          .Metadata(new Dictionary<string, string> { { "packed", packed ? "true" : "false" } })
      );
      var indexMetadata = new Dictionary<string, string> { { "index", JsonConvert.SerializeObject(new object()) } };
      var schema = schemaBuilder.Metadata(indexMetadata).Build();
      Int32Array a = new Int32Array.Builder().Append(5).Append(4).Build();
      // Create record batch
      var recordBatch = new RecordBatch(schema, new IArrowArray[] { a }, a.Length);// Write recordbatch to file
      using (var stream = File.Create("visits.arrow"))
      using (var writer = new ArrowFileWriter(stream, recordBatch.Schema))
      {
          writer.WriteRecordBatch(recordBatch);
          writer.WriteEnd();
      }using (var stream = File.OpenRead("visits.arrow"))
      using (var reader = new ArrowFileReader(stream))
      {
          var batch = reader.ReadNextRecordBatch();
          Console.WriteLine(batch.Schema.HasMetadata);
      }
      

      The above should print `true`, but it prints `false` for HasMetadata.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              eerhardt Eric Erhardt
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 48h
                  48h
                  Remaining:
                  Time Spent - 1.5h Remaining Estimate - 46.5h
                  46.5h
                  Logged:
                  Time Spent - 1.5h Remaining Estimate - 46.5h
                  1.5h