我正在尝试在python中使用Hive子查询,但我看到了不支持的语言功能消息。我在代码中遗漏了什么,或者使用pyspark不支持嵌套查询?
我的Python版本是2.6.6。
from pyspark.context import SparkContext
from pyspark.sql import HiveContext
###Establising Spark Hive connection
sc = SparkContext()
sqlContext = HiveContext(sc)
hv_qr = "select st.store_num, 'NULL' as st.store_type, st.prjt_type FROM dis_ingst.store_info st WHERE st.store_num NOT IN (select store_number FROM dis_ingst.store_combine WHERE prjt_type IN (\"MX\", \"CN\", \"UK\")) AND st.prjt_type IN (\"MX\", \"CN\", \"UK\") limit 10"
val = sqlContext.sql(hv_qr)
output = val.collect()
print output
Error:
pyspark.sql.utils.AnalysisException: u'\nUnsupported language features in query: select st.store_num, 'NULL' as st.store_type, st.prjt_type FROM dis_ingst.store_info st WHERE st.store_num NOT IN (select store_number FROM dis_ingst.store_combine WHERE prjt_type IN (\"MX\", \"CN\", \"UK\")) AND st.prjt_type IN (\"MX\", \"CN\", \"UK\") limit 10