hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Helmling <ghelml...@gmail.com>
Subject Re: Integrity constraints
Date Wed, 25 Apr 2012 06:06:39 GMT
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 <vamshi2105@gmail.com> 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
> *

View raw message