22
22
import io .trino .spi .block .Block ;
23
23
import io .trino .spi .block .SqlMap ;
24
24
import io .trino .spi .block .SqlRow ;
25
- import io .trino .spi .connector .ConnectorSession ;
26
25
import io .trino .spi .type .ArrayType ;
27
26
import io .trino .spi .type .BigintType ;
28
27
import io .trino .spi .type .BooleanType ;
@@ -117,7 +116,7 @@ public static TypeEncoder createTypeEncoder(Type type, boolean supportsParametri
117
116
};
118
117
}
119
118
120
- public static void writePagesToJsonGenerator (ConnectorSession connectorSession , Consumer <TrinoException > throwableConsumer , JsonGenerator generator , TypeEncoder [] typeEncoders , int [] sourcePageChannels , List <Page > pages )
119
+ public static void writePagesToJsonGenerator (Consumer <TrinoException > throwableConsumer , JsonGenerator generator , TypeEncoder [] typeEncoders , int [] sourcePageChannels , List <Page > pages )
121
120
{
122
121
verify (typeEncoders .length == sourcePageChannels .length , "Source page channels and type encoders must have the same length" );
123
122
try {
@@ -131,7 +130,7 @@ public static void writePagesToJsonGenerator(ConnectorSession connectorSession,
131
130
for (int position = 0 ; position < page .getPositionCount (); position ++) {
132
131
generator .writeStartArray ();
133
132
for (int column = 0 ; column < typeEncoders .length ; column ++) {
134
- typeEncoders [column ].encode (generator , connectorSession , blocks [column ], position );
133
+ typeEncoders [column ].encode (generator , blocks [column ], position );
135
134
}
136
135
generator .writeEndArray ();
137
136
}
@@ -146,15 +145,15 @@ public static void writePagesToJsonGenerator(ConnectorSession connectorSession,
146
145
147
146
public interface TypeEncoder
148
147
{
149
- void encode (JsonGenerator generator , ConnectorSession session , Block block , int position )
148
+ void encode (JsonGenerator generator , Block block , int position )
150
149
throws IOException ;
151
150
}
152
151
153
152
private static class BigintEncoder
154
153
implements TypeEncoder
155
154
{
156
155
@ Override
157
- public void encode (JsonGenerator generator , ConnectorSession session , Block block , int position )
156
+ public void encode (JsonGenerator generator , Block block , int position )
158
157
throws IOException
159
158
{
160
159
if (block .isNull (position )) {
@@ -169,7 +168,7 @@ private static class IntegerEncoder
169
168
implements TypeEncoder
170
169
{
171
170
@ Override
172
- public void encode (JsonGenerator generator , ConnectorSession session , Block block , int position )
171
+ public void encode (JsonGenerator generator , Block block , int position )
173
172
throws IOException
174
173
{
175
174
if (block .isNull (position )) {
@@ -184,7 +183,7 @@ private static class BooleanEncoder
184
183
implements TypeEncoder
185
184
{
186
185
@ Override
187
- public void encode (JsonGenerator generator , ConnectorSession session , Block block , int position )
186
+ public void encode (JsonGenerator generator , Block block , int position )
188
187
throws IOException
189
188
{
190
189
if (block .isNull (position )) {
@@ -199,7 +198,7 @@ private static class SmallintEncoder
199
198
implements TypeEncoder
200
199
{
201
200
@ Override
202
- public void encode (JsonGenerator generator , ConnectorSession session , Block block , int position )
201
+ public void encode (JsonGenerator generator , Block block , int position )
203
202
throws IOException
204
203
{
205
204
if (block .isNull (position )) {
@@ -214,7 +213,7 @@ private static class TinyintEncoder
214
213
implements TypeEncoder
215
214
{
216
215
@ Override
217
- public void encode (JsonGenerator generator , ConnectorSession session , Block block , int position )
216
+ public void encode (JsonGenerator generator , Block block , int position )
218
217
throws IOException
219
218
{
220
219
if (block .isNull (position )) {
@@ -229,7 +228,7 @@ private static class DoubleEncoder
229
228
implements TypeEncoder
230
229
{
231
230
@ Override
232
- public void encode (JsonGenerator generator , ConnectorSession session , Block block , int position )
231
+ public void encode (JsonGenerator generator , Block block , int position )
233
232
throws IOException
234
233
{
235
234
if (block .isNull (position )) {
@@ -244,7 +243,7 @@ private static class RealEncoder
244
243
implements TypeEncoder
245
244
{
246
245
@ Override
247
- public void encode (JsonGenerator generator , ConnectorSession session , Block block , int position )
246
+ public void encode (JsonGenerator generator , Block block , int position )
248
247
throws IOException
249
248
{
250
249
if (block .isNull (position )) {
@@ -259,7 +258,7 @@ private static class VarcharEncoder
259
258
implements TypeEncoder
260
259
{
261
260
@ Override
262
- public void encode (JsonGenerator generator , ConnectorSession session , Block block , int position )
261
+ public void encode (JsonGenerator generator , Block block , int position )
263
262
throws IOException
264
263
{
265
264
if (block .isNull (position )) {
@@ -282,7 +281,7 @@ private CharEncoder(int length)
282
281
}
283
282
284
283
@ Override
285
- public void encode (JsonGenerator generator , ConnectorSession session , Block block , int position )
284
+ public void encode (JsonGenerator generator , Block block , int position )
286
285
throws IOException
287
286
{
288
287
if (block .isNull (position )) {
@@ -298,7 +297,7 @@ private static class VarbinaryEncoder
298
297
implements TypeEncoder
299
298
{
300
299
@ Override
301
- public void encode (JsonGenerator generator , ConnectorSession session , Block block , int position )
300
+ public void encode (JsonGenerator generator , Block block , int position )
302
301
throws IOException
303
302
{
304
303
if (block .isNull (position )) {
@@ -325,7 +324,7 @@ public ArrayEncoder(ArrayType arrayType, TypeEncoder typeEncoder)
325
324
}
326
325
327
326
@ Override
328
- public void encode (JsonGenerator generator , ConnectorSession session , Block block , int position )
327
+ public void encode (JsonGenerator generator , Block block , int position )
329
328
throws IOException
330
329
{
331
330
if (block .isNull (position )) {
@@ -336,7 +335,7 @@ public void encode(JsonGenerator generator, ConnectorSession session, Block bloc
336
335
Block arrayBlock = arrayType .getObject (block , position );
337
336
generator .writeStartArray ();
338
337
for (int i = 0 ; i < arrayBlock .getPositionCount (); i ++) {
339
- typeEncoder .encode (generator , session , arrayBlock , i );
338
+ typeEncoder .encode (generator , arrayBlock , i );
340
339
}
341
340
generator .writeEndArray ();
342
341
}
@@ -355,7 +354,7 @@ public MapEncoder(MapType mapType, TypeEncoder valueEncoder)
355
354
}
356
355
357
356
@ Override
358
- public void encode (JsonGenerator generator , ConnectorSession session , Block block , int position )
357
+ public void encode (JsonGenerator generator , Block block , int position )
359
358
throws IOException
360
359
{
361
360
if (block .isNull (position )) {
@@ -375,7 +374,7 @@ public void encode(JsonGenerator generator, ConnectorSession session, Block bloc
375
374
// Map values are always properly encoded using their types.
376
375
// TODO: improve in v2 JSON format
377
376
generator .writeFieldName (mapType .getKeyType ().getObjectValue (keyBlock , offset + i ).toString ());
378
- valueEncoder .encode (generator , session , valueBlock , offset + i );
377
+ valueEncoder .encode (generator , valueBlock , offset + i );
379
378
}
380
379
generator .writeEndObject ();
381
380
}
@@ -394,7 +393,7 @@ public RowEncoder(RowType rowType, TypeEncoder[] fieldEncoders)
394
393
}
395
394
396
395
@ Override
397
- public void encode (JsonGenerator generator , ConnectorSession session , Block block , int position )
396
+ public void encode (JsonGenerator generator , Block block , int position )
398
397
throws IOException
399
398
{
400
399
if (block .isNull (position )) {
@@ -404,7 +403,7 @@ public void encode(JsonGenerator generator, ConnectorSession session, Block bloc
404
403
SqlRow row = rowType .getObject (block , position );
405
404
generator .writeStartArray ();
406
405
for (int i = 0 ; i < row .getFieldCount (); i ++) {
407
- fieldEncoders [i ].encode (generator , session , row .getRawFieldBlock (i ), row .getRawIndex ());
406
+ fieldEncoders [i ].encode (generator , row .getRawFieldBlock (i ), row .getRawIndex ());
408
407
}
409
408
generator .writeEndArray ();
410
409
}
@@ -423,7 +422,7 @@ public TypeObjectValueEncoder(Type type, boolean supportsParametricDateTime)
423
422
}
424
423
425
424
@ Override
426
- public void encode (JsonGenerator generator , ConnectorSession session , Block block , int position )
425
+ public void encode (JsonGenerator generator , Block block , int position )
427
426
throws IOException
428
427
{
429
428
if (block .isNull (position )) {
0 commit comments