You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@gora.apache.org by "Alfonso Nishikawa (JIRA)" <ji...@apache.org> on 2013/01/04 13:22:13 UTC

[jira] [Created] (GORA-195) [gora-hbase] Allow mapping of an array to a single column

Alfonso Nishikawa created GORA-195:
--------------------------------------

             Summary: [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