Syncfusion.ThriftHBase.Base is a .NET library to access HBase records through HBase Thrift Server. Internally it utilizes the Thrift generated C# code for accessing HBase records. Currently it supports following platforms.

  • Windows Forms
  • WPF

Assemblies required

The following assembly should be referenced in your application to access HBase records in C# application.

  • Syncfusion.ThriftHBase.Base.dll
  • Thrift.dll

Getting Started

In this section, you can see how to get started with Syncfusion.ThriftHBase.Base to access HBase records through HBase Thrift Server. After adding reference to Syncfusion.ThriftHBase.Base.dll assembly in your application, include below namespace in your .cs or .vb file.


using Syncfusion.ThriftHBase.Base;

Before proceeding further, ensure that the HBase Master server, HBase Region server and HBase Thrift Server services are running on the System along with Hadoop services.


By default HBase Thrift Server will be started in 10003 port.

Establish Connection

//Initialize the connection

HBaseConnection con = new HBaseConnection ("localhost", 10003);

//Open the HiveServer connection

The above code is used to establish connection with HBase Thrift Server running in local machine under port no: 10003. In order to switch to HBase Thrift Server running in remote machines, you need to replace the “localhost” with corresponding host name / IP address.

Closing Connection

//Closing the HBase Server connection

The above code is used to close the connection established.


Connection must be closed properly after every operation done.

Table Operations

1.Creating a table

Below code show how to create a table by using the connection object with HBase Thrift Server.

//Initialize the connection

HBaseConnection con = new HBaseConnection ("localhost", 10003);

//Open the HBase Server connection

//Create a list for Column Families

List<string> columnFamilies = new List<string>();
//Create table in HBase by passing the Column family names and the connection object created 

HBaseOperation.CreateTable(tableName, columnFamilies, con);
//Close HBase Server connection 


2.Describe Table

Below code shows how to get the table schema defined for a particular table from HBase using GetColumnDescriptors method.

//Retrieves the schema for the table given as input

HSchema tableSchema = HBaseOperation.GetColumnDescriptors(tableName, con);

3.Drop Table

To drop a table from HBase, use the following code.

//Drop or delete the table from HBase

HBaseOperation.DropTable(tableName, con);

4.Filter Values

We have added full support for thrift service based filter operation. Below code demonstrate the usage of row filter operation for a record value with prefix “1002”

//Filter string value for RowFilter operation having prefix value “1002”

var rowFilter = new FilterString().RowFilter(CompareOperator.Equal,

//Scans values from HBase table by filtering the value for the given filter condition

   HBaseResultSet rowFilterResult = HBaseOperation.ScanTable(tableName, rowFilter, con); 

5.Inserting values

Below code illustrates on how to insert records into HBase table.

//Initializing the collection variable for storing multiple row values.
Dictionary<string, IList<HMutation>> rowCollection = new Dictionary<string, IList<HMutation>>();

//Initializing the mutation collection variable.

   List<HMutation> mutations = new List<HMutation>();
//RowKey value for a particular record.
   rowKey = “1”;
//Declaring mutation value for a single row.

	HMutation mutation = new HMutation();
	mutation.ColumnFamily = “info”
	mutation.ColumnName = “fullname”;
	mutation.Value = “Gustavo Achong”;
//Adding the mutation of a single row to the mutation collection.

//Adding mutation collection to the row collection with the ‘rowKey’ as index value.

    rowCollection[rowKey] = mutations;
//Inserts the multiple rows collection to the given input table.

    HBaseOperation.InsertRows(tableName, rowCollection, con);	


IsTableExists API checks whether the given table exists in the HBase or not. Returns ‘true’ if table exists.

//Checks whether the table exists in HBase.
Bool isTableExist = HBaseOperation.IsTableExists(tableName, con);

7.List Tables

Below code illustrates on how to retrieve the list of table names available in the HBase.

//Gets the list of table names in HBase.
IList<string> tableList = HBaseOperation.ListTables(con);

8.Scanning values

The below code illustrates on how to scan values from the given table. Number of rows to be fetched can be restricted by using the ‘HBaseOperation.FetchSize’ object.

//Restrict number of rows fetched from HBase table as 100.
HBaseOperation.FetchSize = 100;
//Scan values from the given HBase table and returns as HBaseResultSet.
HBaseResultSet table = HBaseOperation.ScanTable(tableName, con);   


FetchSize is used to define the number of rows that you want to fetch from a table. If FetchSize is not defined then only one row will be fetched.