Comments (4)
There are visible two issues in above code:
connection.connect()
--> it is a promise, which needs to be written differently.
connection.connect.then( (cursor) => { /*your cursor related code goes here.. */ });
Similarly, in your cursor code, you would get results. i.e.
cursor.execute("sql query..").then( (results) => { /* data handling code goes here..*/ })
It need not have resolve and reject, inside then callback.
from jshs2.
I'm writing the same code and I have the same problem.
How to fix it ?
from jshs2.
I am getting the same error. Is there a workaround for this?
Is there something I am doing wrong?
--------------------CODE----------------------
const jshs2 = require('jshs2');
const HS2Util = jshs2.HS2Util;
const IDLContainer = jshs2.IDLContainer;
const HiveConnection = jshs2.HiveConnection;
const Configuration = jshs2.Configuration;
console.log("In server.js");
const options1 = {
// Connection configuration
auth: 'NOSASL',
host: '127.0.0.1', // HiveServer2 hostname
port: '10000', // HiveServer2 port
timeout: 10000, // Connection timeout
username: 'admin', // HiveServer2 user
password: 'admin', // HiveServer2 password
hiveType: HS2Util.HIVE_TYPE.HIVE, // HiveServer2 type, (Hive or CDH Hive)
hiveVer: '1.1.0', // HiveServer2 Version
thriftVer: '0.9.2', // Thrift version at IDL Compile time
maxRows: 5120,
nullStr: 'NULL',
i64ToString: true,
};
const configure = new Configuration(options1);
const idl = new IDLContainer();
idl.initialize(configure).then(() => {
connection = new HiveConnection(configure, idl);
cursor = connection.connect();
serviceType = idl.ServiceType;
console.log("Cursor getting initialised", cursor);
cursor.execute("select * from test.test_table;").then((resolve)=>{
console.log("Resolved");
}, (reject)=>{
console.log("Rejected");
});
console.log("In the end");
});
----------------------------OUTPUT---------------------------------
In server.js Cursor getting initialised Promise { <pending> } (node:31149) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: cursor.execute is not a function (node:31149) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
from jshs2.
Thanks a lot @vineetma . Checked my Thrift hive logs and this code is hitting request, but somehow it is failing as
17/11/25 16:51:31 ERROR TThreadPoolServer: Error occurred during processing of message.
java.lang.RuntimeException: org.apache.thrift.transport.TTransportException: Invalid status -128
at org.apache.thrift.transport.TSaslServerTransport$Factory.getTransport(TSaslServerTransport.java:219)
at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:269)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.thrift.transport.TTransportException: Invalid status -128
at org.apache.thrift.transport.TSaslTransport.sendAndThrowMessage(TSaslTransport.java:232)
at org.apache.thrift.transport.TSaslTransport.receiveSaslMessage(TSaslTransport.java:184)
at org.apache.thrift.transport.TSaslServerTransport.handleSaslStartMessage(TSaslServerTransport.java:125)
at org.apache.thrift.transport.TSaslTransport.open(TSaslTransport.java:271)
at org.apache.thrift.transport.TSaslServerTransport.open(TSaslServerTransport.java:41)
at org.apache.thrift.transport.TSaslServerTransport$Factory.getTransport(TSaslServerTransport.java:216)
... 4 more
For now, I am using this post to get it done:
https://dzone.com/articles/connect-apache-spark-sql-to-nodejs-on-linux-via-jd
from jshs2.
Related Issues (18)
- getLog problem solve HOT 1
- How can I know the query progress? HOT 2
- can this support spark sql? HOT 2
- can it not set 'NOSASL '? HOT 1
- org.apache.thrift.transport.TTransportException: Invalid status -128 HOT 1
- I am facing an issue with timed out when i run test run HOT 1
- HiveQL question on SO HOT 1
- test script is not working. HOT 2
- Cannot get test to pass HOT 1
- example code in "Simple Usage" HOT 2
- Not able to connect to db HOT 3
- Only get 1024 data from hive server
- Vulnerable version of lodash HOT 1
- error in connection HOT 1
- The thrift dependency is bloated HOT 6
- question: is this library used for querying or for management? HOT 9
- why no response??? HOT 22
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jshs2.