HBase概念視圖

2021-06-15 10:39 更新

contentsHBase概念視圖

本節(jié)介紹 HBase 的概念視圖。

本節(jié)的示例是根據(jù)  BigTable 論文進(jìn)行稍微修改后的示例。在本節(jié)的示例中有一個名為表 webtable,其中包含兩行(com.cnn.www 和 com.example.www)以及名為 contents、anchor 和 people 的三個列族。在本例中,對于第一行(com.cnn.www), anchor 包含兩列(anchor:cssnsi.com,anchor:my.look.ca),并且 contents 包含一列(contents:html)。本示例包含具有行鍵 com.cnn.www 的行的5個版本,以及具有行鍵 com.example.www 的行的一個版本。contents:html 列限定符包含給定網(wǎng)站的整個 HTML。錨(anchor)列族的限定符每個包含與該行所表示的站點鏈接的外部站點以及它在其鏈接的錨點(anchor)中使用的文本。people 列族代表與該網(wǎng)站相關(guān)的人員。

列名稱:按照約定,列名由其列族前綴和限定符組成。例如,列內(nèi)容: html 由列族contentshtml限定符組成。冒號字符(:)從列族限定符分隔列族。

 webtable 表如下所示:

行鍵(Row Key)
時間戳(Time Stamp)
ColumnFamilycontentsColumnFamilyanchorColumnFamily people

“com.cnn.www”

T9

anchor:cnnsi.com =“CNN”

“com.cnn.www”

T8

anchor:my.look.ca =“CNN.com”

“com.cnn.www”

T6

contents:html =“<html> ...”

“com.cnn.www”

T5

contents:html =“<html> ...”

“com.cnn.www”

T3

contents:html =“<html> ...”

“com.example.www”

T5

contents:html =“<html> ...”

people:author = "John Doe"

此表中顯示為空的單元格在 HBase 中不占用空間或?qū)嶋H上存在。這正是使 HBase “稀疏”的原因。表格視圖并不是查看 HBase 數(shù)據(jù)的唯一可能的方法,甚至是最準(zhǔn)確的。以下代表與多維地圖相同的信息。這只是用于說明目的的模擬,可能并不嚴(yán)格準(zhǔn)確。

{
  "com.cnn.www": {
    contents: {
      t6: contents:html: "<html>..."
      t5: contents:html: "<html>..."
      t3: contents:html: "<html>..."
    }
    anchor: {
      t9: anchor:cnnsi.com = "CNN"
      t8: anchor:my.look.ca = "CNN.com"
    }
    people: {}
  }
  "com.example.www": {
    contents: {
      t5: contents:html: "<html>..."
    }
    anchor: {}
    people: {
      t5: people:author: "John Doe"
    }
  }
}


以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號