CurtHagenlocher commented on code in PR #46190:
URL: https://github.com/apache/arrow/pull/46190#discussion_r2103039330
##########
csharp/src/Apache.Arrow/Ipc/ICompressionCodec.cs:
##########
@@ -44,5 +44,21 @@ void Compress(ReadOnlyMemory<byte> source, Stream
destination)
#else
;
#endif
+
+ /// <summary>
+ /// try to write compressed data to span
+ /// </summary>
+ /// <param name="source">The data to compress</param>
+ /// <param name="destination">Span to write compressed data to</param>
+ /// <param name="bytesWritten">The number of bytes written to the
destination</param>
+ /// <returns>true if compressed was successful, false if the
destination buffer is too small</returns>
+ bool TryCompress(ReadOnlyMemory<byte> source, Memory<byte>
destination, out int bytesWritten)
+#if NET6_0_OR_GREATER
+ {
+ throw new NotImplementedException("This codec does not support
compression");
Review Comment:
I just realized that I misunderstood what @adamreeve wrote, as you
acknowledge that this is breaking for downlevel .NET. I suspect that custom
implementations of `ICompressionCodec` are pretty rare, and am fighting to
square this with my dislike for breaking changes of any kind.
One approach to avoiding the break is to define a new interface
`ICompressionCodec2` which derives from `ICompressionCodec` and then adds the
member. The consuming code can then wrap any `ICompressionCodec` it gets with a
helper that implements `ICompressionCodec2`.
And yes, I know the name `ICompressionCodec2` is awful.
--
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]