From 5e4bf1e72368a0d4da71d3080d24bb996fb508d0 Mon Sep 17 00:00:00 2001 From: Curt Hagenlocher Date: Mon, 6 Oct 2025 07:25:48 -0700 Subject: [PATCH] Feedback from previous PR Apply feedback from PR for previous commit: mark method as obsolete now instead of waiting and fix comment. --- src/Apache.Arrow.Flight/Internal/SchemaWriter.cs | 5 +++-- src/Apache.Arrow/ArrowSerializationHelpers.cs | 2 +- .../FlightSqlPreparedStatementTests.cs | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Apache.Arrow.Flight/Internal/SchemaWriter.cs b/src/Apache.Arrow.Flight/Internal/SchemaWriter.cs index 8ca4cee..b4315a3 100644 --- a/src/Apache.Arrow.Flight/Internal/SchemaWriter.cs +++ b/src/Apache.Arrow.Flight/Internal/SchemaWriter.cs @@ -13,6 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; using Apache.Arrow.Flight; using Google.Protobuf; @@ -20,7 +21,7 @@ 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 : @@ -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); diff --git a/src/Apache.Arrow/ArrowSerializationHelpers.cs b/src/Apache.Arrow/ArrowSerializationHelpers.cs index 88cab52..4d6d81b 100644 --- a/src/Apache.Arrow/ArrowSerializationHelpers.cs +++ b/src/Apache.Arrow/ArrowSerializationHelpers.cs @@ -58,7 +58,7 @@ public static byte[] SerializeRecordBatch(RecordBatch recordBatch) } /// - /// This class handles writing schemas + /// Helper useful when writing just individual parts of the Arrow IPC format. /// internal class SchemaWriter : ArrowStreamWriter { diff --git a/test/Apache.Arrow.Flight.Sql.Tests/FlightSqlPreparedStatementTests.cs b/test/Apache.Arrow.Flight.Sql.Tests/FlightSqlPreparedStatementTests.cs index 3e40293..2fc4a2e 100644 --- a/test/Apache.Arrow.Flight.Sql.Tests/FlightSqlPreparedStatementTests.cs +++ b/test/Apache.Arrow.Flight.Sql.Tests/FlightSqlPreparedStatementTests.cs @@ -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 });