Hi everyone,
SQLContext.createDataFrame has different behaviour in Scala or Python :

>>> l = [('Alice', 1)]
>>> sqlContext.createDataFrame(l).collect()
[Row(_1=u'Alice', _2=1)]
>>> sqlContext.createDataFrame(l, ['name', 'age']).collect()
[Row(name=u'Alice', age=1)]

and in Scala :

scala> val data = List(("Alice", 1), ("Wonderland", 0))
scala> sqlContext.createDataFrame(data, List("name", "score"))
<console>:28: error: overloaded method value createDataFrame with
alternatives: ... cannot be applied to ...

What do you think about allowing in Scala too to have a Seq of column names
for the sake of consistency ?

Regards,

Olivier.

Reply via email to