Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
HBase >> mail # user >> Integrity constraints

Vamshi Krishna 2012-04-25, 04:35
Copy link to this message
Re: Integrity constraints
Hi Vamshi,

See the ConstraintProcessor coprocessor that was added for just this
kind of case: http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/constraint/package-summary.html

You would need to implement the Constraint interface and apply the
configuration to your tables via the Constraints utility.

Assuming the fields are being handled as strings on the client end,
your Constraint implementation could simply call Bytes.toString() and
apply some basic regexs for validation.  Or you could consider using a
more structured serialization format like protobufs.


On Tue, Apr 24, 2012 at 9:35 PM, Vamshi Krishna <[EMAIL PROTECTED]> wrote:
> Hi all ,  here i am having one basic doubt about constraints on hbase
> table, after knowing there is no concept of data types in hbase and
> everything is stored in the bytes.
>  Suppose a table in hbase has 3 columns,(under same column family)
> 1st column is 'Name' which accepts only character strings not numbers and
> special symbols.
> 2nd column 'phoneNumber', which is numerals that too exactly 10 digits, and
> 3rd column 'city' which should accept only upper case character strings. If
> such is the situation, how to enforce the constraints on each of the
> columns of hbase table?
> Also Can anybody please tell how to write the equivalent  query in hbase
> shell and Java to do so?
> --
> *Regards*
> *
> Vamshi Krishna
> *
Vamshi Krishna 2012-04-25, 15:29