如何比较 Pig 中的 BIGINT

How to compare BIGINT in Pig

在 table 中 commit_time 是 BIGINT,值存储类似于 20190508143744 当我尝试与 commit_time > 1000 进行比较时,它可以正常工作 但是当我尝试使用 commit_time > 20190508143743 时,它会给出如下错误

2019-05-29 17:35:38,390 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1200: For input string: "20190508143743"

步骤:

pig -useHCatalog

custProf = LOAD 'alisy3p.cust_change' using org.apache.hive.hcatalog.pig.HCatLoader();

// this step gives error
deviceChange= filter custProf by (commit_time > 20190508143743);

也尝试过:

  1. deviceChange= filter custProf by (commit_time > (bigint)20190508143743);
  2. deviceChange= filter custProf by (commit_time > (long)20190508143743);

根据 Pig documentation,您应该能够通过在数字末尾添加 BI 来指定一个双整数常量。试试这个:

deviceChange = filter custProf by (commit_time > 20190508143743BI);

回答: deviceChange= 通过 (commit_time > 20190508143743L);

过滤 custProf

BIGINT 不受支持,BIGINTEGER 与我们可以使用 Long 的配置单元文档不同。

https://cwiki.apache.org/confluence/display/Hive/HCatalog+LoadStore#HCatalogLoadStore-DataTypeMappings

https://pig.apache.org/docs/r0.17.0/basic.html#constants

感谢 Savagedata 的输入!