Skip to content

High level API with array properties #421

Answered by adamreeve
Pragmateek asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @Pragmateek, you can use the Column API with array values. For example, this works:

var columns = new Column[]
{
    new Column<int[]>("int_arrays"),
    new Column<string[]>("string_arrays"),
};

using var writer = new ParquetFileWriter(outputPath, columns);
using var rowGroupWriter = writer.AppendRowGroup();

using var intArrayWriter = rowGroupWriter.NextColumn().LogicalWriter<int[]>();
intArrayWriter.WriteBatch(new int[][]
{
    new [] {0, 1, 2},
    new [] {3, 4},
    new [] {5, 6, 7, 8},
});

using var stringArrayWriter = rowGroupWriter.NextColumn().LogicalWriter<string[]>();
stringArrayWriter.WriteBatch(new string[][]
{
    new [] {"abc", "def"},
    new [] {"ghi"},
    new [] {"…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Pragmateek
Comment options

Answer selected by Pragmateek
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants