如何在scala中设置spark.sql.pivotMaxValues? [英] how to set spark.sql.pivotMaxValues in scala?

查看:76
本文介绍了如何在scala中设置spark.sql.pivotMaxValues?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能是一个愚蠢的问题,但是当尝试在数据块中进行pivit时如何设置spark.sql.pivotMaxValues?我收到此巨大错误' org.apache.spark.sql.AnalysisException:枢轴列census_block_group具有超过10000个不同的值,这可能表示错误.如果打算这样做,请将spark.sql.pivotMaxValues至少设置为枢轴列的不同值的数量.; 这样任何人都知道如何解决此问题?

this may be a dumb question but how do i set spark.sql.pivotMaxValues when trying to pivit in databricks ? im getting this huge error 'org.apache.spark.sql.AnalysisException: The pivot column census_block_group has more than 10000 distinct values, this could indicate an error. If this was intended, set spark.sql.pivotMaxValues to at least the number of distinct values of the pivot column.; so anybody know how do i fix this issue ?

import org.apache.spark.sql.SQLContext

 val df = censusBlocks.toDF
df.groupBy("B08007e1").pivot("census_block_group").sum("B08008e4")
df.show()

推荐答案

您可以使用

spark.conf.set("spark.sql.pivotMaxValues", 10000)

这篇关于如何在scala中设置spark.sql.pivotMaxValues?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆