Comments (9)
jshs2 is hive server2 client library, for querying. That is not suitable server management.
from jshs2.
I might be missing it in the docs. Is there a sample of using this to do something like SELECT * from tableName
? I can't find it in the docs or the tests.
from jshs2.
in my testcase PromiseTest.js (similar in README.md),
var options = {};
options.auth = config[config.use].auth;
options.host = config[config.use].host;
options.port = config[config.use].port;
options.timeout = config[config.use].timeout;
options.username = config[config.use].username;
options.hiveType = config[config.use].hiveType;
options.hiveVer = config[config.use].hiveVer;
options.cdhVer = config[config.use].cdhVer;
options.thriftVer = config[config.use].thriftVer;
options.maxRows = config[config.use].maxRows;
options.nullStr = config[config.use].nullStr;
options.i64ToString = config[config.use].i64ToString;
testConf.config = config;
testConf.jshs2 = options;
set your environment,
configuration = new Configuration(testConf.jshs2);
yield configuration.initialize();
initialize jshs2 object,
connection = new Connection(configuration);
cursor = yield connection.connect();
create connection,
serviceType = cursor.getConfigure().getServiceType();
execResult = yield cursor.execute(testConf.config.Query.query);
for (i = 0, len = 1000; i < len; i++) {
status = yield cursor.getOperationStatus();
log = yield cursor.getLog();
debug('wait, status -> ', hs2util.getState(serviceType, status));
debug('wait, log -> ', log);
if (hs2util.isFinish(cursor, status)) {
debug('Status -> ', status, ' -> stop waiting');
break;
}
yield hs2util.pSleep(10000);
}
execute and check operation status.
if (execResult.hasResultSet) {
schema = yield cursor.getSchema();
debug('schema -> ', schema);
fetchResult = yield cursor.fetchBlock();
debug('first row ->', JSON.stringify(fetchResult.rows[0]));
debug('rows ->', fetchResult.rows.length);
debug('rows ->', fetchResult.hasMoreRows);
}
fetch data
return {
hasResultSet: execResult.hasResultSet,
rows: (execResult.hasResultSet) ? fetchResult.rows : []
};
return data for callee
Everything in my testcase PromiseTest.js. If you use old node.js version, use callback version.
from jshs2.
In your Example code, where is cursor defined?
const execResult = yield cursor.execute(config.Query.query);
from jshs2.
Plz, see my answer,
connection = new Connection(configuration);
cursor = yield connection.connect();
That is cursor.
from jshs2.
The example is confusing because the cursor is never initialized, where is the let/var/const? I can figure that out of course.
It's also odd that a connect function would return a cursor -- I think of a cursor as a set of results you can iterate through (paging etc), not a connection.
The library would be more readable if it was more like:
connection = new Connection(configuration);
cursor = yield connection.query(query);
// iterate first set of results in cursor
// or use a while hasResults loop
from jshs2.
In your Example in the README on this line:
const execResult = yield cursor.execute(config.Query.query);
This will always fail because cursor is null. The example seems to be missing something.
from jshs2.
Very Agree ! Maybe you can make a littler example,this doc is difficult for those who are not familiar with Promise
from jshs2.
@wuwanyu we've decided that webhcat will work better for our needs, we just need to set up a server to listen for web callbacks
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
- try cursor.execute(query), but execute is not a function? HOT 4
- 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
- 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.