ulysses-you commented on code in PR #4328:
URL: https://github.com/apache/kyuubi/pull/4328#discussion_r1106984653


##########
kyuubi-server/src/main/scala/org/apache/kyuubi/server/trino/api/TrinoScalaObjectMapper.scala:
##########
@@ -19,14 +19,54 @@ package org.apache.kyuubi.server.trino.api
 
 import javax.ws.rs.ext.ContextResolver
 
-import com.fasterxml.jackson.databind.{DeserializationFeature, ObjectMapper}
+import com.fasterxml.jackson.core.JsonGenerator
+import com.fasterxml.jackson.databind.{DeserializationFeature, JsonSerializer, 
Module, ObjectMapper, SerializerProvider}
+import com.fasterxml.jackson.databind.module.SimpleModule
 import com.fasterxml.jackson.datatype.jdk8.Jdk8Module
+import io.trino.client.{ClientTypeSignature, ClientTypeSignatureParameter}
 
 class TrinoScalaObjectMapper extends ContextResolver[ObjectMapper] {
 
   private lazy val mapper = new ObjectMapper()
     .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+    .registerModule(serializeTrinoClientTypeModule())
     .registerModule(new Jdk8Module)
 
+  /**
+   * Not sure why jackson annotations do not work for some Trino dto, e.g. 
`ClientTypeSignature`.
+   * Without this change, it will throw exception during serializing when 
return back response.
+   * This is a workaround to be compatible with Trino json serialization.
+   * TODO: Remove this when find root cause
+   */
+  private def serializeTrinoClientTypeModule(): Module = {
+    val module = new SimpleModule("trinoSerializer")

Review Comment:
   ah, good point. I have validated it works



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to