Skip to content

Commit

Permalink
Proving #573 is not an issue
Browse files Browse the repository at this point in the history
  • Loading branch information
aloneguid committed Nov 25, 2024
1 parent d43e357 commit 4be70e0
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/Parquet.Test/Serialisation/ParquetSerializerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1078,5 +1078,28 @@ public async Task Class_With_Nullable_Struct() {

Assert.Equivalent(data2, data);
}

class EdgeCaseInt32 {
public int Id { get; set; }
}

[Fact]
public async Task EdgeCase_rawint64_to_classInt32() {
var schema = new ParquetSchema(new DataField<long>("Id"));
using var ms = new MemoryStream();
using(ParquetWriter writer = await ParquetWriter.CreateAsync(schema, ms)) {
using(ParquetRowGroupWriter rg = writer.CreateRowGroup()) {
await rg.WriteColumnAsync(new DataColumn(schema.DataFields[0], new long[] { 1, 2, 3 }));
}
}
ms.Position = 0;

IList<EdgeCaseInt32> data = await ParquetSerializer.DeserializeAsync<EdgeCaseInt32>(ms);

Assert.Equal(1, data[0].Id);
Assert.Equal(2, data[1].Id);
Assert.Equal(3, data[2].Id);

}
}
}

0 comments on commit 4be70e0

Please sign in to comment.