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.