pspark sql模块无法识别列

时间:2016-09-19 07:09:43

标签: sql pyspark

我有一个这样的数据框:

| Cid|               Cname| acctype|  accnum|country|currency |rank   |
+----+--------------------+--------+--------+-------+---------+-------+
|6489|   u'Kristi Bradley'| current|62814653|     US|      USD|    296|
|4204| u'Elizabeth Ande...| current|18476174|     US|      USD|    237|
|6020|    u'Melody Miller'| current|84315491|     US|      USD|    285|
|9512|     u'William Wise'| deposit|37582740|     US|      USD|    277|
|7223|  u'Jackie Arellano'| current|46939546|     US|      USD|    498|
|8514|  u'Michael Hawkins'| current|90554826|     US|      USD|    498|
|6075|     u'James Garcia'| current|77363343|     US|      USD|     53|
|7700| u'Margaret Phill...| deposit|18799392|     US|      USD|    399|

我有像这样的pyspark sql模块查询:

result = sqlContext.sql("SELECT sum(rank) FROM US_df WHERE acctype ='current' ")

但我得到的结果如下:

| _c0|
+----+
|null|
+----+

我在这里做错了什么?

0 个答案:

没有答案