Skip to content

Commit

Permalink
Implements minor tweak.
Browse files Browse the repository at this point in the history
  • Loading branch information
ppanopticon committed Nov 28, 2023
1 parent 24370bc commit ed6a32a
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,15 @@ class TupleSerializer(val columns: Array<ColumnDef<*>>): KSerializer<Tuple> {
* @return The decoded [Tuple].
*/
override fun deserialize(decoder: Decoder): Tuple {
val values = ArrayList<Value?>(this.columns.size)
val values = Array<Value?>(this.columns.size) { null }
val dec = decoder.beginStructure(this.descriptor)
while (true) {
val index = dec.decodeElementIndex(this.descriptor)
if (index == CompositeDecoder.DECODE_DONE) break
val serializer = this.elementSerializers[index]
values.add(dec.decodeNullableSerializableElement(this@TupleSerializer.descriptor, index, serializer))
values[index] = dec.decodeNullableSerializableElement(this.descriptor, index, this.elementSerializers[index])
}
dec.endStructure(this.descriptor)
return StandaloneTuple(0L, this@TupleSerializer.columns, values.toTypedArray())
return StandaloneTuple(0L, this.columns, values)
}

/**
Expand Down

0 comments on commit ed6a32a

Please sign in to comment.