You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Michael Armbrust (JIRA)" <ji...@apache.org> on 2015/02/24 19:54:04 UTC

[jira] [Assigned] (SPARK-5910) DataFrame.selectExpr("col as newName") does not work

     [ https://issues.apache.org/jira/browse/SPARK-5910?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Armbrust reassigned SPARK-5910:
---------------------------------------

    Assignee: Michael Armbrust

> 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
>            Assignee: Michael Armbrust
>            Priority: Blocker
>             Fix For: 1.3.0
>
>
> {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: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org