text:
---
layout: post
title: pemutar musik mpd dan ncmpcpp
description: konfigurasi mpd dan ncmpcpp di archlinux
keywords: ncmpcpp, mpd, archlinux, musik
---

_Ncmpcpp _ atau  _NCurses Music Player Client Plus Plus_ adalah pemutar musik klien yang sangat di gandrungi oleh kaum pemuda masa kini. Banyak anak muda yang menggunakan pemutar musik ini dengan alasan ringan dan minimalis dan biar "_Kekinian". _Tak sedikit pula orang orang yang kadang salah saat dalam menyebutkan aplikasi ini, "_Ncpmcpcm" "Npmcppc" _dan lain sebagainya.

Untuk menjalankan musik dari aplikasi Ncmpcpp, perlu diketahui bahwa kita harus mengkonfigurasi Music Player Daemon atau disingkat MPD terlebih dahulu. Berikut proses instalasi dan konfigurasinya.

#### Installasi :

    sudo pacman -S ncmpcpp mpd mpc

#### Konfigurasi :

**MPD :**

1\. Memasukan mpd ke grub audio

    $ sudo gpasswd -a mpd audio

2\. Membuat file konfigurasi

    $ mkdir -p ~/.mpd/playlists
    $ touch ~/.mpd/{mpd.conf,database,log,pid,state,sticker.sql}

3\. konfigurasi file mpd.conf

{% highlight sh %}
music_directory    "/dataku/Musik" # Disesuaikan dengan musik direktori agan
playlist_directory "~/.mpd/playlists"
db_file            "~/.mpd/database"
log_file           "~/.mpd/log"
pid_file           "~/.mpd/pid"
state_file         "~/.mpd/state"
sticker_file       "~/.mpd/sticker.sql"

audio_output {
        type                    "fifo"
        name                   "my_fifo"
        path                     "/tmp/mpd.fifo"
        format                 "44100:16:2"

#Audio Output
#kalau pake pulseaudio, konfigurasi Alsanya di beri tanda pagar ( Comment ) begitu juga sebaliknya

#Pulseaudio
audio_output {
  type    "pulse"
  name    "pulse audio"
}

#Alsa
audio_output {
        type         "alsa"
        name         "My Sound Card"
        mixer_type   "software"      # optional
}
{% endhighlight %}

4\. Selesai tinggal simpan.

**Ncmpcpp :**

1\. buat file konfigurasi

    mkdir ~/.ncmpcpp
    nano ~/.ncmpcpp/config

2\. Konfigurasi ncmpcpp

{% highlight sh %}
mpd_music_dir = "/dataku/Musik" # disamakan folder musiknya dengan konfigurasi mpd tadi.
/* mpd */
mpd_crossfade_time = "3"

/* UI */
song_list_format = " {$2%a$1 - }{$8%t$1}$R{$1%l} "
song_status_format = "$2%a $1:: $4%t $1:: $3%b$1"
song_columns_list_format = "(8f)[black]{l}  (32)[red]{a} (42)[yellow]{t|f} (18)[magenta]{b}"
now_playing_prefix = ""
now_playing_suffix = "$/b"
selected_item_prefix = "$3"
selected_item_suffix = "$9"
progressbar_look = "░█ "
alternative_header_first_line_format ="{$b$2%a$9} $1::$9 {$5%t$9}"
alternative_header_second_line_format ="{$6%b$9} $1::$9 {$2(%y)$9}"
user_interface = "classic"
browser_display_mode = "columns"
header_visibility = "no"
statusbar_visibility = "yes"
titles_visibility = "no"
mouse_support = "no"
fancy_scrolling = "yes"
cyclic_scrolling = "yes"
autocenter_mode = "yes"
centered_cursor = "yes"
discard_colors_if_item_is_selected = "no"
display_remaining_time = "yes"
display_bitrate = "no"
playlist_disable_highlight_delay = "1"
playlist_display_mode = "classic"
enable_window_title = "no"
clock_display_seconds = "no"

/* colors */
colors_enabled = "yes"
statusbar_color = "black"
empty_tag_color = "yellow"
main_window_color = "black"
main_window_highlight_color = "black"
volume_color = "black"
color1 = "white"
color2 = "blue"
progressbar_color = "black"
statusbar_color = "black"
active_column_color = "red"
window_border_color = "red"
active_window_border = "red"
header_window_color = "black"
alternative_ui_separator_color ="black"

/* visualizer */
visualizer_fifo_path = "/tmp/mpd.fifo"
visualizer_output_name = "Visualizer"
visualizer_type = "wave" (spectrum/wave)
visualizer_sync_interval = "30"
visualizer_color = "red"
visualizer_in_stereo = "yes"
{% endhighlight %}

setelah itu simpan.

**Let's Play :**

Jalankan perintah **mpd** pada terminal, oh iya, setelah jalankan mpd lalu jalankan perintah **mpc update** untuk mengupdate database musiknya.

![][1]

kalau udah ada kata-kata succeeded, tandanya udah berhasil sekarang jalankan perintah **ncmpcpp** di terminal.

![][2]

wah !! kok kosong ?  Pasti gagal nih, gagal nih, gatot nih !!
tenang gan :D, itu menu playlist kok, memang pertama-tamanya kosong dulu karena belum ada musik yang dimainkan. coba sekarang tekan tombol 3, ntar muncul deh daftar musiknya. tinggal pencet tombol **enter** untuk memainkan musiknya. terus tekan tombol 2 lagi untuk masuk ke playlist 😀

berikut kumpulan screenshot ncmpcpp nya :

![][3]

![][4]

![][5]

![][6]

Referensi :
https://wiki.archlinux.org/index.php/ncmpcpp#Different_views
http://dotshare.it/category/mpd/ncmpcpp/

[1]: {{ site.baseurl }}/images/2014/08/Screenshot-2Bfrom-2B2014-08-15-2B10-3A25-3A23.png
[2]: {{ site.baseurl }}/images/2014/08/Screenshot-2Bfrom-2B2014-08-15-2B10-3A33-3A48.png
[3]: {{ site.baseurl }}/images/2014/08/Screenshot-2Bfrom-2B2014-08-15-2B10-3A41-3A10.png
[4]: {{ site.baseurl }}/images/2014/08/Screenshot-2Bfrom-2B2014-08-15-2B10-3A42-3A37.png
[5]: {{ site.baseurl }}/images/2014/08/Screenshot-2Bfrom-2B2014-08-15-2B10-3A42-3A50.png
[6]: {{ site.baseurl }}/images/2014/08/Screenshot-2Bfrom-2B2014-08-15-2B10-3A43-3A04.png


text:
package com.terry.nlp;

import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
@RequestMapping("/words")
public class WordsController {

	//private ContactRepository contactRepo;
//
//	@Autowired
//	public ContactController(ContactRepository contactRepo) {
//		this.contactRepo = contactRepo;
//	}

	@RequestMapping(method=RequestMethod.GET)
	public String init(Map<String, Object> model) {
	    Words words = new Words();
	    words.setInputtext("my input text");
	    words.setResult("my result");
	    model.put("words", words);
		return "words";
	}

	@RequestMapping(method=RequestMethod.POST)
	public String submit(Words words, Map<String, Object> model) {
	    words.setResult("changed");
	    model.put("words", words);
		return "words";
	}
}

redpajama_set_name: RedPajamaGithub


text:
#include "postgres.h"

#include "cdb/cdbappendonlystorage_int.h"
#include "cdb/cdbappendonlystorage.h"
#include "cdb/cdbappendonlyxlog.h"

void
appendonly_desc(StringInfo buf, XLogReaderState *record)
{
	uint8		  info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;

	switch (info)
	{
		case XLOG_APPENDONLY_INSERT:
			{
				xl_ao_insert *xlrec = (xl_ao_insert *)XLogRecGetData(record);

				appendStringInfo(
					buf,
					"insert: rel %u/%u/%u seg/offset:%u/" INT64_FORMAT " len:%lu",
					xlrec->target.node.spcNode, xlrec->target.node.dbNode,
					xlrec->target.node.relNode, xlrec->target.segment_filenum,
					xlrec->target.offset, XLogRecGetDataLen(record) - SizeOfAOInsert);
			}
			break;
		case XLOG_APPENDONLY_TRUNCATE:
			{
				xl_ao_truncate *xlrec = (xl_ao_truncate *)XLogRecGetData(record);

				appendStringInfo(
					buf,
					"truncate: rel %u/%u/%u seg/offset:%u/" INT64_FORMAT,
					xlrec->target.node.spcNode, xlrec->target.node.dbNode,
					xlrec->target.node.relNode, xlrec->target.segment_filenum,
					xlrec->target.offset);
			}
			break;
		default:
			appendStringInfo(buf, "UNKNOWN");
	}
}

const char *
appendonly_identify(uint8 info)
{
	const char *id = NULL;

	switch (info & ~XLR_INFO_MASK)
	{
		case XLOG_APPENDONLY_INSERT:
			id = "APPENDONLY_INSERT";
			break;
		case XLOG_APPENDONLY_TRUNCATE:
			id = "APPENDONLY_TRUNCATE";
			break;
	}

	return id;
}


text:
package edu.iu.grid.oim.model.db;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import org.apache.log4j.Logger;
import org.w3c.dom.Document;
import edu.iu.grid.oim.model.UserContext;

import edu.iu.grid.oim.model.db.record.ContactRecord;
import edu.iu.grid.oim.model.db.record.ProjectUserRecord;
import edu.iu.grid.oim.model.db.record.ProjectRecord;
import edu.iu.grid.oim.model.db.record.RecordBase;

public class ProjectUserModel extends SmallTableModelBase<ProjectUserRecord> {
    static Logger log = Logger.getLogger(ProjectUserModel.class);

	public ProjectUserModel(UserContext context) {
		super(context, "project_user");
	}
	ProjectUserRecord createRecord() throws SQLException
	{
		return new ProjectUserRecord();
	}
	public Collection<ProjectUserRecord> getAll() throws SQLException
	{
		ArrayList<ProjectUserRecord> list = new ArrayList<ProjectUserRecord>();
		for(RecordBase it : getCache()) {
			list.add((ProjectUserRecord)it);
		}
		return list;
	}
	public Collection<ProjectUserRecord> getAllByProjectId(int id) throws SQLException
	{
		ArrayList<ProjectUserRecord> list = new ArrayList<ProjectUserRecord>();
		for(ProjectUserRecord it : getAll()) {
			if(it.project_id.equals(id)) {
				list.add(it);
			}
		}
		return list;
	}

	public String getName()
    {
    	return "Project / Users";
    }

	public Boolean hasLogAccess(XPath xpath, Document doc) throws XPathExpressionException
	{
		Integer id = Integer.parseInt((String)xpath.evaluate("//Keys/Key[Name='project_id']/Value", doc, XPathConstants.STRING));
		ResourceModel model = new ResourceModel(context);
		return model.canEdit(id);
	}
	public String getHumanValue(String field_name, String value) throws NumberFormatException, SQLException
	{
		if(field_name.equals("project_id")) {
			ProjectModel model = new ProjectModel(context);
			ProjectRecord rec = model.get(Integer.parseInt(value));
			return value + " (" + rec.name + ")";
		} else if(field_name.equals("contact_id")) {
			ContactModel model = new ContactModel(context);
			ContactRecord rec = model.get(Integer.parseInt(value));
			return value + " (" + rec.name + ")";
		}
		return value;
	}
}


text:
@class Registration;

@interface RegistrationBiometric : NSManagedObject

@property (nonatomic, retain) NSString * leftIndex;
@property (nonatomic, retain) NSString * rightIndex;
@property (nonatomic, retain) NSString * rightThumb;
@property (nonatomic, retain) NSString * leftThumb;
@property (nonatomic, retain) NSString * photograph;
@property (nonatomic, retain) Registration *registration;

@end


text: Generate a Sierpinski triangle fractal and invert it in various different ways


text:
This project is a code sample to show how to list all groups and membership of a Team Foundation Server (TFS) or Visual Studio Team Services (VSTS) collection.

This is a command-line application, and the output can be redirected to a text file.

## Example usage:

DisplayGroups.exe https://myserver.visualstudio.com/DefaultCollection

To redirect the output to a text file:

DisplayGroups.exe https://myserver.visualstudio.com/DefaultCollection >GroupsAndMembers.txt

Here is an example of the output that you would see:

Members of group: [DefaultCollection]\Project Collection Administrators

***
vstfs:///Framework/IdentityDomain/bzz2ec97-f70a-4374-9037-9492666f000f\Team Foundation Administrators

vstfs:///Framework/Generic/dd9075cf-d538-43d5-807f-3c7dba3a9k52\Project Collection Service Accounts

wredford@contoso.com

scot@contoso.com

LOCAL AUTHORITY\TeamFoundationService (TEAM FOUNDATION)

daka@contoso.com

bkel@contoso.com

Members of group: [TEAM FOUNDATION]\Team Foundation Invited Users

***
wredford@contoso.com

scot@contoso.com

daka@contoso.com

chris@contoso.com

sastry@contoso.com

abrk@contoso.com

bkel@contoso.com


text:
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var helpers = require('./helpers');

module.exports = {
  entry: {
    'polyfills': './src/polyfills.ts',
    'vendor': './src/vendor.ts',
    'app': './src/main.ts'
  },

  resolve: {
    extensions: ['', '.js', '.ts', '.pug', '.json', '.styl']
  },

  module: {
    preLoaders: [

      /*
       * Tslint loader support for *.ts files
       *
       * See: https://github.com/wbuchwalter/tslint-loader
       */
      // { test: /\.ts$/, loader: 'tslint-loader', exclude: [ helpers.root('node_modules') ] },

      /*
       * Source map loader support for *.js files
       * Extracts SourceMaps for source files that as added as sourceMappingURL comment.
       *
       * See: https://github.com/webpack/source-map-loader
       */
      {
        test: /\.js$/,
        loader: 'source-map-loader',
        exclude: [
          // these packages have problems with their sourcemaps
          helpers.root('node_modules/rxjs'),
          helpers.root('node_modules/@angular'),
          helpers.root('node_modules/@ngrx'),
          helpers.root('node_modules/@angular2-material')
        ]
      }

    ],
    loaders: [
      {
        include: /\.json/,
        loader: "json"
      },
      {
        include: /\.pug/,
        loaders: ['to-string', 'pug-html-loader']
      },
      {
        test: /\.styl$/,
        loaders: ['to-string','css','stylus']
      },
      {
        test: /\.ts$/,
        loader: 'ts'
      },
      {
        test: /\.html$/,
        loader: 'html'
      },
      {
        test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)$/,
        loader: 'file?name=assets/[name].[hash].[ext]'
      }
    ]
  },

  plugins: [
    new webpack.optimize.CommonsChunkPlugin({
      name: ['app', 'vendor', 'polyfills']
    }),

    new HtmlWebpackPlugin({
      template: 'src/index.html'
    })
  ]
};


text:
package example;

import java.awt.*;
import java.util.Optional;
import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.MutableTreeNode;
import javax.swing.tree.TreePath;

public final class MainPanel extends JPanel {
  private MainPanel() {
    super(new BorderLayout());
    JTree tree = new JTree();
    tree.setComponentPopupMenu(new TreePopupMenu());
    add(new JScrollPane(tree));
    setPreferredSize(new Dimension(320, 240));
  }

  public static void main(String[] args) {
    EventQueue.invokeLater(MainPanel::createAndShowGui);
  }

  private static void createAndShowGui() {
    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
      ex.printStackTrace();
      Toolkit.getDefaultToolkit().beep();
    }
    JFrame frame = new JFrame("@title@");
    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    frame.getContentPane().add(new MainPanel());
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
  }
}

class TreePopupMenu extends JPopupMenu {
  private TreePath path;

  protected TreePopupMenu() {
    super();
    add("add child node").addActionListener(e -> {
      JTree tree = (JTree) getInvoker();
      DefaultTreeModel model = (DefaultTreeModel) tree.getModel();
      DefaultMutableTreeNode self = (DefaultMutableTreeNode) path.getLastPathComponent();
      DefaultMutableTreeNode child = new DefaultMutableTreeNode("New child node");
      self.add(child);
      model.reload(self);
      // or: model.insertNodeInto(child, self, self.getChildCount());
    });
    addSeparator();
    add("insert preceding sibling node").addActionListener(e -> {
      JTree tree = (JTree) getInvoker();
      DefaultTreeModel model = (DefaultTreeModel) tree.getModel();
      MutableTreeNode self = (MutableTreeNode) path.getLastPathComponent();
      MutableTreeNode parent = (MutableTreeNode) self.getParent();
      MutableTreeNode child = new DefaultMutableTreeNode("New preceding sibling");
      int index = model.getIndexOfChild(parent, self);
      parent.insert(child, index);
      model.reload(parent);
      // or: model.insertNodeInto(child, parent, index);
    });
    add("insert following sibling node").addActionListener(e -> {
      JTree tree = (JTree) getInvoker();
      DefaultTreeModel model = (DefaultTreeModel) tree.getModel();
      MutableTreeNode self = (MutableTreeNode) path.getLastPathComponent();
      MutableTreeNode parent = (MutableTreeNode) self.getParent();
      MutableTreeNode child = new DefaultMutableTreeNode("New following sibling");
      int index = model.getIndexOfChild(parent, self);
      parent.insert(child, index + 1);
      model.reload(parent);
      // or: model.insertNodeInto(child, parent, index + 1);
    });
  }

  @Override public void show(Component c, int x, int y) {
    if (c instanceof JTree) {
      JTree tree = (JTree) c;
      path = tree.getPathForLocation(x, y);
      Optional.ofNullable(path).ifPresent(tp -> super.show(c, x, y));
    }
  }
}


text:
var thrift = require('thrift');
var Thrift = thrift.Thrift;
var Q = thrift.Q;

var ExecStats_ttypes = require('./ExecStats_types')
var Status_ttypes = require('./Status_types')
var Types_ttypes = require('./Types_types')
var beeswax_ttypes = require('./beeswax_types')
var TCLIService_ttypes = require('./TCLIService_types')

var BeeswaxService = require('./BeeswaxService')
var BeeswaxServiceClient = BeeswaxService.Client
var BeeswaxServiceProcessor = BeeswaxService.Processor
var ttypes = require('./ImpalaService_types');
//HELPER FUNCTIONS AND STRUCTURES

ImpalaService_Cancel_args = function(args) {
  this.query_id = null;
  if (args) {
    if (args.query_id !== undefined && args.query_id !== null) {
      this.query_id = new beeswax_ttypes.QueryHandle(args.query_id);
    }
  }
};
ImpalaService_Cancel_args.prototype = {};
ImpalaService_Cancel_args.prototype.read = function(input) {
  input.readStructBegin();
  while (true)
  {
    var ret = input.readFieldBegin();
    var fname = ret.fname;
    var ftype = ret.ftype;
    var fid = ret.fid;
    if (ftype == Thrift.Type.STOP) {
      break;
    }
    switch (fid)
    {
      case 1:
      if (ftype == Thrift.Type.STRUCT) {
        this.query_id = new beeswax_ttypes.QueryHandle();
        this.query_id.read(input);
      } else {
        input.skip(ftype);
      }
      break;
      case 0:
        input.skip(ftype);
        break;
      default:
        input.skip(ftype);
    }
    input.readFieldEnd();
  }
  input.readStructEnd();
  return;
};

ImpalaService_Cancel_args.prototype.write = function(output) {
  output.writeStructBegin('ImpalaService_Cancel_args');
  if (this.query_id !== null && this.query_id !== undefined) {
    output.writeFieldBegin('query_id', Thrift.Type.STRUCT, 1);
    this.query_id.write(output);
    output.writeFieldEnd();
  }
  output.writeFieldStop();
  output.writeStructEnd();
  return;
};

ImpalaService_Cancel_result = function(args) {
  this.success = null;
  this.error = null;
  if (args instanceof beeswax_ttypes.BeeswaxException) {
    this.error = args;
    return;
  }
  if (args) {
    if (args.success !== undefined && args.success !== null) {
      this.success = new Status_ttypes.TStatus(args.success);
    }
    if (args.error !== undefined && args.error !== null) {
      this.error = args.error;
    }
  }
};
ImpalaService_Cancel_result.prototype = {};
ImpalaService_Cancel_result.prototype.read = function(input) {
  input.readStructBegin();
  while (true)
  {
    var ret = input.readFieldBegin();
    var fname = ret.fname;
    var ftype = ret.ftype;
    var fid = ret.fid;
    if (ftype == Thrift.Type.STOP) {
      break;
    }
    switch (fid)
    {
      case 0:
      if (ftype == Thrift.Type.STRUCT) {
        this.success = new Status_ttypes.TStatus();
        this.success.read(input);
      } else {
        input.skip(ftype);
      }
      break;
      case 1:
      if (ftype == Thrift.Type.STRUCT) {
        this.error = new beeswax_ttypes.BeeswaxException();
        this.error.read(input);
      } else {
        input.skip(ftype);
      }
      break;
      default:
        input.skip(ftype);
    }
    input.readFieldEnd();
  }
  input.readStructEnd();
  return;
};

ImpalaService_Cancel_result.prototype.write = function(output) {
  output.writeStructBegin('ImpalaService_Cancel_result');
  if (this.success !== null && this.success !== undefined) {
    output.writeFieldBegin('success', Thrift.Type.STRUCT, 0);
    this.success.write(output);
    output.writeFieldEnd();
  }
  if (this.error !== null && this.error !== undefined) {
    output.writeFieldBegin('error', Thrift.Type.STRUCT, 1);
    this.error.write(output);
    output.writeFieldEnd();
  }
  output.writeFieldStop();
  output.writeStructEnd();
  return;
};

ImpalaService_ResetCatalog_args = function(args) {
};
ImpalaService_ResetCatalog_args.prototype = {};
ImpalaService_ResetCatalog_args.prototype.read = function(input) {
  input.readStructBegin();
  while (true)
  {
    var ret = input.readFieldBegin();
    var fname = ret.fname;
    var ftype = ret.ftype;
    var fid = ret.fid;
    if (ftype == Thrift.Type.STOP) {
      break;
    }
    input.skip(ftype);
    input.readFieldEnd();
  }
  input.readStructEnd();
  return;
};

ImpalaService_ResetCatalog_args.prototype.write = function(output) {
  output.writeStructBegin('ImpalaService_ResetCatalog_args');
  output.writeFieldStop();
  output.writeStructEnd();
  return;
};

ImpalaService_ResetCatalog_result = function(args) {
  this.success = null;
  if (args) {
    if (args.success !== undefined && args.success !== null) {
      this.success = new Status_ttypes.TStatus(args.success);
    }
  }
};
ImpalaService_ResetCatalog_result.prototype = {};
ImpalaService_ResetCatalog_result.prototype.read = function(input) {
  input.readStructBegin();
  while (true)
  {
    var ret = input.readFieldBegin();
    var fname = ret.fname;
    var ftype = ret.ftype;
    var fid = ret.fid;
    if (ftype == Thrift.Type.STOP) {
      break;
    }
    switch (fid)
    {
      case 0:
      if (ftype == Thrift.Type.STRUCT) {
        this.success = new Status_ttypes.TStatus();
        this.success.read(input);
      } else {
        input.skip(ftype);
      }
      break;
      case 0:
        input.skip(ftype);
        break;
      default:
        input.skip(ftype);
    }
    input.readFieldEnd();
  }
  input.readStructEnd();
  return;
};

ImpalaService_ResetCatalog_result.prototype.write = function(output) {
  output.writeStructBegin('ImpalaService_ResetCatalog_result');
  if (this.success !== null && this.success !== undefined) {
    output.writeFieldBegin('success', Thrift.Type.STRUCT, 0);
    this.success.write(output);
    output.writeFieldEnd();
  }
  output.writeFieldStop();
  output.writeStructEnd();
  return;
};

ImpalaService_ResetTable_args = function(args) {
  this.request = null;
  if (args) {
    if (args.request !== undefined && args.request !== null) {
      this.request = new ttypes.TResetTableReq(args.request);
    }
  }
};
ImpalaService_ResetTable_args.prototype = {};
ImpalaService_ResetTable_args.prototype.read = function(input) {
  input.readStructBegin();
  while (true)
  {
    var ret = input.readFieldBegin();
    var fname = ret.fname;
    var ftype = ret.ftype;
    var fid = ret.fid;
    if (ftype == Thrift.Type.STOP) {
      break;
    }
    switch (fid)
    {
      case 1:
      if (ftype == Thrift.Type.STRUCT) {
        this.request = new ttypes.TResetTableReq();
        this.request.read(input);
      } else {
        input.skip(ftype);
      }
      break;
      case 0:
        input.skip(ftype);
        break;
      default:
        input.skip(ftype);
    }
    input.readFieldEnd();
  }
  input.readStructEnd();
  return;
};

ImpalaService_ResetTable_args.prototype.write = function(output) {
  output.writeStructBegin('ImpalaService_ResetTable_args');
  if (this.request !== null && this.request !== undefined) {
    output.writeFieldBegin('request', Thrift.Type.STRUCT, 1);
    this.request.write(output);
    output.writeFieldEnd();
  }
  output.writeFieldStop();
  output.writeStructEnd();
  return;
};

ImpalaService_ResetTable_result = function(args) {
  this.success = null;
  if (args) {
    if (args.success !== undefined && args.success !== null) {
      this.success = new Status_ttypes.TStatus(args.success);
    }
  }
};
ImpalaService_ResetTable_result.prototype = {};
ImpalaService_ResetTable_result.prototype.read = function(input) {
  input.readStructBegin();
  while (true)
  {
    var ret = input.readFieldBegin();
    var fname = ret.fname;
    var ftype = ret.ftype;
    var fid = ret.fid;
    if (ftype == Thrift.Type.STOP) {
      break;
    }
    switch (fid)
    {
      case 0:
      if (ftype == Thrift.Type.STRUCT) {
        this.success = new Status_ttypes.TStatus();
        this.success.read(input);
      } else {
        input.skip(ftype);
      }
      break;
      case 0:
        input.skip(ftype);
        break;
      default:
        input.skip(ftype);
    }
    input.readFieldEnd();
  }
  input.readStructEnd();
  return;
};

ImpalaService_ResetTable_result.prototype.write = function(output) {
  output.writeStructBegin('ImpalaService_ResetTable_result');
  if (this.success !== null && this.success !== undefined) {
    output.writeFieldBegin('success', Thrift.Type.STRUCT, 0);
    this.success.write(output);
    output.writeFieldEnd();
  }
  output.writeFieldStop();
  output.writeStructEnd();
  return;
};

ImpalaService_GetRuntimeProfile_args = function(args) {
  this.query_id = null;
  if (args) {
    if (args.query_id !== undefined && args.query_id !== null) {
      this.query_id = new beeswax_ttypes.QueryHandle(args.query_id);
    }
  }
};
ImpalaService_GetRuntimeProfile_args.prototype = {};
ImpalaService_GetRuntimeProfile_args.prototype.read = function(input) {
  input.readStructBegin();
  while (true)
  {
    var ret = input.readFieldBegin();
    var fname = ret.fname;
    var ftype = ret.ftype;
    var fid = ret.fid;
    if (ftype == Thrift.Type.STOP) {
      break;
    }
    switch (fid)
    {
      case 1:
      if (ftype == Thrift.Type.STRUCT) {
        this.query_id = new beeswax_ttypes.QueryHandle();
        this.query_id.read(input);
      } else {
        input.skip(ftype);
      }
      break;
      case 0:
        input.skip(ftype);
        break;
      default:
        input.skip(ftype);
    }
    input.readFieldEnd();
  }
  input.readStructEnd();
  return;
};

ImpalaService_GetRuntimeProfile_args.prototype.write = function(output) {
  output.writeStructBegin('ImpalaService_GetRuntimeProfile_args');
  if (this.query_id !== null && this.query_id !== undefined) {
    output.writeFieldBegin('query_id', Thrift.Type.STRUCT, 1);
    this.query_id.write(output);
    output.writeFieldEnd();
  }
  output.writeFieldStop();
  output.writeStructEnd();
  return;
};

ImpalaService_GetRuntimeProfile_result = function(args) {
  this.success = null;
  this.error = null;
  if (args instanceof beeswax_ttypes.BeeswaxException) {
    this.error = args;
    return;
  }
  if (args) {
    if (args.success !== undefined && args.success !== null) {
      this.success = args.success;
    }
    if (args.error !== undefined && args.error !== null) {
      this.error = args.error;
    }
  }
};
ImpalaService_GetRuntimeProfile_result.prototype = {};
ImpalaService_GetRuntimeProfile_result.prototype.read = function(input) {
  input.readStructBegin();
  while (true)
  {
    var ret = input.readFieldBegin();
    var fname = ret.fname;
    var ftype = ret.ftype;
    var fid = ret.fid;
    if (ftype == Thrift.Type.STOP) {
      break;
    }
    switch (fid)
    {
      case 0:
      if (ftype == Thrift.Type.STRING) {
        this.success = input.readString();
      } else {
        input.skip(ftype);
      }
      break;
      case 1:
      if (ftype == Thrift.Type.STRUCT) {
        this.error = new beeswax_ttypes.BeeswaxException();
        this.error.read(input);
      } else {
        input.skip(ftype);
      }
      break;
      default:
        input.skip(ftype);
    }
    input.readFieldEnd();
  }
  input.readStructEnd();
  return;
};

ImpalaService_GetRuntimeProfile_result.prototype.write = function(output) {
  output.writeStructBegin('ImpalaService_GetRuntimeProfile_result');
  if (this.success !== null && this.success !== undefined) {
    output.writeFieldBegin('success', Thrift.Type.STRING, 0);
    output.writeString(this.success);
    output.writeFieldEnd();
  }
  if (this.error !== null && this.error !== undefined) {
    output.writeFieldBegin('error', Thrift.Type.STRUCT, 1);
    this.error.write(output);
    output.writeFieldEnd();
  }
  output.writeFieldStop();
  output.writeStructEnd();
  return;
};

ImpalaService_CloseInsert_args = function(args) {
  this.handle = null;
  if (args) {
    if (args.handle !== undefined && args.handle !== null) {
      this.handle = new beeswax_ttypes.QueryHandle(args.handle);
    }
  }
};
ImpalaService_CloseInsert_args.prototype = {};
ImpalaService_CloseInsert_args.prototype.read = function(input) {
  input.readStructBegin();
  while (true)
  {
    var ret = input.readFieldBegin();
    var fname = ret.fname;
    var ftype = ret.ftype;
    var fid = ret.fid;
    if (ftype == Thrift.Type.STOP) {
      break;
    }
    switch (fid)
    {
      case 1:
      if (ftype == Thrift.Type.STRUCT) {
        this.handle = new beeswax_ttypes.QueryHandle();
        this.handle.read(input);
      } else {
        input.skip(ftype);
      }
      break;
      case 0:
        input.skip(ftype);
        break;
      default:
        input.skip(ftype);
    }
    input.readFieldEnd();
  }
  input.readStructEnd();
  return;
};

ImpalaService_CloseInsert_args.prototype.write = function(output) {
  output.writeStructBegin('ImpalaService_CloseInsert_args');
  if (this.handle !== null && this.handle !== undefined) {
    output.writeFieldBegin('handle', Thrift.Type.STRUCT, 1);
    this.handle.write(output);
    output.writeFieldEnd();
  }
  output.writeFieldStop();
  output.writeStructEnd();
  return;
};

ImpalaService_CloseInsert_result = function(args) {
  this.success = null;
  this.error = null;
  this.error2 = null;
  if (args instanceof beeswax_ttypes.QueryNotFoundException) {
    this.error = args;
    return;
  }
  if (args instanceof beeswax_ttypes.BeeswaxException) {
    this.error2 = args;
    return;
  }
  if (args) {
    if (args.success !== undefined && args.success !== null) {
      this.success = new ttypes.TInsertResult(args.success);
    }
    if (args.error !== undefined && args.error !== null) {
      this.error = args.error;
    }
    if (args.error2 !== undefined && args.error2 !== null) {
      this.error2 = args.error2;
    }
  }
};
ImpalaService_CloseInsert_result.prototype = {};
ImpalaService_CloseInsert_result.prototype.read = function(input) {
  input.readStructBegin();
  while (true)
  {
    var ret = input.readFieldBegin();
    var fname = ret.fname;
    var ftype = ret.ftype;
    var fid = ret.fid;
    if (ftype == Thrift.Type.STOP) {
      break;
    }
    switch (fid)
    {
      case 0:
      if (ftype == Thrift.Type.STRUCT) {
        this.success = new ttypes.TInsertResult();
        this.success.read(input);
      } else {
        input.skip(ftype);
      }
      break;
      case 1:
      if (ftype == Thrift.Type.STRUCT) {
        this.error = new beeswax_ttypes.QueryNotFoundException();
        this.error.read(input);
      } else {
        input.skip(ftype);
      }
      break;
      case 2:
      if (ftype == Thrift.Type.STRUCT) {
        this.error2 = new beeswax_ttypes.BeeswaxException();
        this.error2.read(input);
      } else {
        input.skip(ftype);
      }
      break;
      default:
        input.skip(ftype);
    }
    input.readFieldEnd();
  }
  input.readStructEnd();
  return;
};

ImpalaService_CloseInsert_result.prototype.write = function(output) {
  output.writeStructBegin('ImpalaService_CloseInsert_result');
  if (this.success !== null && this.success !== undefined) {
    output.writeFieldBegin('success', Thrift.Type.STRUCT, 0);
    this.success.write(output);
    output.writeFieldEnd();
  }
  if (this.error !== null && this.error !== undefined) {
    output.writeFieldBegin('error', Thrift.Type.STRUCT, 1);
    this.error.write(output);
    output.writeFieldEnd();
  }
  if (this.error2 !== null && this.error2 !== undefined) {
    output.writeFieldBegin('error2', Thrift.Type.STRUCT, 2);
    this.error2.write(output);
    output.writeFieldEnd();
  }
  output.writeFieldStop();
  output.writeStructEnd();
  return;
};

ImpalaService_PingImpalaService_args = function(args) {
};
ImpalaService_PingImpalaService_args.prototype = {};
ImpalaService_PingImpalaService_args.prototype.read = function(input) {
  input.readStructBegin();
  while (true)
  {
    var ret = input.readFieldBegin();
    var fname = ret.fname;
    var ftype = ret.ftype;
    var fid = ret.fid;
    if (ftype == Thrift.Type.STOP) {
      break;
    }
    input.skip(ftype);
    input.readFieldEnd();
  }
  input.readStructEnd();
  return;
};

ImpalaService_PingImpalaService_args.prototype.write = function(output) {
  output.writeStructBegin('ImpalaService_PingImpalaService_args');
  output.writeFieldStop();
  output.writeStructEnd();
  return;
};

ImpalaService_PingImpalaService_result = function(args) {
  this.success = null;
  if (args) {
    if (args.success !== undefined && args.success !== null) {
      this.success = new ttypes.TPingImpalaServiceResp(args.success);
    }
  }
};
ImpalaService_PingImpalaService_result.prototype = {};
ImpalaService_PingImpalaService_result.prototype.read = function(input) {
  input.readStructBegin();
  while (true)
  {
    var ret = input.readFieldBegin();
    var fname = ret.fname;
    var ftype = ret.ftype;
    var fid = ret.fid;
    if (ftype == Thrift.Type.STOP) {
      break;
    }
    switch (fid)
    {
      case 0:
      if (ftype == Thrift.Type.STRUCT) {
        this.success = new ttypes.TPingImpalaServiceResp();
        this.success.read(input);
      } else {
        input.skip(ftype);
      }
      break;
      case 0:
        input.skip(ftype);
        break;
      default:
        input.skip(ftype);
    }
    input.readFieldEnd();
  }
  input.readStructEnd();
  return;
};

ImpalaService_PingImpalaService_result.prototype.write = function(output) {
  output.writeStructBegin('ImpalaService_PingImpalaService_result');
  if (this.success !== null && this.success !== undefined) {
    output.writeFieldBegin('success', Thrift.Type.STRUCT, 0);
    this.success.write(output);
    output.writeFieldEnd();
  }
  output.writeFieldStop();
  output.writeStructEnd();
  return;
};

ImpalaService_GetExecSummary_args = function(args) {
  this.handle = null;
  if (args) {
    if (args.handle !== undefined && args.handle !== null) {
      this.handle = new beeswax_ttypes.QueryHandle(args.handle);
    }
  }
};
ImpalaService_GetExecSummary_args.prototype = {};
ImpalaService_GetExecSummary_args.prototype.read = function(input) {
  input.readStructBegin();
  while (true)
  {
    var ret = input.readFieldBegin();
    var fname = ret.fname;
    var ftype = ret.ftype;
    var fid = ret.fid;
    if (ftype == Thrift.Type.STOP) {
      break;
    }
    switch (fid)
    {
      case 1:
      if (ftype == Thrift.Type.STRUCT) {
        this.handle = new beeswax_ttypes.QueryHandle();
        this.handle.read(input);
      } else {
        input.skip(ftype);
      }
      break;
      case 0:
        input.skip(ftype);
        break;
      default:
        input.skip(ftype);
    }
    input.readFieldEnd();
  }
  input.readStructEnd();
  return;
};

ImpalaService_GetExecSummary_args.prototype.write = function(output) {
  output.writeStructBegin('ImpalaService_GetExecSummary_args');
  if (this.handle !== null && this.handle !== undefined) {
    output.writeFieldBegin('handle', Thrift.Type.STRUCT, 1);
    this.handle.write(output);
    output.writeFieldEnd();
  }
  output.writeFieldStop();
  output.writeStructEnd();
  return;
};

ImpalaService_GetExecSummary_result = function(args) {
  this.success = null;
  this.error = null;
  this.error2 = null;
  if (args instanceof beeswax_ttypes.QueryNotFoundException) {
    this.error = args;
    return;
  }
  if (args instanceof beeswax_ttypes.BeeswaxException) {
    this.error2 = args;
    return;
  }
  if (args) {
    if (args.success !== undefined && args.success !== null) {
      this.success = new ExecStats_ttypes.TExecSummary(args.success);
    }
    if (args.error !== undefined && args.error !== null) {
      this.error = args.error;
    }
    if (args.error2 !== undefined && args.error2 !== null) {
      this.error2 = args.error2;
    }
  }
};
ImpalaService_GetExecSummary_result.prototype = {};
ImpalaService_GetExecSummary_result.prototype.read = function(input) {
  input.readStructBegin();
  while (true)
  {
    var ret = input.readFieldBegin();
    var fname = ret.fname;
    var ftype = ret.ftype;
    var fid = ret.fid;
    if (ftype == Thrift.Type.STOP) {
      break;
    }
    switch (fid)
    {
      case 0:
      if (ftype == Thrift.Type.STRUCT) {
        this.success = new ExecStats_ttypes.TExecSummary();
        this.success.read(input);
      } else {
        input.skip(ftype);
      }
      break;
      case 1:
      if (ftype == Thrift.Type.STRUCT) {
        this.error = new beeswax_ttypes.QueryNotFoundException();
        this.error.read(input);
      } else {
        input.skip(ftype);
      }
      break;
      case 2:
      if (ftype == Thrift.Type.STRUCT) {
        this.error2 = new beeswax_ttypes.BeeswaxException();
        this.error2.read(input);
      } else {
        input.skip(ftype);
      }
      break;
      default:
        input.skip(ftype);
    }
    input.readFieldEnd();
  }
  input.readStructEnd();
  return;
};

ImpalaService_GetExecSummary_result.prototype.write = function(output) {
  output.writeStructBegin('ImpalaService_GetExecSummary_result');
  if (this.success !== null && this.success !== undefined) {
    output.writeFieldBegin('success', Thrift.Type.STRUCT, 0);
    this.success.write(output);
    output.writeFieldEnd();
  }
  if (this.error !== null && this.error !== undefined) {
    output.writeFieldBegin('error', Thrift.Type.STRUCT, 1);
    this.error.write(output);
    output.writeFieldEnd();
  }
  if (this.error2 !== null && this.error2 !== undefined) {
    output.writeFieldBegin('error2', Thrift.Type.STRUCT, 2);
    this.error2.write(output);
    output.writeFieldEnd();
  }
  output.writeFieldStop();
  output.writeStructEnd();
  return;
};

ImpalaServiceClient = exports.Client = function(output, pClass) {
    this.output = output;
    this.pClass = pClass;
    this._seqid = 0;
    this._reqs = {};
};
Thrift.inherits(ImpalaServiceClient, BeeswaxServiceClient);
ImpalaServiceClient.prototype.seqid = function() { return this._seqid; }
ImpalaServiceClient.prototype.new_seqid = function() { return this._seqid += 1; }
ImpalaServiceClient.prototype.Cancel = function(query_id, callback) {
  this._seqid = this.new_seqid();
  if (callback === undefined) {
    var _defer = Q.defer();
    this._reqs[this.seqid()] = function(error, result) {
      if (error) {
        _defer.reject(error);
      } else {
        _defer.resolve(result);
      }
    };
    this.send_Cancel(query_id);
    return _defer.promise;
  } else {
    this._reqs[this.seqid()] = callback;
    this.send_Cancel(query_id);
  }
};

ImpalaServiceClient.prototype.send_Cancel = function(query_id) {
  var output = new this.pClass(this.output);
  output.writeMessageBegin('Cancel', Thrift.MessageType.CALL, this.seqid());
  var args = new ImpalaService_Cancel_args();
  args.query_id = query_id;
  args.write(output);
  output.writeMessageEnd();
  return this.output.flush();
};

ImpalaServiceClient.prototype.recv_Cancel = function(input,mtype,rseqid) {
  var callback = this._reqs[rseqid] || function() {};
  delete this._reqs[rseqid];
  if (mtype == Thrift.MessageType.EXCEPTION) {
    var x = new Thrift.TApplicationException();
    x.read(input);
    input.readMessageEnd();
    return callback(x);
  }
  var result = new ImpalaService_Cancel_result();
  result.read(input);
  input.readMessageEnd();

  if (null !== result.error) {
    return callback(result.error);
  }
  if (null !== result.success) {
    return callback(null, result.success);
  }
  return callback('Cancel failed: unknown result');
};
ImpalaServiceClient.prototype.ResetCatalog = function(callback) {
  this._seqid = this.new_seqid();
  if (callback === undefined) {
    var _defer = Q.defer();
    this._reqs[this.seqid()] = function(error, result) {
      if (error) {
        _defer.reject(error);
      } else {
        _defer.resolve(result);
      }
    };
    this.send_ResetCatalog();
    return _defer.promise;
  } else {
    this._reqs[this.seqid()] = callback;
    this.send_ResetCatalog();
  }
};

ImpalaServiceClient.prototype.send_ResetCatalog = function() {
  var output = new this.pClass(this.output);
  output.writeMessageBegin('ResetCatalog', Thrift.MessageType.CALL, this.seqid());
  var args = new ImpalaService_ResetCatalog_args();
  args.write(output);
  output.writeMessageEnd();
  return this.output.flush();
};

ImpalaServiceClient.prototype.recv_ResetCatalog = function(input,mtype,rseqid) {
  var callback = this._reqs[rseqid] || function() {};
  delete this._reqs[rseqid];
  if (mtype == Thrift.MessageType.EXCEPTION) {
    var x = new Thrift.TApplicationException();
    x.read(input);
    input.readMessageEnd();
    return callback(x);
  }
  var result = new ImpalaService_ResetCatalog_result();
  result.read(input);
  input.readMessageEnd();

  if (null !== result.success) {
    return callback(null, result.success);
  }
  return callback('ResetCatalog failed: unknown result');
};
ImpalaServiceClient.prototype.ResetTable = function(request, callback) {
  this._seqid = this.new_seqid();
  if (callback === undefined) {
    var _defer = Q.defer();
    this._reqs[this.seqid()] = function(error, result) {
      if (error) {
        _defer.reject(error);
      } else {
        _defer.resolve(result);
      }
    };
    this.send_ResetTable(request);
    return _defer.promise;
  } else {
    this._reqs[this.seqid()] = callback;
    this.send_ResetTable(request);
  }
};

ImpalaServiceClient.prototype.send_ResetTable = function(request) {
  var output = new this.pClass(this.output);
  output.writeMessageBegin('ResetTable', Thrift.MessageType.CALL, this.seqid());
  var args = new ImpalaService_ResetTable_args();
  args.request = request;
  args.write(output);
  output.writeMessageEnd();
  return this.output.flush();
};

ImpalaServiceClient.prototype.recv_ResetTable = function(input,mtype,rseqid) {
  var callback = this._reqs[rseqid] || function() {};
  delete this._reqs[rseqid];
  if (mtype == Thrift.MessageType.EXCEPTION) {
    var x = new Thrift.TApplicationException();
    x.read(input);
    input.readMessageEnd();
    return callback(x);
  }
  var result = new ImpalaService_ResetTable_result();
  result.read(input);
  input.readMessageEnd();

  if (null !== result.success) {
    return callback(null, result.success);
  }
  return callback('ResetTable failed: unknown result');
};
ImpalaServiceClient.prototype.GetRuntimeProfile = function(query_id, callback) {
  this._seqid = this.new_seqid();
  if (callback === undefined) {
    var _defer = Q.defer();
    this._reqs[this.seqid()] = function(error, result) {
      if (error) {
        _defer.reject(error);
      } else {
        _defer.resolve(result);
      }
    };
    this.send_GetRuntimeProfile(query_id);
    return _defer.promise;
  } else {
    this._reqs[this.seqid()] = callback;
    this.send_GetRuntimeProfile(query_id);
  }
};

ImpalaServiceClient.prototype.send_GetRuntimeProfile = function(query_id) {
  var output = new this.pClass(this.output);
  output.writeMessageBegin('GetRuntimeProfile', Thrift.MessageType.CALL, this.seqid());
  var args = new ImpalaService_GetRuntimeProfile_args();
  args.query_id = query_id;
  args.write(output);
  output.writeMessageEnd();
  return this.output.flush();
};

ImpalaServiceClient.prototype.recv_GetRuntimeProfile = function(input,mtype,rseqid) {
  var callback = this._reqs[rseqid] || function() {};
  delete this._reqs[rseqid];
  if (mtype == Thrift.MessageType.EXCEPTION) {
    var x = new Thrift.TApplicationException();
    x.read(input);
    input.readMessageEnd();
    return callback(x);
  }
  var result = new ImpalaService_GetRuntimeProfile_result();
  result.read(input);
  input.readMessageEnd();

  if (null !== result.error) {
    return callback(result.error);
  }
  if (null !== result.success) {
    return callback(null, result.success);
  }
  return callback('GetRuntimeProfile failed: unknown result');
};
ImpalaServiceClient.prototype.CloseInsert = function(handle, callback) {
  this._seqid = this.new_seqid();
  if (callback === undefined) {
    var _defer = Q.defer();
    this._reqs[this.seqid()] = function(error, result) {
      if (error) {
        _defer.reject(error);
      } else {
        _defer.resolve(result);
      }
    };
    this.send_CloseInsert(handle);
    return _defer.promise;
  } else {
    this._reqs[this.seqid()] = callback;
    this.send_CloseInsert(handle);
  }
};

ImpalaServiceClient.prototype.send_CloseInsert = function(handle) {
  var output = new this.pClass(this.output);
  output.writeMessageBegin('CloseInsert', Thrift.MessageType.CALL, this.seqid());
  var args = new ImpalaService_CloseInsert_args();
  args.handle = handle;
  args.write(output);
  output.writeMessageEnd();
  return this.output.flush();
};

ImpalaServiceClient.prototype.recv_CloseInsert = function(input,mtype,rseqid) {
  var callback = this._reqs[rseqid] || function() {};
  delete this._reqs[rseqid];
  if (mtype == Thrift.MessageType.EXCEPTION) {
    var x = new Thrift.TApplicationException();
    x.read(input);
    input.readMessageEnd();
    return callback(x);
  }
  var result = new ImpalaService_CloseInsert_result();
  result.read(input);
  input.readMessageEnd();

  if (null !== result.error) {
    return callback(result.error);
  }
  if (null !== result.error2) {
    return callback(result.error2);
  }
  if (null !== result.success) {
    return callback(null, result.success);
  }
  return callback('CloseInsert failed: unknown result');
};
ImpalaServiceClient.prototype.PingImpalaService = function(callback) {
  this._seqid = this.new_seqid();
  if (callback === undefined) {
    var _defer = Q.defer();
    this._reqs[this.seqid()] = function(error, result) {
      if (error) {
        _defer.reject(error);
      } else {
        _defer.resolve(result);
      }
    };
    this.send_PingImpalaService();
    return _defer.promise;
  } else {
    this._reqs[this.seqid()] = callback;
    this.send_PingImpalaService();
  }
};

ImpalaServiceClient.prototype.send_PingImpalaService = function() {
  var output = new this.pClass(this.output);
  output.writeMessageBegin('PingImpalaService', Thrift.MessageType.CALL, this.seqid());
  var args = new ImpalaService_PingImpalaService_args();
  args.write(output);
  output.writeMessageEnd();
  return this.output.flush();
};

ImpalaServiceClient.prototype.recv_PingImpalaService = function(input,mtype,rseqid) {
  var callback = this._reqs[rseqid] || function() {};
  delete this._reqs[rseqid];
  if (mtype == Thrift.MessageType.EXCEPTION) {
    var x = new Thrift.TApplicationException();
    x.read(input);
    input.readMessageEnd();
    return callback(x);
  }
  var result = new ImpalaService_PingImpalaService_result();
  result.read(input);
  input.readMessageEnd();

  if (null !== result.success) {
    return callback(null, result.success);
  }
  return callback('PingImpalaService failed: unknown result');
};
ImpalaServiceClient.prototype.GetExecSummary = function(handle, callback) {
  this._seqid = this.new_seqid();
  if (callback === undefined) {
    var _defer = Q.defer();
    this._reqs[this.seqid()] = function(error, result) {
      if (error) {
        _defer.reject(error);
      } else {
        _defer.resolve(result);
      }
    };
    this.send_GetExecSummary(handle);
    return _defer.promise;
  } else {
    this._reqs[this.seqid()] = callback;
    this.send_GetExecSummary(handle);
  }
};

ImpalaServiceClient.prototype.send_GetExecSummary = function(handle) {
  var output = new this.pClass(this.output);
  output.writeMessageBegin('GetExecSummary', Thrift.MessageType.CALL, this.seqid());
  var args = new ImpalaService_GetExecSummary_args();
  args.handle = handle;
  args.write(output);
  output.writeMessageEnd();
  return this.output.flush();
};

ImpalaServiceClient.prototype.recv_GetExecSummary = function(input,mtype,rseqid) {
  var callback = this._reqs[rseqid] || function() {};
  delete this._reqs[rseqid];
  if (mtype == Thrift.MessageType.EXCEPTION) {
    var x = new Thrift.TApplicationException();
    x.read(input);
    input.readMessageEnd();
    return callback(x);
  }
  var result = new ImpalaService_GetExecSummary_result();
  result.read(input);
  input.readMessageEnd();

  if (null !== result.error) {
    return callback(result.error);
  }
  if (null !== result.error2) {
    return callback(result.error2);
  }
  if (null !== result.success) {
    return callback(null, result.success);
  }
  return callback('GetExecSummary failed: unknown result');
};
ImpalaServiceProcessor = exports.Processor = function(handler) {
  this._handler = handler
}
Thrift.inherits(ImpalaServiceProcessor, BeeswaxServiceProcessor)
ImpalaServiceProcessor.prototype.process = function(input, output) {
  var r = input.readMessageBegin();
  if (this['process_' + r.fname]) {
    return this['process_' + r.fname].call(this, r.rseqid, input, output);
  } else {
    input.skip(Thrift.Type.STRUCT);
    input.readMessageEnd();
    var x = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN_METHOD, 'Unknown function ' + r.fname);
    output.writeMessageBegin(r.fname, Thrift.MessageType.EXCEPTION, r.rseqid);
    x.write(output);
    output.writeMessageEnd();
    output.flush();
  }
}

ImpalaServiceProcessor.prototype.process_Cancel = function(seqid, input, output) {
  var args = new ImpalaService_Cancel_args();
  args.read(input);
  input.readMessageEnd();
  if (this._handler.Cancel.length === 1) {
    Q.fcall(this._handler.Cancel, args.query_id)
      .then(function(result) {
        var result = new ImpalaService_Cancel_result({success: result});
        output.writeMessageBegin("Cancel", Thrift.MessageType.REPLY, seqid);
        result.write(output);
        output.writeMessageEnd();
        output.flush();
      }, function (err) {
        if (err instanceof beeswax_ttypes.BeeswaxException) {
          var result = new ImpalaService_Cancel_result(err);
          output.writeMessageBegin("Cancel", Thrift.MessageType.REPLY, seqid);
        } else {
          var result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
          output.writeMessageBegin("Cancel", Thrift.MessageType.EXCEPTION, seqid);
        }
        result.write(output);
        output.writeMessageEnd();
        output.flush();
      });
  } else {
    this._handler.Cancel(args.query_id, function (err, result) {
      if (err == null || err instanceof beeswax_ttypes.BeeswaxException) {
        var result = new ImpalaService_Cancel_result((err != null ? err : {success: result}));
        output.writeMessageBegin("Cancel", Thrift.MessageType.REPLY, seqid);
      } else {
        var result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
        output.writeMessageBegin("Cancel", Thrift.MessageType.EXCEPTION, seqid);
      }
      result.write(output);
      output.writeMessageEnd();
      output.flush();
    });
  }
}

ImpalaServiceProcessor.prototype.process_ResetCatalog = function(seqid, input, output) {
  var args = new ImpalaService_ResetCatalog_args();
  args.read(input);
  input.readMessageEnd();
  if (this._handler.ResetCatalog.length === 0) {
    Q.fcall(this._handler.ResetCatalog)
      .then(function(result) {
        var result = new ImpalaService_ResetCatalog_result({success: result});
        output.writeMessageBegin("ResetCatalog", Thrift.MessageType.REPLY, seqid);
        result.write(output);
        output.writeMessageEnd();
        output.flush();
      }, function (err) {
        var result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
        output.writeMessageBegin("ResetCatalog", Thrift.MessageType.EXCEPTION, seqid);
        result.write(output);
        output.writeMessageEnd();
        output.flush();
      });
  } else {
    this._handler.ResetCatalog(function (err, result) {
      if (err == null) {
        var result = new ImpalaService_ResetCatalog_result((err != null ? err : {success: result}));
        output.writeMessageBegin("ResetCatalog", Thrift.MessageType.REPLY, seqid);
      } else {
        var result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
        output.writeMessageBegin("ResetCatalog", Thrift.MessageType.EXCEPTION, seqid);
      }
      result.write(output);
      output.writeMessageEnd();
      output.flush();
    });
  }
}

ImpalaServiceProcessor.prototype.process_ResetTable = function(seqid, input, output) {
  var args = new ImpalaService_ResetTable_args();
  args.read(input);
  input.readMessageEnd();
  if (this._handler.ResetTable.length === 1) {
    Q.fcall(this._handler.ResetTable, args.request)
      .then(function(result) {
        var result = new ImpalaService_ResetTable_result({success: result});
        output.writeMessageBegin("ResetTable", Thrift.MessageType.REPLY, seqid);
        result.write(output);
        output.writeMessageEnd();
        output.flush();
      }, function (err) {
        var result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
        output.writeMessageBegin("ResetTable", Thrift.MessageType.EXCEPTION, seqid);
        result.write(output);
        output.writeMessageEnd();
        output.flush();
      });
  } else {
    this._handler.ResetTable(args.request, function (err, result) {
      if (err == null) {
        var result = new ImpalaService_ResetTable_result((err != null ? err : {success: result}));
        output.writeMessageBegin("ResetTable", Thrift.MessageType.REPLY, seqid);
      } else {
        var result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
        output.writeMessageBegin("ResetTable", Thrift.MessageType.EXCEPTION, seqid);
      }
      result.write(output);
      output.writeMessageEnd();
      output.flush();
    });
  }
}

ImpalaServiceProcessor.prototype.process_GetRuntimeProfile = function(seqid, input, output) {
  var args = new ImpalaService_GetRuntimeProfile_args();
  args.read(input);
  input.readMessageEnd();
  if (this._handler.GetRuntimeProfile.length === 1) {
    Q.fcall(this._handler.GetRuntimeProfile, args.query_id)
      .then(function(result) {
        var result = new ImpalaService_GetRuntimeProfile_result({success: result});
        output.writeMessageBegin("GetRuntimeProfile", Thrift.MessageType.REPLY, seqid);
        result.write(output);
        output.writeMessageEnd();
        output.flush();
      }, function (err) {
        if (err instanceof beeswax_ttypes.BeeswaxException) {
          var result = new ImpalaService_GetRuntimeProfile_result(err);
          output.writeMessageBegin("GetRuntimeProfile", Thrift.MessageType.REPLY, seqid);
        } else {
          var result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
          output.writeMessageBegin("GetRuntimeProfile", Thrift.MessageType.EXCEPTION, seqid);
        }
        result.write(output);
        output.writeMessageEnd();
        output.flush();
      });
  } else {
    this._handler.GetRuntimeProfile(args.query_id, function (err, result) {
      if (err == null || err instanceof beeswax_ttypes.BeeswaxException) {
        var result = new ImpalaService_GetRuntimeProfile_result((err != null ? err : {success: result}));
        output.writeMessageBegin("GetRuntimeProfile", Thrift.MessageType.REPLY, seqid);
      } else {
        var result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
        output.writeMessageBegin("GetRuntimeProfile", Thrift.MessageType.EXCEPTION, seqid);
      }
      result.write(output);
      output.writeMessageEnd();
      output.flush();
    });
  }
}

ImpalaServiceProcessor.prototype.process_CloseInsert = function(seqid, input, output) {
  var args = new ImpalaService_CloseInsert_args();
  args.read(input);
  input.readMessageEnd();
  if (this._handler.CloseInsert.length === 1) {
    Q.fcall(this._handler.CloseInsert, args.handle)
      .then(function(result) {
        var result = new ImpalaService_CloseInsert_result({success: result});
        output.writeMessageBegin("CloseInsert", Thrift.MessageType.REPLY, seqid);
        result.write(output);
        output.writeMessageEnd();
        output.flush();
      }, function (err) {
        if (err instanceof beeswax_ttypes.QueryNotFoundException || err instanceof beeswax_ttypes.BeeswaxException) {
          var result = new ImpalaService_CloseInsert_result(err);
          output.writeMessageBegin("CloseInsert", Thrift.MessageType.REPLY, seqid);
        } else {
          var result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
          output.writeMessageBegin("CloseInsert", Thrift.MessageType.EXCEPTION, seqid);
        }
        result.write(output);
        output.writeMessageEnd();
        output.flush();
      });
  } else {
    this._handler.CloseInsert(args.handle, function (err, result) {
      if (err == null || err instanceof beeswax_ttypes.QueryNotFoundException || err instanceof beeswax_ttypes.BeeswaxException) {
        var result = new ImpalaService_CloseInsert_result((err != null ? err : {success: result}));
        output.writeMessageBegin("CloseInsert", Thrift.MessageType.REPLY, seqid);
      } else {
        var result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
        output.writeMessageBegin("CloseInsert", Thrift.MessageType.EXCEPTION, seqid);
      }
      result.write(output);
      output.writeMessageEnd();
      output.flush();
    });
  }
}

ImpalaServiceProcessor.prototype.process_PingImpalaService = function(seqid, input, output) {
  var args = new ImpalaService_PingImpalaService_args();
  args.read(input);
  input.readMessageEnd();
  if (this._handler.PingImpalaService.length === 0) {
    Q.fcall(this._handler.PingImpalaService)
      .then(function(result) {
        var result = new ImpalaService_PingImpalaService_result({success: result});
        output.writeMessageBegin("PingImpalaService", Thrift.MessageType.REPLY, seqid);
        result.write(output);
        output.writeMessageEnd();
        output.flush();
      }, function (err) {
        var result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
        output.writeMessageBegin("PingImpalaService", Thrift.MessageType.EXCEPTION, seqid);
        result.write(output);
        output.writeMessageEnd();
        output.flush();
      });
  } else {
    this._handler.PingImpalaService(function (err, result) {
      if (err == null) {
        var result = new ImpalaService_PingImpalaService_result((err != null ? err : {success: result}));
        output.writeMessageBegin("PingImpalaService", Thrift.MessageType.REPLY, seqid);
      } else {
        var result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
        output.writeMessageBegin("PingImpalaService", Thrift.MessageType.EXCEPTION, seqid);
      }
      result.write(output);
      output.writeMessageEnd();
      output.flush();
    });
  }
}

ImpalaServiceProcessor.prototype.process_GetExecSummary = function(seqid, input, output) {
  var args = new ImpalaService_GetExecSummary_args();
  args.read(input);
  input.readMessageEnd();
  if (this._handler.GetExecSummary.length === 1) {
    Q.fcall(this._handler.GetExecSummary, args.handle)
      .then(function(result) {
        var result = new ImpalaService_GetExecSummary_result({success: result});
        output.writeMessageBegin("GetExecSummary", Thrift.MessageType.REPLY, seqid);
        result.write(output);
        output.writeMessageEnd();
        output.flush();
      }, function (err) {
        if (err instanceof beeswax_ttypes.QueryNotFoundException || err instanceof beeswax_ttypes.BeeswaxException) {
          var result = new ImpalaService_GetExecSummary_result(err);
          output.writeMessageBegin("GetExecSummary", Thrift.MessageType.REPLY, seqid);
        } else {
          var result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
          output.writeMessageBegin("GetExecSummary", Thrift.MessageType.EXCEPTION, seqid);
        }
        result.write(output);
        output.writeMessageEnd();
        output.flush();
      });
  } else {
    this._handler.GetExecSummary(args.handle, function (err, result) {
      if (err == null || err instanceof beeswax_ttypes.QueryNotFoundException || err instanceof beeswax_ttypes.BeeswaxException) {
        var result = new ImpalaService_GetExecSummary_result((err != null ? err : {success: result}));
        output.writeMessageBegin("GetExecSummary", Thrift.MessageType.REPLY, seqid);
      } else {
        var result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
        output.writeMessageBegin("GetExecSummary", Thrift.MessageType.EXCEPTION, seqid);
      }
      result.write(output);
      output.writeMessageEnd();
      output.flush();
    });
  }
}