我需要在考拉DataFrame上进行元素级操作。为此,我使用了考拉applymap方法。在执行时,Koalas将所有数据移动到一个分区,然后应用该操作。结果是工作的表现非常差。
>>> sdf = spark.range(0, 10**7, 1, 10).toDF('col1').withColumn('col2', F.lit('[1,2]'))
>>> kdf = ks.DataFrame(sdf)
>>> kdf_new = kdf[['col2']].applymap(eval)
WARN window.WindowExec: No Partition Defined for Window operation! Moving all data to a single partition, this can cause serious performance degradation.如何强制考拉不对数据进行混洗,并将操作应用于已有的分区?
发布于 2021-05-27 07:41:14
您可以通过在考拉DataFrame上指定索引来修复此问题。默认索引预计会给出较差的性能。阅读有关考拉的default index type。
指定不同的默认索引
ks.options.compute.default_index_type = 'distributed-sequence'或者在DataFrame上指定一个特定的索引(即不使用默认索引
kdf = kdf.set_index('col1')https://stackoverflow.com/questions/62084723
复制相似问题