[ 
https://issues.apache.org/jira/browse/FLINK-31091?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17691352#comment-17691352
 ] 

Jane Chan edited comment on FLINK-31091 at 2/21/23 3:31 AM:
------------------------------------------------------------

Thanks, [~Sergey Nuyanzin] and [~mapohl] for reporting this.

The reason is that 
org.apache.flink.table.gateway.rest.serde.LogicalTypeJsonSerializer does not 
cope with `INTERVAL_YEAR_MONTH` and `INTERVAL_DAY_TIME`. cc [~fsk119] 


was (Author: qingyue):
Thanks, [~Sergey Nuyanzin] and [~mapohl] for reporting this.

The reason is that 
org.apache.flink.table.gateway.rest.serde.LogicalTypeJsonSerializer does not 
cope with `INTERVAL_YEAR_MONTH` and `INTERVAL_DAY_TIME`.

I'd like to fix this issue. cc [~fsk119] 

> SQL interval related queries stop working via SQL client
> --------------------------------------------------------
>
>                 Key: FLINK-31091
>                 URL: https://issues.apache.org/jira/browse/FLINK-31091
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Client
>    Affects Versions: 1.17.0
>            Reporter: Sergey Nuyanzin
>            Assignee: Sergey Nuyanzin
>            Priority: Blocker
>              Labels: pull-request-available
>
> I put blocker since it works in 1.16.x and stopped working in 1.17 after a 
> certain commit
> Any interval related query run via SQL Client is failing with 
> {noformat}
> [ERROR] Could not execute SQL statement. Reason:
> org.apache.flink.runtime.rest.util.RestClientException: [Internal server 
> error. Could not map response to JSON.]
>       at 
> org.apache.flink.runtime.rest.RestClient.parseResponse(RestClient.java:536)
>       at 
> org.apache.flink.runtime.rest.RestClient.lambda$submitRequest$3(RestClient.java:516)
>       at 
> java.util.concurrent.CompletableFuture.uniCompose(CompletableFuture.java:966)
>       at 
> java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:940)
>       at 
> java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:456)
>       at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>       at java.lang.Thread.run(Thread.java:750)
> {noformat}
> example of query
> {code:sql}
> SELECT INTERVAL '2' DAY;
> SELECT 1, INTERVAL '2' YEAR;
> {code}
> based on tests it stopped working after this commit 
> https://issues.apache.org/jira/browse/FLINK-29945
> More traces from logs
> {noformat}
> org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JsonMappingException:
>  Unable to serialize logical type 'INTERVAL MONTH NOT NULL'. Please check the 
> documentation for supported types. (through reference chain: java.util.Coll
> ections$UnmodifiableRandomAccessList[1]->org.apache.flink.table.gateway.rest.serde.ColumnInfo["logicalType"])
>         at 
> org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:392)
>  ~[flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:351)
>  ~[flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ser.std.StdSerializer.wrapAndThrow(StdSerializer.java:316)
>  ~[flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:782)
>  ~[flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:178)
>  ~[flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serializeContents(IndexedListSerializer.java:119)
>  ~[flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serialize(IndexedListSerializer.java:79)
>  ~[flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serialize(IndexedListSerializer.java:18)
>  ~[flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.SerializerProvider.defaultSerializeField(SerializerProvider.java:1166)
>  ~[flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.table.gateway.rest.serde.ResultInfoSerializer.serialize(ResultInfoSerializer.java:82)
>  ~[flink-sql-gateway-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.table.gateway.rest.serde.ResultInfoSerializer.serialize(ResultInfoSerializer.java:47)
>  ~[flink-sql-gateway-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.SerializerProvider.defaultSerializeField(SerializerProvider.java:1166)
>  ~[flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.table.gateway.rest.serde.FetchResultsResponseBodySerializer.serialize(FetchResultsResponseBodySerializer.java:60)
>  ~[flink-sql-gateway-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.table.gateway.rest.serde.FetchResultsResponseBodySerializer.serialize(FetchResultsResponseBodySerializer.java:31)
>  ~[flink-sql-gateway-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ser.DefaultSerializerProvider._serialize(DefaultSerializerProvider.java:480)
>  ~[flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:319)
>  ~[flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper._writeValueAndClose(ObjectMapper.java:4568)
>  ~[flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper.writeValue(ObjectMapper.java:3804)
>  ~[flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.runtime.rest.handler.util.HandlerUtils.sendResponse(HandlerUtils.java:92)
>  ~[flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.table.gateway.rest.handler.AbstractSqlGatewayRestHandler.lambda$respondToRequest$1(AbstractSqlGatewayRestHandler.java:93)
>  ~[flink-sql-gateway-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> java.util.concurrent.CompletableFuture.uniAccept(CompletableFuture.java:670) 
> ~[?:1.8.0_362]
>         at 
> java.util.concurrent.CompletableFuture.uniAcceptStage(CompletableFuture.java:683)
>  ~[?:1.8.0_362]
>         at 
> java.util.concurrent.CompletableFuture.thenAccept(CompletableFuture.java:2010)
>  ~[?:1.8.0_362]
>         at 
> org.apache.flink.table.gateway.rest.handler.AbstractSqlGatewayRestHandler.respondToRequest(AbstractSqlGatewayRestHandler.java:91)
>  ~[flink-sql-gateway-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.table.gateway.rest.handler.AbstractSqlGatewayRestHandler.respondToRequest(AbstractSqlGatewayRestHandler.java:52)
>  ~[flink-sql-gateway-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.runtime.rest.handler.AbstractHandler.respondAsLeader(AbstractHandler.java:196)
>  ~[flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.runtime.rest.handler.LeaderRetrievalHandler.lambda$channelRead0$0(LeaderRetrievalHandler.java:83)
>  ~[flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at java.util.Optional.ifPresent(Optional.java:159) [?:1.8.0_362]
>         at 
> org.apache.flink.util.OptionalConsumer.ifPresent(OptionalConsumer.java:45) 
> [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.runtime.rest.handler.LeaderRetrievalHandler.channelRead0(LeaderRetrievalHandler.java:80)
>  [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.runtime.rest.handler.LeaderRetrievalHandler.channelRead0(LeaderRetrievalHandler.java:49)
>  [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.netty4.io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99)
>  [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.netty4.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
>  [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.netty4.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
>  [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.netty4.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
>  [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.runtime.rest.handler.router.RouterHandler.routed(RouterHandler.java:115)
>  [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.runtime.rest.handler.router.RouterHandler.channelRead0(RouterHandler.java:94)
>  [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.runtime.rest.handler.router.RouterHandler.channelRead0(RouterHandler.java:55)
>  [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.netty4.io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99)
>  [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.netty4.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
>  [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.netty4.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
>  [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.netty4.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
>  [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.netty4.io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
>  [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.netty4.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
>  [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.netty4.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
>  [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.netty4.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
>  [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.runtime.rest.FileUploadHandler.channelRead0(FileUploadHandler.java:208)
>  [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.runtime.rest.FileUploadHandler.channelRead0(FileUploadHandler.java:69)
>  [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.netty4.io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99)
>  [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.netty4.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
>  [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.netty4.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
>  [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.netty4.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
>  [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.netty4.io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436)
>  [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.netty4.io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:336)
>  [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.netty4.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:308)
>  [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.netty4.io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251)
>  [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.netty4.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
>  [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.netty4.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
>  [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.netty4.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
>  [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.netty4.io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
>  [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.netty4.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
>  [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.netty4.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
>  [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.netty4.io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
>  [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.netty4.io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
>  [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.netty4.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)
>  [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.netty4.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
>  [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.netty4.io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
>  [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.netty4.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
>  [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.netty4.io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
>  [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.netty4.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
>  [flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at java.lang.Thread.run(Thread.java:750) [?:1.8.0_362]
> Caused by: java.lang.UnsupportedOperationException: Unable to serialize 
> logical type 'INTERVAL MONTH NOT NULL'. Please check the documentation for 
> supported types.
>         at 
> org.apache.flink.table.gateway.rest.serde.LogicalTypeJsonSerializer.serializeInternal(LogicalTypeJsonSerializer.java:174)
>  ~[flink-sql-gateway-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.table.gateway.rest.serde.LogicalTypeJsonSerializer.serialize(LogicalTypeJsonSerializer.java:100)
>  ~[flink-sql-gateway-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.table.gateway.rest.serde.LogicalTypeJsonSerializer.serialize(LogicalTypeJsonSerializer.java:51)
>  ~[flink-sql-gateway-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:728)
>  ~[flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         at 
> org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:774)
>  ~[flink-dist-1.18-SNAPSHOT.jar:1.18-SNAPSHOT]
>         ... 67 more
> {noformat}
> //cc [~fsk119]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to