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

Apache Spark commented on SPARK-5910:
-------------------------------------

User 'marmbrus' has created a pull request for this issue:
https://github.com/apache/spark/pull/4736

> DataFrame.selectExpr("col as newName") does not work
> ----------------------------------------------------
>
>                 Key: SPARK-5910
>                 URL: https://issues.apache.org/jira/browse/SPARK-5910
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>            Reporter: Yin Huai
>            Priority: Blocker
>
> {code}
> val rdd = sc.parallelize((1 to 10).map(i => s"""{"a":$i, "b":"str${i}"}"""))
> sqlContext.jsonRDD(rdd).selectExpr("a as newName")
> {code}
> {code}
> java.lang.RuntimeException: [1.3] failure: ``or'' expected but `as' found
> a as newName
>   ^
>       at scala.sys.package$.error(package.scala:27)
>       at 
> org.apache.spark.sql.catalyst.SqlParser.parseExpression(SqlParser.scala:45)
> {code}
> For selectExpr, we need to use projection parser instead of expression parser 
> (which cannot parse AS).



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to