How to load xml file in hive
Community.cloudera.com › Support-Questions › Best-way-to-create-Hive-t.
We are working on loading a semi-structured XML file in Hive tables.!
Hive – Load Data Into Table
Hive tables provide us the schema to store data in various formats (like CSV). Hive provides multiple ways to add data to the tables.
We can use DML(Data Manipulation Language) queries in Hive to import or add data to the table. One can also directly put the table into the hive with HDFS commands. In case we have data in Relational Databases like MySQL, ORACLE, IBM DB2, etc.
then we can use Sqoop to efficiently transfer PetaBytes of data between Hadoop and Hive.
Using XPATH() method we are fetching the values stored under /emp/esal/ and /emp/.In this particular tutorial, we will be using Hive DML queries to Load or INSERT data to the Hive table.
To perform the below operation make sure your hive is running. Below are the steps to launch a hive on your local system.
Step 1: Start all your Hadoop Daemon
start-dfs.sh # this will start namenode, datanode and secondary namenode start-yarn.sh # this will start node manager and resource manager jps # To check running daemonsStep 2: Launch hive from terminal
hiveIn hive with DML statements, we can add data to the Hive table in 2 different ways.
- Using INS