Hbase: add multiple versions of a string using JSON at the same time

From the Cloudera Hbase REST API docs, this is an XML structure for PUTmultiple lines at the same time.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  <CellSet>
    <Row key="cm93NQo=">
      <Cell column="Y2Y6ZQo=">dmFsdWU1Cg==</Cell>
      <Cell column="Y2Y6ZQo=">dmFsdWU1Cg==</Cell>
    </Row>
    <Row key="cm93NQo=">
      <Cell column="Y2Y6ZQo=">dmFsdWU1Cg==</Cell>
    </Row>
  </CellSet>

Q: How do I do this using JSON?

What I have tried so far:

  • Using a key CellSethaving the following error:

Error 500 Unrecognized field "CellSet" (class org.apache.hadoop.hbase.rest.model.CellSetModel) not marked as ignorant

    {
      "CellSet": {
        "Row": [
          {
            "key": "cm93NQo=",
            "Cell": [
              {
                "column": "Y2Y6ZQo=",
                "$": "dmFsdWU1Cg=="
              },
              {
                "column": "Y2Y6ZQo=",
                "$": "dmFsdWU1Cg=="
              }
            ]
          },
          {
            "key": "cm93NQo=",
            "Cell": [
              {
                "column": "Y2Y6ZQo=",
                "$": "dmFsdWU1Cg=="
              }
            ]
          }
        ]
      }
    }
Run codeHide result
  1. Without a key CellSetwithout errors and with only one version for the string:

{
   "Row": [
    {
      "key": "cm93NQo=",
      "Cell": [
        {
          "column": "Y2Y6ZQo=",
          "$": "dmFsdWU1Cg=="
        },
        {
          "column": "Y2Y6ZQo=",
          "$": "dmFsdWU1Cg=="
        }
      ]
    },
    {
      "key": "cm93NQo=",
      "Cell": [
        {
          "column": "Y2Y6ZQo=",
          "$": "dmFsdWU1Cg=="
        }
      ]
    }
  ]
}
Run codeHide result
+4
source share
1 answer

, , . . Cloudera HBase REST api, github, CellModel . :

"Row": [
    {
      "key": "myRowKey",
      "Cell": [
        {
          "column": "myColumn",
          "$": "value1",
          "timestamp" : 1473379200
        },
        {
          "column": "myColumn",
          "$": "value2",
          "timestamp" : 1470000000
        }
      ]
    }

, ,

+3

Source: https://habr.com/ru/post/1672225/


All Articles