Hadoop 如何获取配置单元中所有可能的模式
我有以下表格:Hadoop 如何获取配置单元中所有可能的模式,hadoop,hive,hiveql,Hadoop,Hive,Hiveql,我有以下表格: +----------+----+ |customerID|name| +----------+----+ | 1| Ram| +----------+----+ 我希望输出为(列值的所有可能值): 拆分字符串、分解数组并使用自身交叉连接来查找所有可能的组合: with s as (select col from (select explode( split(lower('Ram'),'')) as col)s
+----------+----+
|customerID|name|
+----------+----+
| 1| Ram|
+----------+----+
我希望输出为(列值的所有可能值):
拆分字符串、分解数组并使用自身交叉连接来查找所有可能的组合:
with s as (select col
from (select explode( split(lower('Ram'),'')) as col)s
where col <>''
)
select concat(upper(s1.col), s2.col, s3.col) as name,
row_number() over() as customerId
from s s1
cross join s s2
cross join s s3
where s1.col<>s2.col and s2.col<>s3.col;
如果没有last,其中s1.cols2.col和s2.cols3.col
您将获得所有组合,如Aaa
,Arr
,Rrr
等
with s as (select col
from (select explode( split(lower('Ram'),'')) as col)s
where col <>''
)
select concat(upper(s1.col), s2.col, s3.col) as name,
row_number() over() as customerId
from s s1
cross join s s2
cross join s s3
where s1.col<>s2.col and s2.col<>s3.col;
OK
name customerid
Mam 1
Mar 2
Mrm 3
Mra 4
Ama 5
Amr 6
Arm 7
Ara 8
Rma 9
Rmr 10
Ram 11
Rar 12
Time taken: 185.638 seconds, Fetched: 12 row(s)