복붙노트

[HADOOP] 돼지의 한 줄 입력에서 여러 줄 출력 생성

HADOOP

돼지의 한 줄 입력에서 여러 줄 출력 생성

필자의 요구 사항은 pig scripting에서 단일 입력 줄을 사용하여 여러 줄의 출력을 생성하는 것입니다. 가능한 해결책은 무엇입니까?

해결법

  1. ==============================

    1.아이디어는 입력 줄을 백으로 변환 한 다음 평평하게하는 것입니다. 두 가지 경우가 있습니다.

    아이디어는 입력 줄을 백으로 변환 한 다음 평평하게하는 것입니다. 두 가지 경우가 있습니다.

    텍스트 읽기 :

    txt = load '/pig_fun/input/text.txt' using TextLoader();
    words = foreach txt generate TOKENIZE($0);
    pivoted = foreach words generate FLATTEN($0);
    dump pivoted;
    

    입력:

    My requirement is to generate multiple lines of output by using single line of input in pig scripting.
    What are the possible solutions?
    

    산출:

    (My)
    (requirement)
    (is)
    (to)
    (generate)
    (multiple)
    (lines)
    (of)
    (output)
    (by)
    (using)
    (single)
    (line)
    (of)
    (input)
    (in)
    (pig)
    (scripting.)
    (What)
    (are)
    (the)
    (possible)
    (solutions?)
    

    열을 읽은 다음 피벗하면 Apache Pig로 피벗 테이블을 볼 수 있습니다.

  2. from https://stackoverflow.com/questions/11205235/generating-multiple-lines-output-from-single-line-input-in-pig by cc-by-sa and MIT license