HIVE Thrift Server usage Summary

Source: Internet
Author: User
Tags dot net

The report front-end is written using dot net mvc. To obtain detailed data from HIVE, the current solution is to use hive thriftserver.

1. Generate the C # class file corresponding to HIVE Thrift

The problem is that the fb303.thrift file referenced in thriftserver. thrift cannot be found. Solution: copy it from the thrift source code directory. Then use thriftserver. thrift generates four class files and copies them to the Project for compilation. The other three referenced files have to use thrift to generate C # classes respectively, finally, copy dozens of class files to the project, modify the project properties, change framework 4 client profile to framework 4, and compile it.

 

The client code is as follows:

Static void Main (string [] args)
{
TTransport transport = new TSocket ("192.168.1.1", 10000 );
TProtocol protocol = new TBinaryProtocol (transport );
Thrithive. Client client = new thrithive. Client (protocol );

Transport. Open ();
// Client.exe cute ("add file/data/home/script/ad_resolve2.py ;");
Client.exe cute ("select * from web_pv_log_detail3 where dt = '2017-09-10 'limit 10 ");
Console. WriteLine ("the result is :");


Var items = client. fetchAll ();
Foreach (var item in items)
{
Console. WriteLine (item );
}
Transport. Close ();

Console. ReadLine ();
}

 

2. Start the Server Service:

Hive -- service hiveserver

3. Test. It is found that fetch is called After execute is called multiple times, and the last execute result is obtained each time. It is skeptical about the availability of multi-threaded calls.

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.