ufukomer / node-impala

Node Client for Impala using Apache Thrift
https://www.npmjs.com/package/node-impala
MIT License
31 stars 12 forks source link

Node.js Impala client TapplicationException error #7

Closed nandakumar8 closed 8 years ago

nandakumar8 commented 8 years ago

Hi ,

I am trying to connect to impala using the package and i'm getting the TapplicationExcpetion error.

In server.js

var impala=require('node-impala'); app.post('/submit_dsp_block',function(req,res){ var day=req.body.day; var limit=req.body.limit; console.log(day); console.log(limit); console.log(impala); var client = impala.createClient(); console.log(client); console.log("trying to connect"); client.connect( { host:'10.201.50.11', port: 21050, resultType: 'json-array' }); console.log("client connected"); client.query('select * from rpt.rptdaily limit 100') .then(result => console.log(result)) .catch(err => console.error(err)); .done(() => client.close().catch(err => console.error(err))); });

This is the console result in git bash:

node server.js Example app listening on port 3000! 2016-08-15 100 { createClient: [Function: createClient] } ImpalaClient {} trying to connect client connected { [TApplicationException: Invalid method name: 'query'] name: 'TApplicationException', message: 'Invalid method name: \'query\'', type: 1 }

Guess my client is getting connected, but there is problem with the query. Also how do i execute prepared query using node-impala , for example something like this

var day=req.body.day; var limit=req.body.limit; client.execute('select* from portal.pubdomainstats where day=? limit ?',[day,limit], function (err, result) { if (err) { return console.error('There was while trying to retrieve data from system.local', err); }

I'm pretty new to node.js and would be helpful if I can get a layman's answer to my problem

Thanks

nandakumar8 commented 8 years ago

I changed the port to 21000 and I was able to execute the query and get the result set. Can anyone explain why..In our system Impala's port is 21050. Also how do I query and receive a large result set say ten thousand records using node-impala package. Once more thing, it would be great if someone helps me with the prepared query, i'm using a form to receive input parameters for my query.

Thanks

ufukomer commented 8 years ago

@nandakumar8 It needs the improvement that I've mentioned in the issue #4 to surmount result limit, and I'm not planning to do this in the near future. But of course you're free to contribute...

By the way port is 21000 in Cloudera check this link. 21050 is belongs to something else I don't remember right now.