Skip to content

Commit

Permalink
test for reflecting nullable TimeOnly
Browse files Browse the repository at this point in the history
  • Loading branch information
aloneguid committed Feb 2, 2024
1 parent f0f9901 commit d8febde
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/release-history.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

### Bug fixes

Fixed regression in schema discovery of nullables.
Fixed regression in schema discovery of nullables for `DateTime`, `DateOnly`, `TimeOnly`.

## 4.23.3

Expand Down
13 changes: 13 additions & 0 deletions src/Parquet.Test/Serialisation/SchemaReflectorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,8 @@ class DatesPoco {

public TimeOnly DefaultTimeOnly { get; set; }

public TimeOnly? DefaultNullableTimeOnly { get; set; }

[ParquetMicroSecondsTime]
public TimeOnly MicroTimeOnly { get; set; }

Expand Down Expand Up @@ -422,6 +424,17 @@ public void Type_TimeOnly_Default() {
DataField df = s.FindDataField(nameof(DatesPoco.DefaultTimeOnly));
Assert.True(df is TimeOnlyDataField);
Assert.Equal(TimeSpanFormat.MilliSeconds, ((TimeOnlyDataField)df).TimeSpanFormat);
Assert.False(df.IsNullable);
}

[Fact]
public void Type_TimeOnly_Nullable() {
ParquetSchema s = typeof(DatesPoco).GetParquetSchema(true);

DataField df = s.FindDataField(nameof(DatesPoco.DefaultNullableTimeOnly));
Assert.True(df is TimeOnlyDataField);
Assert.Equal(TimeSpanFormat.MilliSeconds, ((TimeOnlyDataField)df).TimeSpanFormat);
Assert.True(df.IsNullable);
}

[Fact]
Expand Down

0 comments on commit d8febde

Please sign in to comment.