知道如何进行调试的任何人:
PicklingError: Could not serialize object: TypeError: Cannot serialize socket object
我试图通过运行一个简单的示例来测试使用pyspark中的foreach编写数据库:
dt = sc.parallelize(range(1, 1000))
def writeBatchData(b):
session = driver.session()
session.run('UNWIND {batch} AS row CREATE (n:Node {v: row})', {'batch': b})
session.close()
dt.foreach(writeBatchData)