The code below throws the following error: type mismatch; found : scala.collection.mutable.Buffer[scala.collection.immutable.Map[String,String]] required: Map[String,String]
def getRecordsByRegExp(table: String, family: String, regExp: String): Future[Seq[SomeClass]] = {
val scanner = hBaseClient.newScanner(table)
scanner.setFamily(family)
scanner.setFilter(new KeyRegexpFilter(regExp))
scanner.nextRows.map(arrayList =>
arrayList.flatten.map(x =>
Record(
table,
new String(x.key),
arrayList.map(keyValues =>
keyValues.map(kv => new String(kv.qualifier) -> new String(kv.value)).toMap))))
}
SomeClass definition: SomeClass(table: String, key: String, values: Map[String, String])
Any tips on how to get over this?
Later edit: added all the code
scanner
? – Till RohrmannarrayList
? If so, then you should probably call firstarrayList.flatten
before applying themap
call where you create theMap
. If not, then you should select the element ofarrayList
for which you want to construct theMap
. – Till Rohrmann