1
要刪除重複的行,我嘗試這個SQL如何解決這個火花斯卡拉SQL錯誤消息
val characters = MongoSpark.load[sparkSQL.Character](sparkSession)
characters.createOrReplaceTempView("characters")
val testsql = sparkSession.select("SELECT * FROM characters GROUP BY title")
testsql.show()
但此SQL使此錯誤消息。 如果你知道這個問題,請回答這個問題。
感謝您
Parsing command: SELECT * FROM characters GROUP BY title
Exception in thread "main" org.spache.spark.sql.AnalysisException:
expression 'characters.`url`' is neither present in the group by, nor is it an aggregate function
Add to Add to group by or wrap in first() if you don't care which value you get.;;
,然後我試圖這樣,但我不知道這是正確的解決方案....
請回答這個問題。謝謝!
val characters = MongoSpark.load[sparkSQL.Character](sparkSession)
characters.createOrReplaceTempView("characters")
val testsql = sparkSession.select("SELECT * FROM characters")
testgrsql = testsql.groupBy("title")
testgrsql.show()
SELECT colums'VAL testsql = sparkSession.sql(「選擇從標題字符GROUP BY稱號「)',如果你沒有使用任何聚合函數。 – mrsrinivas
嗨,如果下面的答案已經解決了您的問題,請考慮[接受它](http://meta.stackexchange.com/q/5234/179419)或添加您自己的解決方案。所以,這表明你已經找到了解決方案。 – mrsrinivas