TheDeveloperBlog.com

Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

Hive Load Data

Hive Load Data with tutorial, introduction, environment setup, first app hello world, state, props, flexbox, height and width, listview, scrollview, images, buttons, router, etc.

<< Back to HIVE

Hive - Load Data

Once the internal table has been created, the next step is to load the data into it. So, in Hive, we can easily load data from any file to the database.

  • Let's load the data of the file into the database by using the following command: -
load data local inpath '/home/codegyani/hive/emp_details' into table demo.employee;

Hive Load Data

Here, emp_details is the file name that contains the data.

  • Now, we can use the following command to retrieve the data from the database.
select * from demo.employee;

Hive Load Data
Hive Load Data
  • If we want to add more data into the current database, execute the same query again by just updating the new file name.
load data local inpath '/home/codegyani/hive/emp_details1' into table demo.employee;

Hive Load Data
  • Let's check the data of an updated table: -
Hive Load Data
  • In Hive, if we try to load unmatched data (i.e., one or more column data doesn't match the data type of specified table columns), it will not throw any exception. However, it stores the Null value at the position of unmatched tuple.
  • Let's add one more file to the current table. This file contains the unmatched data.
Hive Load Data

Here, the third column contains the data of string type, and the table allows the float type data. So, this condition arises in an unmatched data situation.

  • Now, load the data into the table.
load data local inpath '/home/codegyani/hive/emp_details2' into table demo.employee;

Hive Load Data

Here, data loaded successfully.

  • Let's fetch the records of the table.
select * from demo.employee

Hive Load Data

Here, we can see the Null values at the position of unmatched data.

Next TopicHive - Drop Table




Related Links:


Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf