adaltas / node-thrift-hive

Hive client using the Apache Thrift RPC system
http://www.adaltas.com
Other
28 stars 10 forks source link

Not Connecting to Thrift Server #3

Closed sohimankotia closed 8 years ago

sohimankotia commented 8 years ago

Hi I am using following code :


var assert     = require('assert');
var thrift     = require('thrift');
var transport  = require('thrift/lib/nodejs/lib/thrift/transport');
var ThriftHive = require('thrift-hive/lib/0.7.1-cdh3u2/ThriftHive');
// Client connection 
var options = {transport: transport.TBufferedTransport, timeout: 1000 };
var connection = thrift.createConnection('localhost', 10001, options);
var client = thrift.createClient(ThriftHive, connection);
// Execute query 
client.execute('use default', function(err){
    client.execute('show tables', function(err){
        assert.ifError(err);
        client.fetchAll(function(err, databases){
            if(err){
                console.log(err.message);
            }else{
                console.log(databases);
            }
            connection.end();
        });
    });
});

Its not working .While debugging also it is showing connect = false .

As I able to connect through beeline : !connect jdbc:hive2://localhost:10001 hduser hadoop org.apache.hive.jdbc.HiveDriver

Thanks in advance

wdavidw commented 8 years ago

This module is connecting to the hive metastore through thrift. The generated thrifs code that we used is old (at least 3 years old) and you'll have to generated the code aligned with your version. See this directory. I havent used this package lately but it shall be working once you get the appropriate generated thrift code.

jiacai2050 commented 8 years ago

@wdavidw

How to generate thrift code for a specific version of hive ?

PS: sorry, I have found method in hive doc

wdavidw commented 8 years ago

good, then i close this issue