Skip to content

Commit b2a9f98

Browse files
cmettlerChristoph Mettler
and
Christoph Mettler
authored
GH-45752: [C#] Update FlightInfo.cs with missing fields (#45753)
### What changes are included in this PR? add ordered and AppMetaData to FlightInfo.cs [#45752](#45752) ### Are these changes tested? YES ### Are there any user-facing changes? NO * GitHub Issue: #45752 Lead-authored-by: Christoph <[email protected]> Co-authored-by: Christoph Mettler <[email protected]> Signed-off-by: Curt Hagenlocher <[email protected]>
1 parent aac110d commit b2a9f98

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

csharp/src/Apache.Arrow.Flight/FlightInfo.cs

+17-3
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,22 @@ internal FlightInfo(Protocol.FlightInfo flightInfo)
3838

3939
TotalBytes = flightInfo.TotalBytes;
4040
TotalRecords = flightInfo.TotalRecords;
41+
Ordered = flightInfo.Ordered;
42+
AppMetadata = flightInfo.AppMetadata;
43+
}
44+
public FlightInfo(Schema schema, FlightDescriptor descriptor, IReadOnlyList<FlightEndpoint> endpoints, long totalRecords = -1, long totalBytes = -1):this(schema,descriptor,endpoints,totalRecords,totalBytes,false, ByteString.Empty)
45+
{
4146
}
4247

43-
public FlightInfo(Schema schema, FlightDescriptor descriptor, IReadOnlyList<FlightEndpoint> endpoints, long totalRecords = -1, long totalBytes = -1)
48+
public FlightInfo(Schema schema, FlightDescriptor descriptor, IReadOnlyList<FlightEndpoint> endpoints, long totalRecords, long totalBytes, bool ordered = false, ByteString appMetadata=null)
4449
{
4550
Schema = schema;
4651
Descriptor = descriptor;
4752
Endpoints = endpoints;
4853
TotalBytes = totalBytes;
4954
TotalRecords = totalRecords;
55+
Ordered = ordered;
56+
AppMetadata = appMetadata ?? ByteString.Empty;
5057
}
5158

5259
public FlightDescriptor Descriptor { get; }
@@ -57,20 +64,27 @@ public FlightInfo(Schema schema, FlightDescriptor descriptor, IReadOnlyList<Flig
5764

5865
public long TotalRecords { get; }
5966

67+
public bool Ordered { get; }
68+
69+
public ByteString AppMetadata { get; }
70+
6071
public IReadOnlyList<FlightEndpoint> Endpoints { get; }
6172

6273
internal Protocol.FlightInfo ToProtocol()
6374
{
6475
var serializedSchema = Schema != null ? SchemaWriter.SerializeSchema(Schema) : ByteString.Empty;
76+
6577
var response = new Protocol.FlightInfo()
6678
{
6779
Schema = serializedSchema,
6880
FlightDescriptor = Descriptor.ToProtocol(),
6981
TotalBytes = TotalBytes,
70-
TotalRecords = TotalRecords
82+
TotalRecords = TotalRecords,
83+
Ordered = Ordered,
84+
AppMetadata = AppMetadata
7185
};
7286

73-
foreach(var endpoint in Endpoints)
87+
foreach (var endpoint in Endpoints)
7488
{
7589
response.Endpoint.Add(endpoint.ToProtocol());
7690
}

csharp/test/Apache.Arrow.Flight.Tests/FlightInfoComparer.cs

+5
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ public static void Compare(FlightInfo expected, FlightInfo actual)
3434
Assert.Equal(expected.TotalBytes, actual.TotalBytes);
3535

3636
Assert.Equal(expected.TotalRecords, actual.TotalRecords);
37+
38+
Assert.Equal(expected.Ordered, actual.Ordered);
39+
40+
Assert.Equal(expected.AppMetadata, actual.AppMetadata);
41+
3742
}
3843
}
3944
}

0 commit comments

Comments
 (0)