Skip to content

Commit

Permalink
Add test to verify concurrent write operations
Browse files Browse the repository at this point in the history
  • Loading branch information
rickykaare authored and aloneguid committed Oct 12, 2021
1 parent bde95a6 commit 058d409
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/Parquet.Test/Rows/RowsModelTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Parquet.Data;
using Parquet.Data.Rows;
Expand Down Expand Up @@ -58,6 +59,37 @@ public void Flat_write_read()
Assert.True(table.Equals(table2, true));
}

[Fact]
public async Task Flat_concurrent_write_read()
{
var schema = new Schema(
new DataField<int>("id"),
new DataField<string>("city"));

var inputTables = new List<Table>();
for (int i = 0; i < 10; i++)
{
var table = new Table(schema);
for (int j = 0; j < 10; j++)
{
table.Add(new Row(i, $"record#{i},{j}"));
}

inputTables.Add(table);
}

var tasks = inputTables
.Select(t => Task.Run(() => WriteRead(t)))
.ToArray();

var outputTables = await Task.WhenAll(tasks);

for (int i = 0; i < inputTables.Count; i++)
{
Assert.True(inputTables[i].Equals(outputTables[i], true));
}
}

#endregion

#region [ Array Tables ]
Expand Down

0 comments on commit 058d409

Please sign in to comment.