如何比较Pig中的BIGINT

时间:2019-05-29 21:42:37

标签: apache-pig

commit_time中的BIGINT值与20190508143744类似 当我尝试与commit_time > 1000比较时,它可以正常工作 但是当我尝试使用commit_time > 20190508143743时,它给出了如下错误

  

2019-05-29 17:35:38,390 [main]错误org.apache.pig.tools.grunt.Grunt-错误1200:对于输入字符串:“ 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);

2 个答案:

答案 0 :(得分:0)

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

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

答案 1 :(得分:0)

答案: deviceChange =通过(commit_time> 20190508143743 L )过滤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的投入!