级联中的交叉连接

Crossjoin in Cascading

我想在级联中交叉连接两个元组流。假设有两个列表:女士们和先生们,目标是将所有可能的女士-绅士组合写到一个文件中(例如,来自假设约会网站的 "women seeking men" 部分的所有可能匹配项)。

我在 this blog and attempted to tweak the code to make a crossjoin (see https://github.com/alexwoolford/cascading-crossjoin-Whosebug-question 上找到了一个类似的例子。

Crossjoin class 中的 operate 方法抛出空指针。首先,getJoinerClosure() 这一行的调用 returns null:

JoinerClosure joinerClosure = bufferCall.getJoinerClosure();

... 然后紧随其后的 if 语句尝试获取 null:

的大小
if( joinerClosure.size() != 2 )
    [...]

...导致空指针异常。

你能看出我错在哪里吗?

当我从 new CoGroup 构造函数中删除 rhsGroupFields 参数时,它起作用了,即从:

Pipe pipeLadiesAndGentlemen = new CoGroup(pipeLadies, Fields.NONE, pipeGentlemen, Fields.NONE, new Fields("lady", "gentleman"), new BufferJoin());

.. 至:

Pipe pipeLadiesAndGentlemen = new CoGroup(pipeLadies, Fields.NONE, pipeGentlemen, Fields.NONE, new BufferJoin());