sreemanamala commented on code in PR #16658:
URL: https://github.com/apache/druid/pull/16658#discussion_r1749241080
##########
processing/src/main/java/org/apache/druid/query/rowsandcols/RowsAndColumns.java:
##########
@@ -112,4 +131,66 @@ static AppendableRowsAndColumns
expectAppendable(RowsAndColumns input)
*/
@Nullable
<T> T as(Class<T> clazz);
+
+ /**
+ * Serializer for {@link RowsAndColumns} by converting the instance to
{@link FrameRowsAndColumns}
+ */
+ class RowsAndColumnsSerializer extends StdSerializer<RowsAndColumns>
+ {
+ public RowsAndColumnsSerializer()
+ {
+ super(RowsAndColumns.class);
+ }
+
+ @Override
+ public void serialize(
+ RowsAndColumns rac,
+ JsonGenerator jsonGenerator,
+ SerializerProvider serializerProvider
+ ) throws IOException
+ {
+ FrameRowsAndColumns frameRAC = rac.as(FrameRowsAndColumns.class);
+ if (frameRAC == null) {
+ throw DruidException.defensive("Unable to serialize RAC");
+ }
+ JacksonUtils.writeObjectUsingSerializerProvider(jsonGenerator,
serializerProvider, frameRAC.getSignature());
+
+ Frame frame = frameRAC.getFrame();
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ frame.writeTo(
+ Channels.newChannel(baos),
+ false,
+ ByteBuffer.allocate(Frame.compressionBufferSize((int)
frame.numBytes())),
Review Comment:
Since we are not trying to compress, I made the buffer `null`
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]