2

The value of column scores are delimited by comma. Each userid has at least a score and there is no upper limit for the number of scores of each userid.

+--------+---------+
| userid | scores  |
+--------+---------+
| u1     | C,B,A   |
| u2     | A       |
| u3     | A,C     |
+--------+---------+

I want to get the result by 'select ...' sql

+--------+---------+
| userid | score   |
+--------+---------+
| u1     | C       |
| u1     | B       |
| u1     | A       |
| u2     | A       |
| u3     | A       |
| u3     | C       |
+--------+---------+

In hive, lateral view explode(split(score,',')) may realize the requirement,

select userid, score from my_table lateral view explode(split(scores,',')) scores as score;

However impala does not support explode.

Is there an alternative way to realize it in impala?

liznzn
  • 21
  • 1
  • 3

0 Answers0