Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ParquetWriter Nullable Types #317

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/ChoETL.Parquet/ChoParquetRecordWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,6 @@ private Type GetParquetTypeInternal(Type type, bool asRaw = false)
return typeof(string);
else if (underlyingType.IsEnum)
return typeof(string);
else if (asRaw && type.IsNullableType())
return typeof(string);
else if (type == typeof(byte[]))
return underlyingType;
else if (type == typeof(DateTimeOffset))
Expand All @@ -262,7 +260,11 @@ private Type GetParquetTypeInternal(Type type, bool asRaw = false)
return typeof(DateTimeOffset);
}
else if (underlyingType.IsSimpleSpecial())
{
if (type.IsNullableType())
return type;
return underlyingType;
}
else
return typeof(string);
}
Expand Down
8 changes: 4 additions & 4 deletions src/Test/ChoParquetWriterTest/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1570,21 +1570,21 @@ public static void POCOTreatDateTimeAsDateTimeOffsetTestWith_NO_Converter()
{
""Id"": null,
""Price"": null,
""Quantity"": ""2"",
""Quantity"": 2.0,
""Name"": null,
""CreateDate"": ""0001-01-01T12:00:00+00:00""
},
{
""Id"": ""100"",
""Id"": 100,
""Price"": null,
""Quantity"": null,
""Name"": null,
""CreateDate"": ""0001-01-01T12:00:00+00:00""
},
{
""Id"": null,
""Price"": ""2.3"",
""Quantity"": ""2.45"",
""Price"": 2.3,
""Quantity"": 2.45,
""Name"": ""Name"",
""CreateDate"": ""2023-06-10T12:10:30+00:00""
}
Expand Down