Pig: loading a data file using an external schema file

后端 未结 2 1354
无人及你
无人及你 2021-01-18 19:54

I have a data file and a corresponding schema file stored in separate locations. I would like to load the data using the schema in the schema-file. I tried using

<         


        
2条回答
  •  北恋
    北恋 (楼主)
    2021-01-18 20:06

    It's possible to load data with schema file.

    When you store your data with the '-schema' flag, in the output path, there is .pig-schema file that hold json with the schema.

    You can use it when loading data

    B = LOAD '<>' USING PigStorage(',','-schema'); 
    

    You can see the schema by running

    describe A;
    

    Check this good post for more details.

    This feature is available beginning with Pig 0.10.

提交回复
热议问题