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 2014/07/04 01:35:33 UTC
[jira] [Commented] (SPARK-2346) Error parsing table names that
starts with numbers
[ https://issues.apache.org/jira/browse/SPARK-2346?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14052002#comment-14052002 ]
Michael Armbrust commented on SPARK-2346:
-----------------------------------------
I think this is actually a bug in the registerAsTable function. It is not valid SQL to start a table name with a number AFAIK.
> Error parsing table names that starts with numbers
> --------------------------------------------------
>
> Key: SPARK-2346
> URL: https://issues.apache.org/jira/browse/SPARK-2346
> Project: Spark
> Issue Type: Bug
> Components: SQL
> Affects Versions: 1.0.0
> Reporter: Alexander Albul
> Labels: Parser, SQL
>
> Looks like *org.apache.spark.sql.catalyst.SqlParser* cannot parse table names when they start from numbers.
> Steps to reproduce:
> {code:title=Test.scala|borderStyle=solid}
> case class Data(value: String)
> object Test {
> def main(args: Array[String]) {
> val sc = new SparkContext("local", "sql")
> val sqlSc = new SQLContext(sc)
> import sqlSc._
> sc.parallelize(List(Data("one"), Data("two"))).registerAsTable("123_table")
> sql("SELECT * FROM '123_table'").collect().foreach(println)
> }
> }
> {code}
> And here is an exception:
> {quote}
> Exception in thread "main" java.lang.RuntimeException: [1.15] failure: ``('' expected but "123_table" found
> SELECT * FROM '123_table'
> ^
> at scala.sys.package$.error(package.scala:27)
> at org.apache.spark.sql.catalyst.SqlParser.apply(SqlParser.scala:47)
> at org.apache.spark.sql.SQLContext.parseSql(SQLContext.scala:70)
> at org.apache.spark.sql.SQLContext.sql(SQLContext.scala:150)
> at io.ubix.spark.Test$.main(Test.scala:24)
> at io.ubix.spark.Test.main(Test.scala)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:606)
> at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
> {quote}
> When i am changing from 123_table to table_123 problem disappears.
--
This message was sent by Atlassian JIRA
(v6.2#6252)