You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Apache Spark (JIRA)" <ji...@apache.org> on 2016/04/30 09:22:13 UTC

[jira] [Commented] (SPARK-15031) Fix SQL python example

    [ https://issues.apache.org/jira/browse/SPARK-15031?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15265218#comment-15265218 ] 

Apache Spark commented on SPARK-15031:
--------------------------------------

User 'dongjoon-hyun' has created a pull request for this issue:
https://github.com/apache/spark/pull/12809

> Fix SQL python example
> ----------------------
>
>                 Key: SPARK-15031
>                 URL: https://issues.apache.org/jira/browse/SPARK-15031
>             Project: Spark
>          Issue Type: Bug
>          Components: Examples
>            Reporter: Dongjoon Hyun
>            Priority: Trivial
>
> Currently, Python SQL example, `sql.py`, fails.
> {code}
> bin/spark-submit examples/src/main/python/sql.py
> Traceback (most recent call last):
>   File "/Users/dongjoon/spark-release/spark-2.0/examples/src/main/python/sql.py", line 60, in <module>
>     people = sqlContext.jsonFile(path)
> AttributeError: 'SQLContext' object has no attribute 'jsonFile'
> {code}
> {code}
> Traceback (most recent call last):
>   File "/Users/dongjoon/spark-release/spark-2.0/examples/src/main/python/sql.py", line 72, in <module>
>     people.registerAsTable("people")
>   File "/Users/dongjoon/spark/python/lib/pyspark.zip/pyspark/sql/dataframe.py", line 795, in __getattr__
> AttributeError: 'DataFrame' object has no attribute 'registerAsTable'
> {code}
> This issue fixes them by the following fix.
> {code}
> -    people = sqlContext.jsonFile(path)
> +    people = sqlContext.read.json(path)
> ...
> -    people.registerAsTable("people")
> +    people.registerTempTable("people")
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org