presto-client
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -153,6 +153,8 @@ var http = require('http'); | ||
client.request(req, function(err, code, data){ | ||
if (err || code !== 200) { | ||
if (err || code !== 200 || (data && data.error)) { | ||
if (error_callback) { | ||
var message = "execution error" + (data && data.length > 0 ? ":" + data : ""); | ||
error_callback({message:message, error: err, code: code}); | ||
if (data && data.error && data.error.message) | ||
message = data.error.message; | ||
error_callback({message:message, error: (err || data.error), code: code}); | ||
} | ||
@@ -159,0 +161,0 @@ return; |
{ | ||
"name": "presto-client", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Distributed query engine Presto client library for node.js", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
13
test.js
var presto = require('presto-client'); | ||
var client = new presto.Client({host:'nvlogpt1502', catalog:'hive', schema:'default'}); | ||
var client = new presto.Client({host:'master203.analysis', catalog:'hive', schema:'default'}); | ||
@@ -7,2 +8,12 @@ | ||
client.execute({ | ||
query: "SELECT banner_target, application AS device, version, COUNT(IF(eventid = '1703950', 1, NULL)) AS views, COUNT(IF(eventid = '1703942', 1, NULL)) AS clicks FROM (SELECT mid,application,version,eventid,params, IF(substr(params['393221'], 0, 7) = 'http://', split(parse_url(params['393221'],'PATH'),'/')[3], params['393221'] ) AS banner_target FROM ( SELECT mid, application, version, split(body,' ')[1] AS eventid, str_to_map(body, ' ', '=') AS params FROM lca WHERE dt='20140206-1800' ) x WHERE eventid IN ('1703950', '1703942') ) y GROUP BY banner_target,application,version ORDER BY banner_target LIMIT 100000", | ||
cancel: function(){ return canceled; }, | ||
columns: function(error, data){ console.log({p:"columns", error: error, data: data}); }, | ||
data: function(error, data, columns, stats){ console.log({p:"data", error: error, data: data, columns: columns, stats: stats}); }, | ||
success: function(error, stats){ console.log({p:"success", error: error, stats: stats}); }, | ||
error: function(error){ console.log({p:"error", error: error}); console.log(JSON.stringify(error)); } | ||
}); | ||
client.execute({ | ||
query: "select count(*) as cnt from hourly_log where service='ldproxy' and yyyymmddhh='2014013010'", | ||
@@ -13,3 +24,3 @@ cancel: function(){ return canceled; }, | ||
success: function(error, stats){ console.log({p:"success", error: error, stats: stats}); }, | ||
error: function(error){ console.log({p:"error", error: error}); } | ||
error: function(error){ console.log({p:"error", error: error}); console.log(JSON.stringify(error)); } | ||
}); | ||
@@ -16,0 +27,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18757
326