2016-08-24 177 views
0

使用通配符我有這樣一個數據幀:在星火SQL

+-------------------------------------------+ 
|url          | 
+-------------------------------------------+ 
|/v3/references/genders      | 
|/en/job/restaurant-manager-6619735/panels | 
|/en/job-search/dealer-coordinator-jobs/ | 
|/en/job/engineer-3034030/panels   | 
|/en/job/business-analyst-5385899   | 
+-------------------------------------------+ 

我試圖獲得計數包含「工作」,每個URL。我試過這個,但是我得到了空的結果。

df.createOrReplaceTempView("table") 
spark.sql("select url, count(url) from table where url like 'job'").show() 

那個sql有什麼問題? 謝謝!

回答

0

試試這個。

spark.sql("select url, count(url) from table where url like '%job%' GROUP BY url").show() 
+0

謝謝!現在工作 –