Skip to content

Commit

Permalink
handle decimals, floats and doubles
Browse files Browse the repository at this point in the history
  • Loading branch information
Rachid Boukaiba authored and aloneguid committed Dec 13, 2023
1 parent 3d63a92 commit 4edf100
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Parquet/Extensions/StringBuilderExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Globalization;
using System.Text;
using Parquet.Rows;
using Parquet.Schema;
Expand Down Expand Up @@ -120,6 +121,15 @@ private static void EncodeJson(StringBuilder sb, StringFormat sf, object? value)
sb.Append(quote);
sb.Append(Convert.ToBase64String((byte[])value));
sb.Append(quote);
}
else if(t == typeof(decimal)) {
sb.Append(((decimal)value).ToString(CultureInfo.InvariantCulture));
}
else if(t == typeof(float)) {
sb.Append(((float)value).ToString(CultureInfo.InvariantCulture));
}
else if(t == typeof(double)) {
sb.Append(((double)value).ToString(CultureInfo.InvariantCulture));
}
else {
sb.Append(value.ToString());
Expand Down

0 comments on commit 4edf100

Please sign in to comment.