CurtHagenlocher commented on code in PR #100:
URL: https://github.com/apache/arrow-dotnet/pull/100#discussion_r2406605451
##########
src/Apache.Arrow.Flight/Internal/SchemaWriter.cs:
##########
@@ -13,53 +13,28 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using Apache.Arrow.Flatbuf;
-using Apache.Arrow.Flight.Internal;
-using Apache.Arrow.Ipc;
+using Apache.Arrow.Flight;
using Google.Protobuf;
-namespace Apache.Arrow.Flight.Internal
+namespace Apache.Arrow.Flight
{
- /// <summary>
- /// This class handles writing schemas
- /// </summary>
- internal class SchemaWriter : ArrowStreamWriter
+ internal static class SchemaWriter
{
- internal SchemaWriter(Stream baseStream, Schema schema) :
base(baseStream, schema)
+ public static ByteString ToByteString(Schema schema)
{
- }
-
- public void WriteSchema(Schema schema, CancellationToken
cancellationToken)
- {
- var offset = base.SerializeSchema(schema);
- WriteMessage(MessageHeader.Schema, offset, 0);
- }
-
- public static ByteString SerializeSchema(Schema schema,
CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var memoryStream = new MemoryStream())
- {
- var writer = new SchemaWriter(memoryStream, schema);
- writer.WriteSchema(schema, cancellationToken);
-
- memoryStream.Position = 0;
- return ByteString.FromStream(memoryStream);
- }
+ return schema == null ?
+ ByteString.Empty :
+
UnsafeByteOperations.UnsafeWrap(ArrowSerializationHelpers.SerializeSchema(schema));
}
}
}
public static class SchemaExtension
{
- // Translate an Apache.Arrow.Schema to FlatBuffer Schema to ByteString
+ // This should never have been a public class without a namespace
+ // TODO: Mark as obsolete once sufficient time has passed
Review Comment:
Yeah; I'd been thinking that marking it obsolete would break binary
compatibility but of course that's not true so we may as well do it now.
--
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]