之前我问过如何在hive或pig中操作数据结构。我能够用sql得到答案,并从中找到了hive的答案。我还在寻找解决Pig的办法。
我想更改我的表:
进入mytable2:
我试过:
myTable2 = FOREACH myTable GENERATE item, year,
'jan' AS month, jan AS value,
'feb' AS month, feb AS value,
'mar' AS month, mar AS value;
这或多或少是 hive 里的工作原理,但Pig给了我:
ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1108:
<line 2, column 35> Duplicate schema alias: month
2条答案
按热度按时间siotufzp1#
Pig脚本:
mcdcgff02#
我想明白了,尽管我很想看到一个更简洁的版本: