What is use of hcatalog in hadoop?

前端 未结 5 1904
醉梦人生
醉梦人生 2020-12-24 07:26

I\'m new to Hadoop. I know that the HCatalog is a table and storage management layer for Hadoop. But how exactly it works and how to use it. Please give some simple example.

5条回答
  •  旧巷少年郎
    2020-12-24 08:11

    Here is a very basic example of how ho use HCATALOG.

    I have a table in hive ,TABLE NAME is STUDENT which is stored in one of the HDFS location:

    neethu 90 malini 90 sunitha 98 mrinal 56 ravi 90 joshua 8

    Now suppose I want to load this table to pig for further transformation of data, In this scenario I can use HCATALOG:

    When using table information from the Hive metastore with Pig, add the -useHCatalog option when invoking pig:

    pig -useHCatalog

    (you may want to export HCAT_HOME 'HCAT_HOME=/usr/lib/hive-hcatalog/')

    Now loading this table to pig: A = LOAD 'student' USING org.apache.hcatalog.pig.HCatLoader();

    Now you have loaded the table to pig.To check the schema , just do a DESCRIBE on the relation.

    DESCRIBE A

    Thanks

提交回复
热议问题