Flinksql关于日期截取字段报错SQL parse failed. Encountered “, DAY“

"这篇博客记录了一个在使用Flink时遇到的SQL解析异常,错误信息为`SQLparsefailed.Encountered",DAY"atline18,column23.`。问题在于使用了不被解析器接受的`DAY`关键字。解决方法是改用`dayofmonth`函数来获取日期的天数。该文章详细描述了异常的堆栈跟踪,并提供了具体的解决步骤。"
摘要由CSDN通过智能技术生成
org.apache.flink.table.api.SqlParserException: SQL parse failed. Encountered ", DAY" at line 18, column 23.
Was expecting one of:
	at org.apache.flink.table.planner.parse.CalciteParser.parse(CalciteParser.java:56)
	at org.apache.flink.table.planner.delegation.ParserImpl.parse(ParserImpl.java:96)
	at org.apache.flink.table.api.internal.TableEnvironmentImpl.explainSql(TableEnvironmentImpl.java:670)
	at com.dlink.executor.Executor.explainSql(Executor.java:230)
	at com.dlink.explainer.Explainer.explainSql(Explainer.java:215)
	at com.dlink.job.JobManager.explainSql(JobManager.java:464)
	at com.dlink.service.impl.StudioServiceImpl.explainFlinkSql(StudioServiceImpl.java:167)
	at com.dlink.service.impl.StudioServiceImpl.explainSql(StudioServiceImpl.java:154)
	at com.dlink.controller.StudioController.explainSql(StudioController.java:51)
	at sun.reflect.GeneratedMethodAccessor520.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150)
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808)
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1067)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)

解决办法:
使用dayofmonth去处理天数的日期
在这里插入图片描述
在这里插入图片描述

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值