Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/mercurial/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Scala 在SparkSQL中解决数据倾斜_Scala_Apache Spark - Fatal编程技术网

Scala 在SparkSQL中解决数据倾斜

Scala 在SparkSQL中解决数据倾斜,scala,apache-spark,Scala,Apache Spark,我有一个连接事实表和维度表的SPARK SQL代码。连接条件会导致数据倾斜,因为与其他结果组合相比,其中一个结果组合将拥有大量数据。在scala中,我认为这可以通过 partitionBy(new org.apache.spark.HashPartitioner(160)) 但这只适用于RDD,而不适用于schemaRDD 有没有一个与此相当的 下面是我的代码的样子 sqlContext.sql("select product_category,shipment_item_id

我有一个连接事实表和维度表的SPARK SQL代码。连接条件会导致数据倾斜,因为与其他结果组合相比,其中一个结果组合将拥有大量数据。在scala中,我认为这可以通过

    partitionBy(new org.apache.spark.HashPartitioner(160))
但这只适用于RDD,而不适用于schemaRDD

有没有一个与此相当的

下面是我的代码的样子

    sqlContext.sql("select product_category,shipment_item_id,shipment_amount from shipments_fact f left outer join product_category pc on f.category_code = pc.category_code")

请求帮助…

如果您只想增加洗牌过程的分区数量,可以使用
sqlContext.sql(“set spark.sql.shuffle.partitions=“”)
。默认情况下,此配置的值为200。这在spark 1.0.1上适用吗?我知道它存在于1.1.0中……是否有替代方案?它应该在1.0.1中工作。谢谢……我测试了它,它确实工作得很好……在spark 1.0.0中,我在线程“main”java.lang中得到了
异常。RuntimeException:[1.1]失败:`INSERT'预期,但找到了标识符集