斯卡拉火花中笛卡尔变换的奇怪行为

时间:2015-11-03 21:13:23

标签: scala apache-spark cartesian

我在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.coord给了我以下输出。

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)),  ((...

为什么第6个元素不是((43.13,-67.331,-18.137),(61.924,-67.068,-16.874))?

我是否会进行某种洗牌,不让我按顺序选择值?

1 个答案:

答案 0 :(得分:1)

订单无关紧要,因为没有订单保证(当涉及改组时)。

只要你总共检索到36个正确的结果(不考虑订单),一切都很好。