1. <legend id='5qbXA'><style id='5qbXA'><dir id='5qbXA'><q id='5qbXA'></q></dir></style></legend>
    <tfoot id='5qbXA'></tfoot>

  2. <i id='5qbXA'><tr id='5qbXA'><dt id='5qbXA'><q id='5qbXA'><span id='5qbXA'><b id='5qbXA'><form id='5qbXA'><ins id='5qbXA'></ins><ul id='5qbXA'></ul><sub id='5qbXA'></sub></form><legend id='5qbXA'></legend><bdo id='5qbXA'><pre id='5qbXA'><center id='5qbXA'></center></pre></bdo></b><th id='5qbXA'></th></span></q></dt></tr></i><div id='5qbXA'><tfoot id='5qbXA'></tfoot><dl id='5qbXA'><fieldset id='5qbXA'></fieldset></dl></div>

    <small id='5qbXA'></small><noframes id='5qbXA'>

      • <bdo id='5qbXA'></bdo><ul id='5qbXA'></ul>

      猪中的组串联等价物?

      时间:2023-08-22
        <bdo id='mHwI2'></bdo><ul id='mHwI2'></ul>

              <legend id='mHwI2'><style id='mHwI2'><dir id='mHwI2'><q id='mHwI2'></q></dir></style></legend>
              <tfoot id='mHwI2'></tfoot>

              <small id='mHwI2'></small><noframes id='mHwI2'>

                <tbody id='mHwI2'></tbody>
            • <i id='mHwI2'><tr id='mHwI2'><dt id='mHwI2'><q id='mHwI2'><span id='mHwI2'><b id='mHwI2'><form id='mHwI2'><ins id='mHwI2'></ins><ul id='mHwI2'></ul><sub id='mHwI2'></sub></form><legend id='mHwI2'></legend><bdo id='mHwI2'><pre id='mHwI2'><center id='mHwI2'></center></pre></bdo></b><th id='mHwI2'></th></span></q></dt></tr></i><div id='mHwI2'><tfoot id='mHwI2'></tfoot><dl id='mHwI2'><fieldset id='mHwI2'></fieldset></dl></div>

                本文介绍了猪中的组串联等价物?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                试图在 Pig 上完成这项工作.(寻找相当于 MySQL 的 group_concat())

                Trying to get this done on Pig. (Looking for the group_concat() equivalent of MySQL)

                例如,在我的表中,我有这个:(3fields- userid, clickcount,pagenumber)

                In my table, for example, I have this: (3fields- userid, clickcount,pagenumber)

                155 | 2 | 12
                155 | 3 | 133
                155 | 1 | 144
                156 | 6 | 1
                156 | 7 | 5
                

                所需的输出是:

                155| 2,3,1 | 12,133,144
                
                156| 6,7 | 1,5
                

                我怎样才能在 PIG 上实现这一点?

                How can I achieve this on PIG?

                推荐答案

                grouped = GROUP table BY userid;
                   X = FOREACH grouped GENERATE group as userid, 
                                                table.clickcount as clicksbag, 
                                                table.pagenumber as pagenumberbag;
                

                现在 X 将是:

                {(155,{(2),(3),(1)},{(12),(133),(144)},
                 (156,{(6),(7)},{(1),(5)}}
                

                现在您需要使用 内置 UDF BagToTuple:

                output = FOREACH X GENERATE userid, 
                                            BagToTuple(clickbag) as clickcounts, 
                                            BagToTuple(pagenumberbag) as pagenumbers;
                

                output 现在应该包含您想要的内容.您也可以将输出步骤合并到合并步骤中:

                output should now contain what you want. You can merge the output step into the merge step as well:

                    output = FOREACH grouped GENERATE group as userid, 
                                     BagToTuple(table.clickcount) as clickcounts, 
                                     BagToTuple(table.pagenumber) as pagenumbers;
                

                这篇关于猪中的组串联等价物?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:一种从Mysql读取表数据到Pig的方法 下一篇:在 Apache Spark 2.0.0 中,是否可以从外部数据库获取

                相关文章

                最新文章

              1. <small id='SV9sO'></small><noframes id='SV9sO'>

                    <legend id='SV9sO'><style id='SV9sO'><dir id='SV9sO'><q id='SV9sO'></q></dir></style></legend><tfoot id='SV9sO'></tfoot>
                      <bdo id='SV9sO'></bdo><ul id='SV9sO'></ul>

                    <i id='SV9sO'><tr id='SV9sO'><dt id='SV9sO'><q id='SV9sO'><span id='SV9sO'><b id='SV9sO'><form id='SV9sO'><ins id='SV9sO'></ins><ul id='SV9sO'></ul><sub id='SV9sO'></sub></form><legend id='SV9sO'></legend><bdo id='SV9sO'><pre id='SV9sO'><center id='SV9sO'></center></pre></bdo></b><th id='SV9sO'></th></span></q></dt></tr></i><div id='SV9sO'><tfoot id='SV9sO'></tfoot><dl id='SV9sO'><fieldset id='SV9sO'></fieldset></dl></div>