2016-08-22 82 views
0

我正嘗試做火花蒙戈連接器,像一個簡單的查詢,查詢:

sqlContext.sql("SELECT members.name FROM members WHERE age >= 100") 

Mike 
Peter 
... 

但是當我試圖表現出與字符串陣列(members.child_names)它不執行$放鬆,它生成的字符串鏈:

sqlContext.sql("SELECT members.child_names FROM members WHERE age >= 100") 
Mike_child, Peter_child... 

是否有可能的項目,查詢做$放鬆???

回答

2

您可以隨時爆炸的:

sqlContext.sql(""" 
    SELECT EXPLODE(members.child_names) FROM members WHERE age >= 100 
""")