From 2a136618ec95ffcb690f848bb711a7ef01a19436 Mon Sep 17 00:00:00 2001 From: Matthew Pope <81593196+popematt@users.noreply.github.com> Date: Tue, 7 May 2024 15:43:00 -0700 Subject: [PATCH] Remove unnecessary conversion steps in PartiQLValueIonReaderBuilder (#1456) --- .../kotlin/org/partiql/value/io/PartiQLValueIonReader.kt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/partiql-types/src/main/kotlin/org/partiql/value/io/PartiQLValueIonReader.kt b/partiql-types/src/main/kotlin/org/partiql/value/io/PartiQLValueIonReader.kt index 732738ffec..6f42b1e2bb 100644 --- a/partiql-types/src/main/kotlin/org/partiql/value/io/PartiQLValueIonReader.kt +++ b/partiql-types/src/main/kotlin/org/partiql/value/io/PartiQLValueIonReader.kt @@ -3,10 +3,8 @@ package org.partiql.value.io import com.amazon.ion.IonReader import com.amazon.ion.IonType import com.amazon.ion.system.IonReaderBuilder -import com.amazon.ion.system.IonSystemBuilder import com.amazon.ion.system.IonTextWriterBuilder import com.amazon.ionelement.api.IonElement -import com.amazon.ionelement.api.toIonValue import org.partiql.value.DecimalValue import org.partiql.value.IntValue import org.partiql.value.PartiQLValue @@ -626,9 +624,8 @@ public class PartiQLValueIonReaderBuilder private constructor( public fun build(ionElement: IonElement): PartiQLValueReader { val out = ByteArrayOutputStream() - val reader = IonReaderBuilder.standard().build(ionElement.toIonValue(IonSystemBuilder.standard().build())) val writer = IonTextWriterBuilder.standard().build(out) - writer.writeValues(reader) + ionElement.writeTo(writer) val input = ByteArrayInputStream(out.toByteArray()) return build(input) }