我在Scala Spark中使用笛卡尔变换,我有一组6个坐标,如下所示。
coord.collect
res114: Array[(Float, Float, Float)] = Array(
(43.13,-67.331,-18.137),
(63.914,-67.078,-16.894),
(23.13,-60.341,-28.117),
(53.914,-67.028,-16.824),
(63.11,-69.311,-18.117),
(61.924,-67.068,-16.874)
)
coord.cartesian.com为我提供了以下输出。
coord.cartesian(coord).collect
res118: Array[((Float, Float, Float), (Float, Float, Float))] = Array(
((43.13,-67.331,-18.137),(43.13,-67.331,-18.137)),
((43.13,-67.331,-18.137),(63.914,-67.078,-16.894)),
((43.13,-67.331,-18.137),(23.13,-60.341,-28.117)),
((43.13,-67.331,-18.137),(53.914,-67.028,-16.824)),
((43.13,-67.331,-18.137),(63.11,-69.311,-18.117)),
((63.914,-67.078,-16.894),(43.13,-67.331,-18.137)),
((63.914,-67.078,-16.894),(63.914,-67.078,-16.894)),
((63.914,-67.078,-16.894),(23.13,-60.341,-28.117)), ((...
为什么第六个元素不是((43.13,-67.331,-18.137),(61.924,-67.068,-16.874))?
我是否有某种不让我按顺序选择值的洗牌?
顺序无关紧要,因为没有顺序保证(当涉及到混洗时)。
只要您总共检索到36个正确的结果集(不考虑顺序),一切都很好。