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
5 changes: 3 additions & 2 deletions src/Apache.Arrow.Flight/Internal/SchemaWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.

using System;
using Apache.Arrow.Flight;
using Google.Protobuf;

namespace Apache.Arrow.Flight
{
internal static class SchemaWriter
{
public static ByteString ToByteString(Schema schema)
public static ByteString ToByteString(this Schema schema)
{
return schema == null ?
ByteString.Empty :
Expand All @@ -32,7 +33,7 @@ public static ByteString ToByteString(Schema schema)
public static class SchemaExtension
{
// This should never have been a public class without a namespace
// TODO: Mark as obsolete once sufficient time has passed
[Obsolete("Use ArrowSerializationHelpers.SerializeSchema instead")]
public static ByteString ToByteString(this Apache.Arrow.Schema schema)
{
return SchemaWriter.ToByteString(schema);
Expand Down
2 changes: 1 addition & 1 deletion src/Apache.Arrow/ArrowSerializationHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public static byte[] SerializeRecordBatch(RecordBatch recordBatch)
}

/// <summary>
/// This class handles writing schemas
/// Helper useful when writing just individual parts of the Arrow IPC format.
/// </summary>
internal class SchemaWriter : ArrowStreamWriter
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ public async Task ParseResponseAsync_ShouldReturnPreparedStatement_WhenValidData
var actionResult = new ActionCreatePreparedStatementResult
{
PreparedStatementHandle = ByteString.CopyFrom(preparedStatementHandle, Encoding.UTF8),
DatasetSchema = _schema.ToByteString(),
ParameterSchema = _schema.ToByteString()
DatasetSchema = UnsafeByteOperations.UnsafeWrap(ArrowSerializationHelpers.SerializeSchema(_schema)),
ParameterSchema = UnsafeByteOperations.UnsafeWrap(ArrowSerializationHelpers.SerializeSchema(_schema)),
};
var flightData = new FlightData(_flightDescriptor, ByteString.CopyFrom(actionResult.ToByteArray()));
var results = GetAsyncEnumerable(new List<FlightData> { flightData });
Expand Down