imjuni / jshs2

jsHS2 is a node.js client driver for hive server 2
http://imjuni.github.io/jshs2/
MIT License
34 stars 12 forks source link

How can I know the query progress? #10

Closed xushuo closed 7 years ago

xushuo commented 7 years ago

How can I know the query progress? How long does it take to query about? I want to monitor the state of the query, including time, progress. such as : A = The number of the current task finished. B = The number of the total task finished. pencent C = A/B;

xushuo commented 7 years ago

I didn't find similar properties in cursor . cursor = yield connection.connect();

imjuni commented 7 years ago

Sorry for late answer.

If you use hive >= 1.x, you can use getLog function. Log have time, progress information. Also use getOperationState. That indicate query state using enumeration

// in jshs2/idl/Thrift_0.9.3_Hive_2.1.0/TCLIService_types.js
ttypes.TOperationState = {
  'INITIALIZED_STATE' : 0,
  'RUNNING_STATE' : 1,
  'FINISHED_STATE' : 2,
  'CANCELED_STATE' : 3,
  'CLOSED_STATE' : 4,
  'ERROR_STATE' : 5,
  'UKNOWN_STATE' : 6,
  'PENDING_STATE' : 7,
  'TIMEDOUT_STATE' : 8
};

FYI