AnsweredAssumed Answered

Querying MapR streams using Hbase

Question asked by mahdi62b on Nov 16, 2016
Latest reply on Nov 30, 2016 by cmcdonald

Hi,

 

I want to query MapR streams using Hbase..But I don't know exactly what are the columns related to MapR streams..Following this link..the structure for MapR streams are as follow:

{     "_id":<STRING>,
     "topic":<STRING>,
     "partition":<SHORT>,
     "offset":<LONG>, 
    "timestamp":<LONG>, 
    "producer":<VARCHAR>, 
    "key":<BINARY>,  
   "value":<VARBINARY>
}

 

My stream name is .."/sample-stream"..I use bellow code to query the stream

 

val config = HBaseConfiguration.create()
val table = new HTable(config, "/sample-stream")and 

// Instantiating Get class
val g = new Get(Bytes.toBytes("???row1?????"))

 

// Reading the data
val result = table.get(g)

 

// Reading values from Result class object
val value = result.getValue(Bytes.toBytes("???familyname???"),Bytes.toBytes("topic"))

 

// Printing the values
val svalue= Bytes.toString(value)

 

System.out.println("value: " + svalue)

 

But I don't know exactly what are the column names related to a MapR stream ..for example how to change the above code to access the "value" and "key" column?

Outcomes