我把下面的数据放到Hive表里;
select pid, year, catches from fielding_s where pid = 'zobribe01' group by id;
zobribe01 2006 [{"p1":52,"p2":50,"p3":1322,"p4":86}]
zobribe01 2007 [{"p1":30,"p2":26,"p3":674,"p4":37}]
zobribe01 2008 [{"p1":8,"p2":4,"p3":123,"p4":11}]
zobribe01 2008 [{"p1":1,"p2":0,"p3":14,"p4":0}]
zobribe01 2008 [{"p1":5,"p2":3,"p3":81,"p4":8}]
zobribe01 2008 [{"p1":14,"p2":8,"p3":238,"p4":21}]
zobribe01 2008 [{"p1":19,"p2":12,"p3":340,"p4":29}]
zobribe01 2008 [{"p1":2,"p2":1,"p3":21,"p4":0}]
zobribe01 2008 [{"p1":35,"p2":33,"p3":880,"p4":51}]
zobribe01 2009 [{"p1":3,"p2":2,"p3":39,"p4":6}]
zobribe01 2009 [{"p1":91,"p2":81,"p3":2144,"p4":143}]
zobribe01 2009 [{"p1":1,"p2":1,"p3":17,"p4":0}]
zobribe01 2009 [{"p1":7,"p2":5,"p3":140,"p4":15}]
zobribe01 2009 [{"p1":1,"p2":null,"p3":null,"p4":null}]
zobribe01 2009 [{"p1":9,"p2":2,"p3":114,"p4":8}]
zobribe01 2009 [{"p1":70,"p2":44,"p3":1242,"p4":112}]
zobribe01 2009 [{"p1":59,"p2":37,"p3":988,"p4":89}]
zobribe01 2009 [{"p1":13,"p2":6,"p3":186,"p4":9}]
zobribe01 2010 [{"p1":14,"p2":9,"p3":237,"p4":77}]
zobribe01 2010 [{"p1":55,"p2":45,"p3":1113,"p4":74}]
zobribe01 2010 [{"p1":2,"p2":1,"p3":30,"p4":1}]
zobribe01 2010 [{"p1":14,"p2":9,"p3":250,"p4":22}]
zobribe01 2010 [{"p1":1,"p2":0,"p3":6,"p4":0}]
zobribe01 2010 [{"p1":110,"p2":89,"p3":2504,"p4":204}]
zobribe01 2010 [{"p1":103,"p2":80,"p3":2248,"p4":182}]
zobribe01 2011 [{"p1":131,"p2":118,"p3":3175,"p4":213}]
zobribe01 2011 [{"p1":38,"p2":33,"p3":869,"p4":65}]
我想使用to\u map函数将这些行合并到一个表中。我运行下面的查询,但它给我下面的错误。
select pid, to_map(year, catches) from fielding_s where pid = 'zobribe01' group by pid;
失败:semanticexception[错误10025]:行1:12表达式不在group by键“catch”中
1条答案
按热度按时间wxclj1h51#
拆下
group by
子句,然后重试