Skip to content

Commit 3f99d9c

Browse files
authored
Make OutputBuffers Thrift-compatible (#24701)
1 parent 8f487f6 commit 3f99d9c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

presto-main/src/main/java/com/facebook/presto/execution/buffer/OutputBuffers.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
package com.facebook.presto.execution.buffer;
1515

1616
import com.facebook.drift.annotations.ThriftConstructor;
17+
import com.facebook.drift.annotations.ThriftEnum;
1718
import com.facebook.drift.annotations.ThriftField;
1819
import com.facebook.drift.annotations.ThriftStruct;
1920
import com.facebook.presto.spi.plan.PartitioningHandle;
@@ -40,6 +41,7 @@
4041
import static java.lang.Integer.parseInt;
4142
import static java.util.Objects.requireNonNull;
4243

44+
@ThriftStruct
4345
public final class OutputBuffers
4446
{
4547
public static final int BROADCAST_PARTITION_ID = 0;
@@ -76,6 +78,7 @@ public static OutputBuffers createSpoolingOutputBuffers()
7678
return SPOOLING_OUTPUT_BUFFERS;
7779
}
7880

81+
@ThriftEnum
7982
public enum BufferType
8083
{
8184
PARTITIONED,
@@ -91,6 +94,7 @@ public enum BufferType
9194
private final Map<OutputBufferId, Integer> buffers;
9295

9396
// Visible only for Jackson... Use the "with" methods instead
97+
@ThriftConstructor
9498
@JsonCreator
9599
public OutputBuffers(
96100
@JsonProperty("type") BufferType type,
@@ -104,24 +108,28 @@ public OutputBuffers(
104108
this.noMoreBufferIds = noMoreBufferIds;
105109
}
106110

111+
@ThriftField(1)
107112
@JsonProperty
108113
public BufferType getType()
109114
{
110115
return type;
111116
}
112117

118+
@ThriftField(2)
113119
@JsonProperty
114120
public long getVersion()
115121
{
116122
return version;
117123
}
118124

125+
@ThriftField(3)
119126
@JsonProperty
120127
public boolean isNoMoreBufferIds()
121128
{
122129
return noMoreBufferIds;
123130
}
124131

132+
@ThriftField(4)
125133
@JsonProperty
126134
public Map<OutputBufferId, Integer> getBuffers()
127135
{

0 commit comments

Comments
 (0)