blob: 166a9fca965ee2ffcead48ffc778f694e231d9eb (
plain)
1
2
3
4
5
6
7
8
9
|
from pyspark.sql import SparkSession
spark = SparkSession.builder.getOrCreate()
dataList = [1, 2, 3, 4, 5]
rdd = spark.sparkContext.parallelize(dataList)
rdd2 = rdd.flatMap(lambda x: str(x))
data = rdd2.collect()
for x in data:
print(type(x), x)
|