Permalink
Browse files

Convert to 2 spaces

  • Loading branch information...
wdavidw committed Nov 13, 2012
1 parent 2f5fce8 commit 787cb0ec4d53ce21273416707696366bd13c3801
View
@@ -22,25 +22,25 @@ npm install thrift-hive
var hive = require('thrift-hive');
// Client connection
var client = hive.createClient({
- version: '0.7.1-cdh3u2',
- server: '127.0.0.1',
- port: 10000,
- timeout: 1000
+ version: '0.7.1-cdh3u2',
+ server: '127.0.0.1',
+ port: 10000,
+ timeout: 1000
});
// Execute call
client.execute('use default', function(err){
- // Query call
- client.query('show tables')
- .on('row', function(database){
- console.log(database);
- })
- .on('error', function(err){
- console.log(err.message);
- client.end();
- });
- .on('end', function(){
- client.end();
- });
+ // Query call
+ client.query('show tables')
+ .on('row', function(database){
+ console.log(database);
+ })
+ .on('error', function(err){
+ console.log(err.message);
+ client.end();
+ });
+ .on('end', function(){
+ client.end();
+ });
});
```
@@ -81,14 +81,14 @@ Available API
hive = require 'thrift-hive'
# Client connection
client = hive.createClient
- version: '0.7.1-cdh3u2'
- server: '127.0.0.1'
- port: 10000
- timeout: 1000
+ version: '0.7.1-cdh3u2'
+ server: '127.0.0.1'
+ port: 10000
+ timeout: 1000
# Execute
client.execute 'USE default', (err) ->
- console.log err.message if err
- client.end()
+ console.log err.message if err
+ client.end()
```
## Hive Query
@@ -128,18 +128,18 @@ fs = require 'fs'
hive = require 'thrift-hive'
# Client connection
client = hive.createClient
- version: '0.7.1-cdh3u2'
- server: '127.0.0.1'
- port: 10000
- timeout: 1000
+ version: '0.7.1-cdh3u2'
+ server: '127.0.0.1'
+ port: 10000
+ timeout: 1000
# Execute query
client.query('show tables')
.on 'row', (database) ->
- this.emit 'data', 'Found ' + database + '\n'
+ this.emit 'data', 'Found ' + database + '\n'
.on 'error', (err) ->
- client.end()
+ client.end()
.on 'end', () ->
- client.end()
+ client.end()
.pipe( fs.createWriteStream "#{__dirname}/pipe.out" )
```
@@ -159,17 +159,17 @@ var connection = thrift.createConnection('127.0.0.1', 10000, options);
var client = thrift.createClient(ThriftHive, connection);
// Execute query
client.execute('use default', function(err){
- client.execute('show tables', function(err){
- assert.ifError(err);
- client.fetchAll(function(err, databases){
- if(err){
- console.log(err.message);
- }else{
- console.log(databases);
- }
- connection.end();
- });
+ client.execute('show tables', function(err){
+ assert.ifError(err);
+ client.fetchAll(function(err, databases){
+ if(err){
+ console.log(err.message);
+ }else{
+ console.log(databases);
+ }
+ connection.end();
});
+ });
});
```
View
@@ -1,21 +1,21 @@
{
- "name": "thrift-hive",
- "description": "Hive client using the Apache Thrift RPC system",
- "version": "0.0.6",
- "author": "David Worms",
- "contributors": [
- { "name": "David Worms", "email": "david@adaltas.com" }
- ],
- "dependencies": {
- "thrift": "latest",
- "each": "latest"
- },
- "devDependencies": {
- "coffee-script": "latest",
- "mocha": "latest",
- "should": "latest"
- },
- "keywords": ["hive", "nosql", "hadoop"],
- "main": "index",
- "engines": { "node": ">= 0.4.7" }
+ "name": "thrift-hive",
+ "description": "Hive client using the Apache Thrift RPC system",
+ "version": "0.0.6",
+ "author": "David Worms",
+ "contributors": [
+ { "name": "David Worms", "email": "david@adaltas.com" }
+ ],
+ "dependencies": {
+ "thrift": "latest",
+ "each": "latest"
+ },
+ "devDependencies": {
+ "coffee-script": "latest",
+ "mocha": "latest",
+ "should": "latest"
+ },
+ "keywords": ["hive", "nosql", "hadoop"],
+ "main": "index",
+ "engines": { "node": ">= 0.4.7" }
}
View
@@ -3,11 +3,11 @@
hive = require 'thrift-hive'
# Client connection
client = hive.createClient
- version: '0.7.1-cdh3u2'
- server: '127.0.0.1'
- port: 10000
- timeout: 1000
+ version: '0.7.1-cdh3u2'
+ server: '127.0.0.1'
+ port: 10000
+ timeout: 1000
# Execute
client.execute 'USE default', (err) ->
- console.log err.message if err
- client.end()
+ console.log err.message if err
+ client.end()
View
@@ -4,16 +4,16 @@ fs = require 'fs'
hive = require 'thrift-hive'
# Client connection
client = hive.createClient
- version: '0.7.1-cdh3u2'
- server: '127.0.0.1'
- port: 10000
- timeout: 1000
+ version: '0.7.1-cdh3u2'
+ server: '127.0.0.1'
+ port: 10000
+ timeout: 1000
# Execute query
client.query('show tables')
.on 'row', (database) ->
- this.emit 'data', 'Found ' + database + '\n'
+ this.emit 'data', 'Found ' + database + '\n'
.on 'error', (err) ->
- client.end()
+ client.end()
.on 'end', () ->
- client.end()
+ client.end()
.pipe( fs.createWriteStream "#{__dirname}/pipe.out" )
View
@@ -6,16 +6,16 @@ hive = require "#{__dirname}/.."
client = hive.createClient()
client.execute 'use test_database', (err) ->
- assert.ifError err
- query = client.query('select * from test_table limit 10', 10)
- .on 'row', (row) ->
- query.pause()
- setTimeout ->
- console.log row
- query.resume()
- , 100
- .on 'error', (err) ->
- .on 'end', () ->
- console.log err.message if err
- client.end()
-
+ assert.ifError err
+ query = client.query('select * from test_table limit 10', 10)
+ .on 'row', (row) ->
+ query.pause()
+ setTimeout ->
+ console.log row
+ query.resume()
+ , 100
+ .on 'error', (err) ->
+ .on 'end', () ->
+ console.log err.message if err
+ client.end()
+
View
@@ -1,7 +1,7 @@
#!/usr/bin/env node
-var assert = require('assert');
-var thrift = require('thrift');
+var assert = require('assert');
+var thrift = require('thrift');
var transport = require('thrift/lib/thrift/transport');
var ThriftHive = require('../lib/0.7.1-cdh3u2/ThriftHive');
// Client connection
@@ -10,15 +10,15 @@ var connection = thrift.createConnection('127.0.0.1', 10000, options);
var client = thrift.createClient(ThriftHive, connection);
// Execute query
client.execute('use default', function(err){
- client.execute('show tables', function(err){
- assert.ifError(err);
- client.fetchAll(function(err, databases){
- if(err){
- console.log(err.message);
- }else{
- console.log(databases);
- }
- connection.end();
- });
+ client.execute('show tables', function(err){
+ assert.ifError(err);
+ client.fetchAll(function(err, databases){
+ if(err){
+ console.log(err.message);
+ }else{
+ console.log(databases);
+ }
+ connection.end();
});
+ });
});
View
@@ -3,22 +3,22 @@
var hive = require('thrift-hive');
// Client connection
var client = hive.createClient({
- version: '0.7.1-cdh3u2',
- server: '127.0.0.1',
- port: 10000,
- timeout: 1000
+ version: '0.7.1-cdh3u2',
+ server: '127.0.0.1',
+ port: 10000,
+ timeout: 1000
});
// Execute query
client.execute('use default', function(err){
- client.query('show tables')
- .on('row', function(database){
- console.log(database);
- })
- .on('error', function(err){
- console.log(err.message);
- client.end();
- });
- .on('end', function(){
- client.end();
- });
+ client.query('show tables')
+ .on('row', function(database){
+ console.log(database);
+ })
+ .on('error', function(err){
+ console.log(err.message);
+ client.end();
+ });
+ .on('end', function(){
+ client.end();
+ });
});
Oops, something went wrong.

0 comments on commit 787cb0e

Please sign in to comment.