apex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tushar Gosavi <tus...@datatorrent.com>
Subject Re: Datatorrent operator for Hbase
Date Thu, 20 Oct 2016 06:38:11 GMT
Hi Jaspal,

You can pass the store name through property file, like

<property>
  <name>dt.operator.HbaseOperatorName.store.tableName</name>
  <value>{name of the table}</value>
</property>

In the code,  you can set the table name and other properties in constructor.
{code}
public static class Status2Hbase extends AbstractHBasePutOutputOperator<Status>
{

public Status2Hbase()
{
  super();
  // store is initialized to HBaseStore
  store.setTableName("nameofTable");
}

@Override
public Put operationPut(Status t)
{
Put put = new Put(ByteBuffer.allocate(8).putLong(t.getCreatedAt().getTime()).array());
put.add("cf".getBytes(), "text".getBytes(), t.getText().getBytes());
put.add("cf".getBytes(), "userid".getBytes(), t.getText().getBytes());
return put;
}
}
{code}

- Tushar.


On Thu, Oct 20, 2016 at 11:59 AM, Jaspal Singh
<jaspal.singh1404@gmail.com> wrote:
> Hi Thomas, Thanks for sharing this example code.
>  Still I couldn't see where the hbase tablename is configured, it says in
> description that it can be configured.
>
> Can you please highlight where it is specified ?
>
> Thanks!!
>
>
> On Wednesday, October 19, 2016, Thomas Weise <thw@apache.org> wrote:
>>
>> Here is an example that uses HBase that may be helpful:
>>
>>
>> https://github.com/apache/apex-malhar/blob/master/demos/twitter/src/main/java/com/datatorrent/demos/twitter/TwitterDumpHBaseApplication.java
>>
>> Thomas
>>
>> On Wed, Oct 19, 2016 at 6:36 PM, Jaspal Singh <jaspal.singh1404@gmail.com>
>> wrote:
>>>
>>> Where I need to set the table name. In property file or the application
>>> code ?
>>>
>>>
>>> Thanks!!
>>>
>>>
>>> On Wednesday, October 19, 2016, Sanjay Pujare <sanjay@datatorrent.com>
>>> wrote:
>>>>
>>>> Take a look at
>>>> https://github.com/apache/apex-malhar/tree/master/contrib/src/main/java/com/datatorrent/contrib/hbase
>>>> . There are multiple output operators there.
>>>>
>>>>
>>>>
>>>> You specify the table name using HBaseStore.setTableName
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> From: "Bandaru, Srinivas" <srinivas.bandaru@optum.com>
>>>> Reply-To: <users@apex.apache.org>
>>>> Date: Wednesday, October 19, 2016 at 3:09 PM
>>>> To: "users@apex.apache.org" <users@apex.apache.org>
>>>> Subject: Datatorrent operator for Hbase
>>>>
>>>>
>>>>
>>>> Hi,
>>>>
>>>> I want to write the data from an operator to a hbase table.  Which
>>>> operator I can use to write to  Hbase table?
>>>>
>>>> Also how to specify the Hbase table name?
>>>>
>>>>
>>>>
>>>> Thanks,
>>>>
>>>> Srinivas Bandaru
>>>>
>>>>
>>>>
>>>>
>>>> This e-mail, including attachments, may include confidential and/or
>>>> proprietary information, and may be used only by the person or entity
>>>> to which it is addressed. If the reader of this e-mail is not the
>>>> intended
>>>> recipient or his or her authorized agent, the reader is hereby notified
>>>> that any dissemination, distribution or copying of this e-mail is
>>>> prohibited. If you have received this e-mail in error, please notify the
>>>> sender by replying to this message and delete this e-mail immediately.
>>
>>
>

Mime
View raw message