apache-pig - Pig 脚本错误:java.lang.Long 无法转换为 java.lang.Integer
问题描述
我为 Pig 运行以下代码片段:
publisher_hour_listings_cdf = foreach rscf_pub_hours_cumsum_proj generate
rscf_publisher_id,
rscf_is_uw,
rscf_hour,
(int)rscf_hour as rscf_hour_int,
rscf_cum_listings,
total_daily_listings,
(rscf_cum_listings*1.0)/(total_daily_listings*1.0) as cdf,
'$handledDate$';
我得到一个错误:
2020-05-02 04:31:53,130 信息 - [步骤] - 线程 74038 - /opt/pig/pig-0.17.0/bin/pig: [main] 错误 org.apache.pig.tools.pigstats.PigStats -错误 0:org.apache.pig.backend.executionengine.ExecException:错误 0:执行时出现异常(名称:publisher_hour_listings_cdf:New For Each(false,false,false,false,false,false,false,false)[bag] - scope-203 Operator Key: scope-203): org.apache.pig.backend.executionengine.ExecException: ERROR 0: Exception while execution [POCast (Name: Cast [long] - scope-171 Operator Key: scope-171) children : [[POProject (Name: Project[int][3] - scope-170 Operator Key: scope-170) children: null at []]] at [rscf_cum_listings[-1,-1]]]: java.lang. ClassCastException: java.lang.Long 不能转换为 java.lang.Integer
我们认为 Pig 未能将 Long 转换为 Integer。我们尝试使用“biginteger”而不是“int”进行转换:
(biginteger)rscf_hour as rscf_hour_int
并且该脚本也因完全相同的错误消息而失败。
我们还尝试完全删除 int 强制转换:
rscf_hour as rscf_hour_int
我们仍然得到同样的错误。
你知道为什么吗?
解决方案
推荐阅读
- javascript - Web Audio API:使用复杂节点图播放多个音符的最佳实践是什么?
- c++ - (VC 2019) C++ return 语句在发布配置中被忽略,在调试中工作正常
- sql - 比较 2 个文本字段 SQL - 错误 - ORA-22835:缓冲区太小,无法进行 CLOB 到 CHAR 或 BLOB 到 RAW 转换
- opengl - 设置 gl_FragDepth 会导致延迟?
- php - 根据每个数组中的键值合并到数组的最佳方法是什么?
- javascript - 如何从每个唯一的 Firestore 文档中检索 1 个图片 URL 并使用该 picURL 设置 img.src?
- excel - Mac Excel 2016 (16.36) 上的 Excel VBA 运行时错误 1004
- c++ - C++ 之间的区别:Obj*& vs Obj** vs Obj&&
- amazon-s3 - Kafka-Connect:启动 S3 Sink 连接器时出现无法识别的错误
- node.js - 无法下载所有 reactjs 包。只获取 node_modules、package-lock.json 和 package.json