Skip to content
Merged
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
20 changes: 17 additions & 3 deletions csharp/src/Apache.Arrow.Flight/FlightInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,22 @@ internal FlightInfo(Protocol.FlightInfo flightInfo)

TotalBytes = flightInfo.TotalBytes;
TotalRecords = flightInfo.TotalRecords;
Ordered = flightInfo.Ordered;
AppMetadata = flightInfo.AppMetadata;
}
public FlightInfo(Schema schema, FlightDescriptor descriptor, IReadOnlyList<FlightEndpoint> endpoints, long totalRecords = -1, long totalBytes = -1):this(schema,descriptor,endpoints,totalRecords,totalBytes,false, ByteString.Empty)
{
}

public FlightInfo(Schema schema, FlightDescriptor descriptor, IReadOnlyList<FlightEndpoint> endpoints, long totalRecords = -1, long totalBytes = -1)
public FlightInfo(Schema schema, FlightDescriptor descriptor, IReadOnlyList<FlightEndpoint> endpoints, long totalRecords, long totalBytes, bool ordered = false, ByteString appMetadata=null)
{
Schema = schema;
Descriptor = descriptor;
Endpoints = endpoints;
TotalBytes = totalBytes;
TotalRecords = totalRecords;
Ordered = ordered;
AppMetadata = appMetadata ?? ByteString.Empty;
}

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

public long TotalRecords { get; }

public bool Ordered { get; }

public ByteString AppMetadata { get; }

public IReadOnlyList<FlightEndpoint> Endpoints { get; }

internal Protocol.FlightInfo ToProtocol()
{
var serializedSchema = Schema != null ? SchemaWriter.SerializeSchema(Schema) : ByteString.Empty;

var response = new Protocol.FlightInfo()
{
Schema = serializedSchema,
FlightDescriptor = Descriptor.ToProtocol(),
TotalBytes = TotalBytes,
TotalRecords = TotalRecords
TotalRecords = TotalRecords,
Ordered = Ordered,
AppMetadata = AppMetadata
};

foreach(var endpoint in Endpoints)
foreach (var endpoint in Endpoints)
{
response.Endpoint.Add(endpoint.ToProtocol());
}
Expand Down
5 changes: 5 additions & 0 deletions csharp/test/Apache.Arrow.Flight.Tests/FlightInfoComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ public static void Compare(FlightInfo expected, FlightInfo actual)
Assert.Equal(expected.TotalBytes, actual.TotalBytes);

Assert.Equal(expected.TotalRecords, actual.TotalRecords);

Assert.Equal(expected.Ordered, actual.Ordered);

Assert.Equal(expected.AppMetadata, actual.AppMetadata);

}
}
}