鉴于我们可以在下面的数据框中看到相同的列名称,正如我在其他地方指出的:
root
|-- week: string (nullable = true)
|-- dim1: integer (nullable = false)
|-- dim2: string (nullable = true)
|-- t1: integer (nullable = false)
|-- t2: integer (nullable = false)
|-- t3: integer (nullable = false)
|-- t1: integer (nullable = false)
|-- t2: integer (nullable = false)
|-- t3: integer (nullable = false)
|-- t1_diff: integer (nullable = false)
|-- t2_diff: integer (nullable = false)
而且:
df.select("t1").show(false)
返回不明确的引用,那么如何声明要选择哪一个?
val df = Seq(
("2016-04-02",14, null, 9784, 880, 23, 9789, 820, 45, -5, 60),
("2016-04-30",14, "FR", 9785, 13, 34, 9785, 9, 67, 90, 4),
("2016-04-16",14, "FR", 9785, 13, 34, 9785, 9, 67, -100, -123)
).toDF("week", "dim1", "dim2", "t1", "t2", "t3", "t1", "t2", "t3", "t1_diff", "t2_diff")
对我来说有些不一致,也不是我想做的事情,但我确实注意到了这一点,所以更多的是出于好奇。似乎是疏忽?