pitrou commented on code in PR #37904:
URL: https://github.com/apache/arrow/pull/37904#discussion_r1338687214
##########
csharp/test/Apache.Arrow.IntegrationTest/JsonFile.cs:
##########
@@ -25,12 +33,199 @@ public class JsonFile
public JsonSchema Schema { get; set; }
public List<JsonRecordBatch> Batches { get; set; }
//public List<DictionaryBatch> Dictionaries {get;set;}
+
+ public static async ValueTask<JsonFile> ParseAsync(FileInfo fileInfo)
+ {
+ using var fileStream = fileInfo.OpenRead();
+ var options = GetJsonOptions();
+ return await JsonSerializer.DeserializeAsync<JsonFile>(fileStream,
options);
+ }
+
+ public static JsonFile Parse(FileInfo fileInfo)
+ {
+ using var fileStream = fileInfo.OpenRead();
+ var options = GetJsonOptions();
+ return JsonSerializer.Deserialize<JsonFile>(fileStream, options);
+ }
+
+ private static JsonSerializerOptions GetJsonOptions()
+ {
+ JsonSerializerOptions options = new JsonSerializerOptions()
+ {
+ PropertyNamingPolicy = JsonFileNamingPolicy.Instance,
+ };
+ options.Converters.Add(new ValidityConverter());
+ return options;
+ }
}
public class JsonSchema
{
public List<JsonField> Fields { get; set; }
public JsonMetadata Metadata { get; set; }
+
+ /// <summary>
Review Comment:
Note that all this below is moved from `IntegrationCommand.cs` in order for
it to be available to the integration testing harness.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]