[
https://issues.apache.org/jira/browse/GORA-195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13544332#comment-13544332
]
Alfonso Nishikawa commented on GORA-195:
----------------------------------------
Hi, Renato. Don't worry. Sorry for how badly I explain myself.
HBase at this moment recomends using only a few families (column families) as
stated in it's documentation [0]. This is not bad. To achieve that, one way is
map(.xml) "maps" and "arrays" to a family:column. In some cases this could be
beneficial.
But in Gora+HBase you can't do this. You can only map(.xml) "maps" and "arrays"
to families, so you are forced to create a family for each map/array.
About the "unexpected behaviour", at this state, if you configure your
mapping(.xml) to map(.xml) "map" or "array" to a family:column, you don't get
an exception, nor a config error, nor nothing. All works, but the data you get
when you read one of this fields is trash. I wanted to notice it as a warning,
since maybe all seems to work fine until you examine your data.
Thanks for asking for a clarification :)
[0] - http://hbase.apache.org/book/number.of.cfs.html
> [gora-hbase] Allow mapping of an array to a single column
> ---------------------------------------------------------
>
> Key: GORA-195
> URL: https://issues.apache.org/jira/browse/GORA-195
> Project: Apache Gora
> Issue Type: Improvement
> Components: storage-hbase
> Affects Versions: 0.2.1
> Environment: HBase 0.90.4 backend, Hadoop 1.0.1
> Reporter: Alfonso Nishikawa
> Priority: Trivial
>
> At this time, defining a mapping in HBase for an array field to a
> family:column like this:
> {code}
> {"name": "A",
> "fields": [
> {"name": "field", "type": {"type": "array", "values": "string"}}
> ]
> }
> <class name="A" ...>
> <field name="field" family="r" qualifier="c"/>
> </class>
> {code}
> in HBase is discouraging since gets to an unexpected behavior loading parts
> of the rest of the record.
> So: by now only is allowed mappings of arrays(and maps) to families.
> Workaround: enclose the array inside an inner optional record like this:
> {code}
> {"name": "A",
> "fields": [
> {"name":"holder", "type:" ["null", {
> "name":"holderRecord",
> "type":"record",
> "fields": [
> {"name": "field", "type": {"type": "array",
> "values": "string"}}
> ]
> }}
> ]
> }
> {code}
> The necessity comes partially if you don't want to create a family for each
> array in you HBase database (advised not to do), or if you just want to map
> to a column when your array is read-only.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira