文档

Quick BI中自定义SQL运行时提示“java.lang.ClassCastException: java.time.LocalDate cannot be cast to java.util.Date”错误

更新时间:
一键部署

问题描述

Quick BI中自定义SQL运行报错“java.lang.ClassCastException: java.time.LocalDate cannot be cast to java.util.Date”。

从后台获取的完整的报错日志如下:

2021-12-15 18:26:34,349 ERROR [grpc-default-executor-8] 
[DataQueryServiceImpl.java:67] [29a01084-6a84-4da4-8ac4-719f60d90edd] -
nox data query fail, param={"priority":0,"timeout":300,"offset":0,"statement":
"select * from (-- Overview by Sub-type\nselect
 t2.yesorno_abi, -- 全局筛选\n        t1.comment_type,\n        
t1.store_name_en, -- 全局筛选\n      
 t1.date,\n        avg(t1.dsr) avg_dsr,\n        avg(t1.dsr_avg) dsr_avg,\n        
avg(t1.dsr) - avg(t1.dsr_avg)
dsr_benchmark\nfrom abi_ads.ads_ec_sycm_goods_comments_result_f_df t1\ninner
join abi_cdm.dim_ec_comments_brand t2 on t1.brand\u003dt2.brand\nwhere
  t1.pt\u003dto_char(dateadd(getdate(),-2,\u0027dd\u0027),\u0027yyyymmdd\u0027)\n        and t2.brand is not null \n        and t2.yesorno_abi\u003d\u0027ABI\u0027\n      
 and t1.platform\u003d\u0027tmall\u0027\ngroup by t2.yesorno_abi,t1.comment_type,
t1.store_name_en,t1.date\n ) TS791672868 limit 200"},
datasourceId=94c49fc3-4e66-401d-8087-2e74863e958a, datasourceType=MAXCOMPUTE
java.lang.ClassCastException: java.time.LocalDate cannot be cast to java.util.Date
 at com.aliyun.odps.data.ArrayRecord.getDatetime(ArrayRecord.java:229)
 at com.alibaba.nox.executor.task.sdk.maxcompute.MaxComputeDataQueryTaskImpl.parseResult(MaxComputeDataQueryTaskImpl.java:147)
 at com.alibaba.nox.executor.task.sdk.maxcompute.MaxComputeDataQueryTaskImpl.executeQuery(MaxComputeDataQueryTaskImpl.java:85)
 at com.alibaba.nox.executor.service.DataQueryServiceImpl.executeQuery(DataQueryServiceImpl.java:65)
 at com.alibaba.yunbi.v2.xengine.executor.task.MaxComputeQueryTaskEngineImpl.execute0(MaxComputeQueryTaskEngineImpl.java:41)
 at com.alibaba.yunbi.v2.xengine.executor.task.AbstractQueryTaskEngine$4.call(AbstractQueryTaskEngine.java:168)
 at com.alibaba.yunbi.v2.xengine.executor.task.AbstractQueryTaskEngine$4.call(AbstractQueryTaskEngine.java:165)
 at com.alibaba.yunbi.v2.common.service.framework.engine.ssrf.SSRFServiceImpl.secureRun(SSRFServiceImpl.java:73)
 at com.alibaba.yunbi.v2.xengine.executor.task.AbstractQueryTaskEngine.executeTask(AbstractQueryTaskEngine.java:165)
 at com.alibaba.yunbi.v2.xengine.executor.grpc.GrpcDataQueryService.execute(GrpcDataQueryService.java:67)
 at com.alibaba.yunbi.v2.grpc.dataquery.proto.DataQueryServiceGrpc$MethodHandlers.invoke(DataQueryServiceGrpc.java:216)
 at io.grpc.stub.ServerCalls$UnaryServerCallHandler$UnaryServerCallListener.onHalfClose(ServerCalls.java:182)
 at io.grpc.internal.ServerCallImpl$ServerStreamListenerImpl.halfClosed(ServerCallImpl.java:331)
 at io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1HalfClosed.runInContext(ServerImpl.java:814)
 at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
 at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)
 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:877)

问题原因

客户对应的数据源是MaxCompute,Quick BI引用的MaxCompute SDK版本较低,会出现该问题。

解决方案

建议客户修改MaxCompute数据源的配置,勾选MaxCompute查询加速,因为查询加速这里引用了高版本的MaxCompute SDK,解决了该问题:

适用于

  • Quick BI 4.1.3