Change Mahout Item based recommeder output format into table

292 Views Asked by At

I am using Mahout Item based recommendation algorithms, In the end when we are getting the result in "XXX [y:z, y2;z2......]" format. I want to create a table on that in format:

  • XXX y z
  • XXX y2 z2

I am using HIVE for that. So I have created a table and then using "explode()" function but problem is that "[" is also coming in the result as

  • XXX [y z
  • ..
  • XXX yn zn]

How can i remove bracket from the result.

1

There are 1 best solutions below

0
Andrey Tatarinov On

I would use regexp_replace function (documentation) to filter out square brackets, and then use explode as you did already.