Uploaded image for project: 'Apache Gora'
  1. Apache Gora
  2. GORA-195

[gora-hbase] Allow mapping of an array to a single column

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Trivial
    • Resolution: Unresolved
    • 0.2.1
    • 1.0
    • gora-hbase
    • None
    • HBase 0.90.4 backend, Hadoop 1.0.1

    Description

      At this time, defining a mapping in HBase for an array field to a family:column like this:

      {"name": "A",
       "fields": [
              {"name": "field",  "type": {"type": "array", "values": "string"}}
         ]
      }
      
      <class name="A" ...>
        <field name="field" family="r" qualifier="c"/>
      </class&gt;
      
      

      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:

      {"name": "A",
       "fields": [
              {"name":"holder", "type:" ["null", {
                          "name":"holderRecord",
                          "type":"record",
                          "fields": [
                               {"name": "field",  "type": {"type": "array", "values": "string"}}
                           ]
              }}
         ]
      }
      
      

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            alfonsonishikawa Alfonso Nishikawa Muñumer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: