break;
case MAP:
gen.writeStartObject();
if (reader.isSet()) {
for(String name : reader){
FieldReader childReader = reader.reader(name);
if(childReader.isSet()){
gen.writeFieldName(name);
writeValue(childReader);
}
}
}
gen.writeEndObject();
break;
case NULL:
gen.writeNull();
break;
case VAR16CHAR:
gen.writeString(reader.readString());
break;
case VARBINARY:
gen.writeBinary(reader.readByteArray());
break;
case VARCHAR:
gen.writeString(reader.readText().toString());
break;
}
break;
case REPEATED:
gen.writeStartArray();
switch (mt) {
case FLOAT4:
for(int i = 0; i < reader.size(); i++){
gen.writeNumber(reader.readFloat(i));
}
break;
case FLOAT8:
for(int i = 0; i < reader.size(); i++){
gen.writeNumber(reader.readDouble(i));
}
break;
case INT:
for(int i = 0; i < reader.size(); i++){
gen.writeNumber(reader.readInteger(i));
}
break;
case SMALLINT:
for(int i = 0; i < reader.size(); i++){
gen.writeNumber(reader.readShort(i));
}
break;
case TINYINT:
for(int i = 0; i < reader.size(); i++){
gen.writeNumber(reader.readByte(i));
}
break;
case BIGINT:
for(int i = 0; i < reader.size(); i++){
gen.writeNumber(reader.readLong(i));
}
break;
case BIT:
for(int i = 0; i < reader.size(); i++){
gen.writeBoolean(reader.readBoolean(i));
}
break;
case DATE:
case TIME:
case TIMESTAMP:
case TIMESTAMPTZ:
for(int i = 0; i < reader.size(); i++){
gen.writeString(reader.readDateTime(i).toString());
}
case INTERVALYEAR:
case INTERVALDAY:
case INTERVAL:
for(int i = 0; i < reader.size(); i++){
gen.writeString(reader.readPeriod(i).toString());
}
break;
case DECIMAL28DENSE:
case DECIMAL28SPARSE:
case DECIMAL38DENSE:
case DECIMAL38SPARSE:
case DECIMAL9:
case DECIMAL18:
for(int i = 0; i < reader.size(); i++){
gen.writeNumber(reader.readBigDecimal(i));
}
break;
case LIST:
for(int i = 0; i < reader.size(); i++){
while(reader.next()){
writeValue(reader.reader());
}
}
break;
case MAP:
while(reader.next()){
gen.writeStartObject();
for(String name : reader){
FieldReader mapField = reader.reader(name);
if(mapField.isSet()){
gen.writeFieldName(name);
writeValue(mapField);
}
}
gen.writeEndObject();