我怎么能按照这个复制行?
|source_ip |dest_ip |source_port|dest_port|
|192.168.1.1|10.0.0.1|5343 |22 |转到
|ip |source_port|dest_port|
|192.168.1.1|5343 |22 |
|10.0.0.1 |5343 |22 |用火种?
发布于 2020-08-13 13:23:05
尝试使用array和explode.
Example:
df.show()
#+-----------+--------+-----------+---------+
#| ip| dest_ip|source_port|dest_port|
#+-----------+--------+-----------+---------+
#|192.168.1.1|10.0.0.1| 5343| 22|
#+-----------+--------+-----------+---------+
df.withColumn("arr",array(col("ip"),col("dest_ip"))).\
selectExpr("explode(arr) as ip","source_port","dest_port").\
show()
#+-----------+-----------+---------+
#| ip|source_port|dest_port|
#+-----------+-----------+---------+
#|192.168.1.1| 5343| 22|
#| 10.0.0.1| 5343| 22|
#+-----------+-----------+---------+https://stackoverflow.com/questions/63394741
复制相似问题