Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/apache-spark/5.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
对rdd上spark scala中的哈希连接_Scala_Apache Spark_Join_Rdd - Fatal编程技术网

对rdd上spark scala中的哈希连接

对rdd上spark scala中的哈希连接,scala,apache-spark,join,rdd,Scala,Apache Spark,Join,Rdd,我试图在spark scala中执行分区+广播连接。我有一个正在向所有节点广播的字典。该词典的结构如下: { key: Option[List[Strings]] } // I created this dictionary using a groupByKey first and then called collectAsMap before broadcasting. val join_output = table.flatMap{ case(key, value) =

我试图在spark scala中执行分区+广播连接。我有一个正在向所有节点广播的字典。该词典的结构如下:

{ key: Option[List[Strings]] } // I created this dictionary using a groupByKey first and then called collectAsMap before broadcasting.
    val join_output = table.flatMap{
      case(key, value) => custom_dictionary.value.get(key).map(
        otherValue => otherValue.foreach((value, _))
      )
    }
上述词典是使用结构类似于下表的表创建的

我有一个表,它是一对RDD,其结构如下:
A列| B列

我正在尝试执行以下连接:

{ key: Option[List[Strings]] } // I created this dictionary using a groupByKey first and then called collectAsMap before broadcasting.
    val join_output = table.flatMap{
      case(key, value) => custom_dictionary.value.get(key).map(
        otherValue => otherValue.foreach((value, _))
      )
    }
我的目标是获得一对RDD作为输出,其内容是(从表中,从字典中存储的列表中)

代码运行和编译成功,但当我检查输出时,我只看到以下内容:“()”作为保存的输出。我哪里做错了?
我确实看了一些其他的帖子,这些帖子在一定程度上反映了这个问题,但没有一个选项起作用。我要求就这个问题提供一些指导。另外,如果有帖子正好指向这一点,请让我知道。

foreach返回Unit,但如果我使用for语句作为“``for(elem),因为for循环不是表达式。它不返回任何值。请显示完整的代码好吗?