zoukankan      html  css  js  c++  java
  • pig中cogroup的使用

     

    %default file test.txt

    A = load '$file' as (date, web, name, food);

    B = load '$file' as (date, web, name, food);

    C= cogroup A by $0, B by $1;

    describe C;

    illustrate C;

    dumpC;

    cogroup命令中$0$1,两个列的内容如果不一样,就是分别生成两个批次的group,先按A值分组,在按B对应的值分组。按A的值分组时,B对应的为空,则group中有一个空组{}

    但如果内容一样,如C= cogroup Aby $1, B by $1;就是生成一个批次的group,其中包含AB两个表中所有的等于该值的元组。

     

    另外,load命令写完后,实际不会立刻执行(例如执行describeA也只是生成一个数据结构,不会从文件中读入数据),而是等待illustrate,和dump命令后,才会真正读入数据到AB中。

  • 相关阅读:
    text/css什麼意思
    w3cschool的在線編輯器的特點
    html
    notepad编写html
    html学习心得
    html 链接
    資料鏈接
    微信小程序的界面下拉刷新
    C# PictureBox控件畫圖
    CPK公式
  • 原文地址:https://www.cnblogs.com/cl1024cl/p/6205755.html
Copyright © 2011-2022 走看看