You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by "Vaibhav Puranik (JIRA)" <ji...@apache.org> on 2009/12/15 22:45:18 UTC

[jira] Commented: (HBASE-1990) Add methods accepting strings for family/qualifier in client

    [ https://issues.apache.org/jira/browse/HBASE-1990?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12790971#action_12790971 ] 

Vaibhav Puranik commented on HBASE-1990:
----------------------------------------

The concept of  TestHTableGenerics.java is good, but unfortunately it might not work even for simpler use cases. Let's discuss the following example:
{noformat}
Put<String, String, String, String> put =      new Put<String, String, String, String>("row1");
    put.add("family", "stringtest", "stringdata");
    ht.put(put.getPut());
{noformat}
The above example forces you to pick a data type for values at the instantiation of the Put object. But in most cases (at least in our software) we have different data types in a row such as Long, String, Custom Object etc.
Even a typical relational database table always have multiple data types in a row.

If you exclude the value and keep the value as byte array, it should be sufficient for 80% of the use cases. (Even though we have many columns where the column name is not a string, they are a minority)

> Add methods accepting strings for family/qualifier in client 
> -------------------------------------------------------------
>
>                 Key: HBASE-1990
>                 URL: https://issues.apache.org/jira/browse/HBASE-1990
>             Project: Hadoop HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.20.0
>            Reporter: Doug Meil
>            Priority: Minor
>             Fix For: 0.20.3, 0.21.0
>
>         Attachments: TestHTableGenerics.java
>
>
> Consider the following client code...
> 	byte b[] = result.getValue( Bytes.toBytes("family"), Bytes.toBytes("qualifier") );
>         put.add( Bytes.toBytes("family"), Bytes.toBytes("qualifer"), Bytes.toBytes( "value")  );
> ... the requirement to supply family and qualifiers as bytes causes code to get cluttered and verbose.  At worst, it scares peoples un-necessarily about HBase development, and at best, developers inevitably will get tired of doing all this casting and then add their own wrapper classes around the HBase client to make their code more readable.
> I would like to see something like this in the API...
> 	byte b[] = result.getValue( "family"), "qualifier" );
>         put.add( "family", "qualifer", Bytes.toBytes( "value")  );
> ... where the Hbase client can perform the required Bytes.toBytes() conversion behind the scenes.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.