In Java, sqoop exports data from Oracle to Hive

Source: Internet
Author: User
Tags sqoop

After the project was completed, we found the tragedy. By default, sqoop was used to list data tables from Oracle databases. If the data accuracy is greater than 15 digits, some fields in the imported table are of the double type by default. As a result, more than 16 fields are imported to hive. The query time is only 15-bit precise. Sorry, remember.

Hadoop cluster-based Hive Installation

Differences between Hive internal tables and external tables

Hadoop + Hive + Map + reduce cluster installation and deployment

Install in Hive local standalone Mode

WordCount word statistics for Hive Learning

 

Public class HelloWorld {

 
Public static void main (String args []) {
// Double dou = 9813113054842628;
String s = "9813113054842628 ";
System. out. println (Double. valueOf (s ));

String s1 = "9813113054842627 ";
System. out. println (Double. valueOf (s1 ));


}
}

Output result

9.813113054842628E15

9.813113054842628E15

The reason is that the oracle Number precision is greater than the double type in java.

Hive details: click here
Hive: click here

This article permanently updates the link address:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.